From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Ai Chao <aichao@kylinos.cn>,
perex@perex.cz, tiwai@suse.com, johannes@sipsolutions.net,
kuninori.morimoto.gx@renesas.com, lgirdwood@gmail.com,
broonie@kernel.org, jbrunet@baylibre.com,
neil.armstrong@linaro.org, khilman@baylibre.com,
martin.blumenstingl@googlemail.com, shengjiu.wang@gmail.com,
Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com,
shawnguo@kernel.org, s.hauer@pengutronix.de,
srinivas.kandagatla@linaro.org
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, imx@lists.linux.dev,
kernel@pengutronix.de, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 2/6] ASoC: aoa: Use helper function for_each_child_of_node_scoped()
Date: Fri, 23 May 2025 12:51:43 +0200 [thread overview]
Message-ID: <8ad901c3-3fcb-4643-ac5a-c1f30f93d07f@csgroup.eu> (raw)
In-Reply-To: <20250522050300.519244-3-aichao@kylinos.cn>
Le 22/05/2025 à 07:02, Ai Chao a écrit :
> The for_each_child_of_node_scoped() helper provides a scope-based
> clean-up functionality to put the device_node automatically, and
> as such, there is no need to call of_node_put() directly.
I don't understand this explanation.
You say "no need to call of_node_put()" and the only thing you do in
addition to changing from for_each_child_of_node() to
for_each_child_of_node_scoped() is to _add_ a new call to of_node_put().
I would expect to see a _removal_ of some of_node_put() when I read your
description.
Christophe
>
> Thus, use this helper to simplify the code.
>
> Signed-off-by: Ai Chao <aichao@kylinos.cn>
> ---
> sound/aoa/soundbus/i2sbus/core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
> index ce84288168e4..20a4c5891afc 100644
> --- a/sound/aoa/soundbus/i2sbus/core.c
> +++ b/sound/aoa/soundbus/i2sbus/core.c
> @@ -207,6 +207,8 @@ static int i2sbus_add_dev(struct macio_dev *macio,
> }
> }
> }
> + of_node_put(sound);
> +
> /* for the time being, until we can handle non-layout-id
> * things in some fabric, refuse to attach if there is no
> * layout-id property or we haven't been forced to attach.
> @@ -335,7 +337,6 @@ static int i2sbus_add_dev(struct macio_dev *macio,
>
> static int i2sbus_probe(struct macio_dev* dev, const struct of_device_id *match)
> {
> - struct device_node *np;
> int got = 0, err;
> struct i2sbus_control *control = NULL;
>
> @@ -347,7 +348,7 @@ static int i2sbus_probe(struct macio_dev* dev, const struct of_device_id *match)
> return -ENODEV;
> }
>
> - for_each_child_of_node(dev->ofdev.dev.of_node, np) {
> + for_each_child_of_node_scoped(dev->ofdev.dev.of_node, np) {
> if (of_device_is_compatible(np, "i2sbus") ||
> of_device_is_compatible(np, "i2s-modem")) {
> got += i2sbus_add_dev(dev, control, np);
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2025-05-23 12:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 5:02 [PATCH v2 0/6] Use helper function for_each_child_of_node_scoped() Ai Chao
2025-05-22 5:02 ` [PATCH v2 1/6] ASoC: ppc: " Ai Chao
2025-05-22 10:00 ` Mark Brown
2025-05-22 5:02 ` [PATCH v2 2/6] ASoC: aoa: " Ai Chao
2025-05-22 10:04 ` Johannes Berg
2025-05-23 10:51 ` Christophe Leroy [this message]
2025-05-26 8:53 ` Ai Chao
2025-05-22 5:02 ` [PATCH v2 3/6] ASoC: renesas: " Ai Chao
2025-05-22 5:02 ` [PATCH v2 4/6] ASoC: meson: " Ai Chao
2025-05-22 5:02 ` [PATCH v2 5/6] ASoC: imx-card: " Ai Chao
2025-05-22 5:02 ` [PATCH v2 6/6] ASoC: qcom: " Ai Chao
2025-05-22 12:37 ` Dmitry Baryshkov
[not found] <2aq0nyvyf7t-2aq4hsc7kp6@nsmail7.0.0--kylin--1>
2025-05-23 10:40 ` [PATCH v2 2/6] ASoC: aoa: " Johannes Berg
2025-05-26 8:12 ` Ai Chao
2025-05-26 8:13 ` Johannes Berg
2025-05-26 8:20 ` Ai Chao
2025-05-26 8:21 ` Johannes Berg
2025-05-30 9:30 ` Ai Chao
2025-05-28 19:23 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ad901c3-3fcb-4643-ac5a-c1f30f93d07f@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=Xiubo.Lee@gmail.com \
--cc=aichao@kylinos.cn \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jbrunet@baylibre.com \
--cc=johannes@sipsolutions.net \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=shengjiu.wang@gmail.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox