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: <e3276f37-a7e0-46f5-8f64-fa9e5919b5d8@alliedtelesis.co.nz>
Date: Wed, 17 Dec 2025 19:43:28 +0000
From: Chris Packham <Chris.Packham@...iedtelesis.co.nz>
To: Rosen Penev <rosenp@...il.com>, "linux-i2c@...r.kernel.org"
	<linux-i2c@...r.kernel.org>
CC: Andi Shyti <andi.shyti@...nel.org>, open list
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] i2c: rtl9300: use of instead of fwnode

Hi Rosen,

On 17/12/2025 19:30, Rosen Penev wrote:
> Avoids having to use to_of_node and just assign directly. This is an OF
> only driver anyway.
>
> Use _scoped for the for each loop to avoid refcount leaks.
>
> Signed-off-by: Rosen Penev <rosenp@...il.com>

I thought the trend was to move to the more generic device properties 
rather than using of_ specific APIs which is why I wrote the driver 
using them. I agree that this driver is unlikely to be used on any 
platform that doesn't use a device tree so if Andi is happy with this 
I'm fine with the change.

Reviewed-by: Chris Packham <chris.packham@...iedtelesis.co.nz>

> ---
>   drivers/i2c/busses/i2c-rtl9300.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
> index f2aa341a7cdd..672cb978066d 100644
> --- a/drivers/i2c/busses/i2c-rtl9300.c
> +++ b/drivers/i2c/busses/i2c-rtl9300.c
> @@ -371,7 +371,6 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
>   	struct rtl9300_i2c *i2c;
> -	struct fwnode_handle *child;
>   	const struct rtl9300_i2c_drv_data *drv_data;
>   	struct reg_field fields[F_NUM_FIELDS];
>   	u32 clock_freq, scl_num, sda_num;
> @@ -415,15 +414,15 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
>   		return ret;
>   
>   	i = 0;
> -	device_for_each_child_node(dev, child) {
> +	for_each_child_of_node_scoped(dev->of_node, child) {
>   		struct rtl9300_i2c_chan *chan = &i2c->chans[i];
>   		struct i2c_adapter *adap = &chan->adap;
>   
> -		ret = fwnode_property_read_u32(child, "reg", &sda_num);
> +		ret = of_property_read_u32(child, "reg", &sda_num);
>   		if (ret)
>   			return ret;
>   
> -		ret = fwnode_property_read_u32(child, "clock-frequency", &clock_freq);
> +		ret = of_property_read_u32(child, "clock-frequency", &clock_freq);
>   		if (ret)
>   			clock_freq = I2C_MAX_STANDARD_MODE_FREQ;
>   
> @@ -449,7 +448,7 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
>   		adap->retries = 3;
>   		adap->dev.parent = dev;
>   		i2c_set_adapdata(adap, chan);
> -		adap->dev.of_node = to_of_node(child);
> +		adap->dev.of_node = child;
>   		snprintf(adap->name, sizeof(adap->name), "%s SDA%d\n", dev_name(dev), sda_num);
>   		i++;
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ