lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240816160815.GD5853@google.com>
Date: Fri, 16 Aug 2024 17:08:15 +0100
From: Lee Jones <lee@...nel.org>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Suzuki K Poulose <suzuki.poulose@....com>,
	Mike Leach <mike.leach@...aro.org>,
	James Clark <james.clark@...aro.org>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Michael Hennerich <Michael.Hennerich@...log.com>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Jonathan Cameron <jic23@...nel.org>,
	Anand Ashok Dumbre <anand.ashok.dumbre@...inx.com>,
	Michal Simek <michal.simek@....com>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	Pavel Machek <pavel@....cz>, coresight@...ts.linaro.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-iio@...r.kernel.org, linux-leds@...r.kernel.org
Subject: Re: [PATCH v2 3/3] leds: as3645a: use device_* to iterate over
 device child nodes

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@...ux.intel.com>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.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 [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ