From: Lee Jones <lee@kernel.org>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>,
James Clark <james.clark@linaro.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>,
Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>,
Michal Simek <michal.simek@amd.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Pavel Machek <pavel@ucw.cz>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
linux-leds@vger.kernel.org
Subject: Re: [PATCH v2 3/3] leds: as3645a: use device_* to iterate over device child nodes
Date: Fri, 16 Aug 2024 17:08:15 +0100 [thread overview]
Message-ID: <20240816160815.GD5853@google.com> (raw)
In-Reply-To: <20240808-device_child_node_access-v2-3-fc757cc76650@gmail.com>
On Thu, 08 Aug 2024, Javier Carrasco wrote:
> Drop the manual access to the fwnode of the device to iterate over its
> child nodes. `device_for_each_child_node` macro provides direct access
> to the child nodes, and given that the `child` variable is only required
> within the loop, the scoped variant of the macro can be used.
>
> Use the `device_for_each_child_node_scoped` macro to iterate over the
> direct child nodes of the device.
>
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
> drivers/leds/flash/leds-as3645a.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/leds/flash/leds-as3645a.c b/drivers/leds/flash/leds-as3645a.c
> index 2c6ef321b7c8..8e6abedf6e00 100644
> --- a/drivers/leds/flash/leds-as3645a.c
> +++ b/drivers/leds/flash/leds-as3645a.c
> @@ -478,14 +478,12 @@ static int as3645a_detect(struct as3645a *flash)
> return as3645a_write(flash, AS_BOOST_REG, AS_BOOST_CURRENT_DISABLE);
> }
>
> -static int as3645a_parse_node(struct as3645a *flash,
> - struct fwnode_handle *fwnode)
> +static int as3645a_parse_node(struct as3645a *flash, struct device *dev)
Please swap the parameters to have the more senior one (dev) at the start.
> {
> struct as3645a_config *cfg = &flash->cfg;
> - struct fwnode_handle *child;
> int rval;
>
> - fwnode_for_each_child_node(fwnode, child) {
> + device_for_each_child_node_scoped(dev, child) {
> u32 id = 0;
>
> fwnode_property_read_u32(child, "reg", &id);
> @@ -686,7 +684,7 @@ static int as3645a_probe(struct i2c_client *client)
>
> flash->client = client;
>
> - rval = as3645a_parse_node(flash, dev_fwnode(&client->dev));
> + rval = as3645a_parse_node(flash, &client->dev);
> if (rval < 0)
> return rval;
>
>
> --
> 2.43.0
>
>
--
Lee Jones [李琼斯]
next prev parent reply other threads:[~2024-08-16 16:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 15:12 [PATCH v2 0/3] use device_for_each_child_node_scoped to access device child nodes Javier Carrasco
2024-08-08 15:12 ` [PATCH v2 1/3] coresight: cti: use device_* to iterate over " Javier Carrasco
2024-08-19 10:34 ` Mike Leach
2024-08-08 15:12 ` [PATCH v2 2/3] iio: adc: xilinx-ams: " Javier Carrasco
2024-08-10 10:38 ` Jonathan Cameron
2024-08-08 15:12 ` [PATCH v2 3/3] leds: as3645a: " Javier Carrasco
2024-08-16 16:08 ` Lee Jones [this message]
2024-08-19 14:33 ` [PATCH v2 0/3] use device_for_each_child_node_scoped to access " Suzuki K Poulose
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=20240816160815.GD5853@google.com \
--to=lee@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=anand.ashok.dumbre@xilinx.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=mike.leach@linaro.org \
--cc=pavel@ucw.cz \
--cc=sakari.ailus@linux.intel.com \
--cc=suzuki.poulose@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.