[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZHuGIGDsyGWPTvKi@surfacebook>
Date: Sat, 3 Jun 2023 21:27:44 +0300
From: andy.shevchenko@...il.com
To: Herve Codina <herve.codina@...tlin.com>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
alsa-devel@...a-project.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
Christophe Leroy <christophe.leroy@...roup.eu>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v2 9/9] ASoC: simple-card: Handle additional devices
Tue, May 23, 2023 at 05:12:23PM +0200, Herve Codina kirjoitti:
> An additional-devs subnode can be present in the simple-card top node.
> This subnode is used to declared some "virtual" additional devices.
>
> Create related devices from this subnode and avoid this subnode presence
> to interfere with the already supported subnodes analysis.
...
> +static int simple_populate_aux(struct asoc_simple_priv *priv)
> +{
> + struct device *dev = simple_priv_to_dev(priv);
> + struct device_node *node;
> + struct device **ptr;
> + int ret;
> +
> + node = of_get_child_by_name(dev->of_node, PREFIX "additional-devs");
> + if (!node)
> + return 0;
> +
> + ptr = devres_alloc(simple_populate_aux_release, sizeof(*ptr), GFP_KERNEL);
> + if (!ptr)
> + return -ENOMEM;
> +
> + ret = of_platform_populate(node, NULL, NULL, dev);
> + if (ret) {
> + devres_free(ptr);
> + } else {
> + *ptr = dev;
> + devres_add(dev, ptr);
> + }
> + return ret;
This can be well simplified by using devm_add_action_or_reset().
> +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists