All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped()
@ 2024-04-24 22:53 ` Pedro Mariano
  0 siblings, 0 replies; 8+ messages in thread
From: Pedro Mariano @ 2024-04-24 22:53 UTC (permalink / raw)
  To: anand.ashok.dumbre, jic23, michal.simek
  Cc: Pedro Mariano, Roberto Bolgheroni, linux-iio, linux-arm-kernel

Using device_for_each_child_node_scoped instead of
device_for_each_child_node automatically releases the handle on early exit
which reduces the chance of bugs that cause resource leaks.

Co-developed-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
Signed-off-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
Signed-off-by: Pedro Mariano <pedro.mariano@usp.br>
---
 drivers/iio/adc/xilinx-ams.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
index f0b71a122..7f5571d9d 100644
--- a/drivers/iio/adc/xilinx-ams.c
+++ b/drivers/iio/adc/xilinx-ams.c
@@ -1261,7 +1261,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
 	struct ams *ams = iio_priv(indio_dev);
 	struct iio_chan_spec *ams_channels, *dev_channels;
 	struct device *dev = indio_dev->dev.parent;
-	struct fwnode_handle *child = NULL;
 	struct fwnode_handle *fwnode = dev_fwnode(dev);
 	size_t ams_size;
 	int ret, ch_cnt = 0, i, rising_off, falling_off;
@@ -1283,13 +1282,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
 		num_channels += ret;
 	}
 
-	fwnode_for_each_child_node(fwnode, child) {
+	fwnode_for_each_child_node_scoped(fwnode, child) {
 		if (fwnode_device_is_available(child)) {
 			ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
-			if (ret < 0) {
-				fwnode_handle_put(child);
+			if (ret < 0)
 				return ret;
-			}
 
 			num_channels += ret;
 		}
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped()
@ 2024-04-24 22:53 ` Pedro Mariano
  0 siblings, 0 replies; 8+ messages in thread
From: Pedro Mariano @ 2024-04-24 22:53 UTC (permalink / raw)
  To: anand.ashok.dumbre, jic23, michal.simek
  Cc: Pedro Mariano, Roberto Bolgheroni, linux-iio, linux-arm-kernel

Using device_for_each_child_node_scoped instead of
device_for_each_child_node automatically releases the handle on early exit
which reduces the chance of bugs that cause resource leaks.

Co-developed-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
Signed-off-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
Signed-off-by: Pedro Mariano <pedro.mariano@usp.br>
---
 drivers/iio/adc/xilinx-ams.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
index f0b71a122..7f5571d9d 100644
--- a/drivers/iio/adc/xilinx-ams.c
+++ b/drivers/iio/adc/xilinx-ams.c
@@ -1261,7 +1261,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
 	struct ams *ams = iio_priv(indio_dev);
 	struct iio_chan_spec *ams_channels, *dev_channels;
 	struct device *dev = indio_dev->dev.parent;
-	struct fwnode_handle *child = NULL;
 	struct fwnode_handle *fwnode = dev_fwnode(dev);
 	size_t ams_size;
 	int ret, ch_cnt = 0, i, rising_off, falling_off;
@@ -1283,13 +1282,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
 		num_channels += ret;
 	}
 
-	fwnode_for_each_child_node(fwnode, child) {
+	fwnode_for_each_child_node_scoped(fwnode, child) {
 		if (fwnode_device_is_available(child)) {
 			ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
-			if (ret < 0) {
-				fwnode_handle_put(child);
+			if (ret < 0)
 				return ret;
-			}
 
 			num_channels += ret;
 		}
-- 
2.44.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped()
  2024-04-24 22:53 ` Pedro Mariano
@ 2024-04-27  9:13   ` Marcelo Schmitt
  -1 siblings, 0 replies; 8+ messages in thread
From: Marcelo Schmitt @ 2024-04-27  9:13 UTC (permalink / raw)
  To: Pedro Mariano
  Cc: anand.ashok.dumbre, jic23, michal.simek, Roberto Bolgheroni,
	linux-iio, linux-arm-kernel

Hi Pedro, Roberto,

Patch looks overall good except for the _scoped() function name and arguments,
must have been miss-typed or miss-copied somehow.
Comment inline.

Regards,
Marcelo

On 04/24, Pedro Mariano wrote:
> Using device_for_each_child_node_scoped instead of
> device_for_each_child_node automatically releases the handle on early exit
> which reduces the chance of bugs that cause resource leaks.
> 
> Co-developed-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
> Signed-off-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
> Signed-off-by: Pedro Mariano <pedro.mariano@usp.br>
> ---
>  drivers/iio/adc/xilinx-ams.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
> index f0b71a122..7f5571d9d 100644
> --- a/drivers/iio/adc/xilinx-ams.c
> +++ b/drivers/iio/adc/xilinx-ams.c
> @@ -1261,7 +1261,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
>  	struct ams *ams = iio_priv(indio_dev);
>  	struct iio_chan_spec *ams_channels, *dev_channels;
>  	struct device *dev = indio_dev->dev.parent;
> -	struct fwnode_handle *child = NULL;
>  	struct fwnode_handle *fwnode = dev_fwnode(dev);
>  	size_t ams_size;
>  	int ret, ch_cnt = 0, i, rising_off, falling_off;
> @@ -1283,13 +1282,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
>  		num_channels += ret;
>  	}
>  
> -	fwnode_for_each_child_node(fwnode, child) {
> +	fwnode_for_each_child_node_scoped(fwnode, child) {
should be
	device_for_each_child_node_scoped(dev, child) {

>  		if (fwnode_device_is_available(child)) {
>  			ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
> -			if (ret < 0) {
> -				fwnode_handle_put(child);
> +			if (ret < 0)
>  				return ret;
> -			}
>  
>  			num_channels += ret;
>  		}
> -- 
> 2.44.0
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped()
@ 2024-04-27  9:13   ` Marcelo Schmitt
  0 siblings, 0 replies; 8+ messages in thread
From: Marcelo Schmitt @ 2024-04-27  9:13 UTC (permalink / raw)
  To: Pedro Mariano
  Cc: anand.ashok.dumbre, jic23, michal.simek, Roberto Bolgheroni,
	linux-iio, linux-arm-kernel

Hi Pedro, Roberto,

Patch looks overall good except for the _scoped() function name and arguments,
must have been miss-typed or miss-copied somehow.
Comment inline.

Regards,
Marcelo

On 04/24, Pedro Mariano wrote:
> Using device_for_each_child_node_scoped instead of
> device_for_each_child_node automatically releases the handle on early exit
> which reduces the chance of bugs that cause resource leaks.
> 
> Co-developed-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
> Signed-off-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
> Signed-off-by: Pedro Mariano <pedro.mariano@usp.br>
> ---
>  drivers/iio/adc/xilinx-ams.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
> index f0b71a122..7f5571d9d 100644
> --- a/drivers/iio/adc/xilinx-ams.c
> +++ b/drivers/iio/adc/xilinx-ams.c
> @@ -1261,7 +1261,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
>  	struct ams *ams = iio_priv(indio_dev);
>  	struct iio_chan_spec *ams_channels, *dev_channels;
>  	struct device *dev = indio_dev->dev.parent;
> -	struct fwnode_handle *child = NULL;
>  	struct fwnode_handle *fwnode = dev_fwnode(dev);
>  	size_t ams_size;
>  	int ret, ch_cnt = 0, i, rising_off, falling_off;
> @@ -1283,13 +1282,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
>  		num_channels += ret;
>  	}
>  
> -	fwnode_for_each_child_node(fwnode, child) {
> +	fwnode_for_each_child_node_scoped(fwnode, child) {
should be
	device_for_each_child_node_scoped(dev, child) {

>  		if (fwnode_device_is_available(child)) {
>  			ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
> -			if (ret < 0) {
> -				fwnode_handle_put(child);
> +			if (ret < 0)
>  				return ret;
> -			}
>  
>  			num_channels += ret;
>  		}
> -- 
> 2.44.0
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped()
  2024-04-27  9:13   ` Marcelo Schmitt
@ 2024-04-28 16:17     ` Jonathan Cameron
  -1 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2024-04-28 16:17 UTC (permalink / raw)
  To: Marcelo Schmitt
  Cc: Pedro Mariano, anand.ashok.dumbre, michal.simek,
	Roberto Bolgheroni, linux-iio, linux-arm-kernel

On Sat, 27 Apr 2024 06:13:01 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:

> Hi Pedro, Roberto,
> 
> Patch looks overall good except for the _scoped() function name and arguments,
> must have been miss-typed or miss-copied somehow.
> Comment inline.
> 
> Regards,
> Marcelo
> 
> On 04/24, Pedro Mariano wrote:
> > Using device_for_each_child_node_scoped instead of
> > device_for_each_child_node automatically releases the handle on early exit
> > which reduces the chance of bugs that cause resource leaks.
> > 
> > Co-developed-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
> > Signed-off-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
> > Signed-off-by: Pedro Mariano <pedro.mariano@usp.br>
> > ---
> >  drivers/iio/adc/xilinx-ams.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
> > index f0b71a122..7f5571d9d 100644
> > --- a/drivers/iio/adc/xilinx-ams.c
> > +++ b/drivers/iio/adc/xilinx-ams.c
> > @@ -1261,7 +1261,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
> >  	struct ams *ams = iio_priv(indio_dev);
> >  	struct iio_chan_spec *ams_channels, *dev_channels;
> >  	struct device *dev = indio_dev->dev.parent;
> > -	struct fwnode_handle *child = NULL;
> >  	struct fwnode_handle *fwnode = dev_fwnode(dev);
> >  	size_t ams_size;
> >  	int ret, ch_cnt = 0, i, rising_off, falling_off;
> > @@ -1283,13 +1282,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
> >  		num_channels += ret;
> >  	}
> >  
> > -	fwnode_for_each_child_node(fwnode, child) {
> > +	fwnode_for_each_child_node_scoped(fwnode, child) {  
> should be
> 	device_for_each_child_node_scoped(dev, child) {

Yes, we didn't bother with a fwnode specific version of this macro because they
aren't nearly as common.  I'm not sure why this driver didn't always use the
device form or why it needs the fwnode_device_is_available()
I suspect this dates back to some confusion on why there were _available variants.

Chances are this driver only cares about DT and in that case the callback used is

static struct fwnode_handle *
of_fwnode_get_next_child_node(const struct fwnode_handle *fwnode,
			      struct fwnode_handle *child)
{
	return of_fwnode_handle(of_get_next_available_child(to_of_node(fwnode),
							    to_of_node(child)));
}

So the fwnode_for_each_child_node() + fwnode_device_is_available() end up doing the
same as device_for_each_child_node().

So I think there are more opportunities to tidy up in here than simply this scoped
change and I'd be keen to see them all done together.

Jonathan

> 
> >  		if (fwnode_device_is_available(child)) {
> >  			ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
> > -			if (ret < 0) {
> > -				fwnode_handle_put(child);
> > +			if (ret < 0)
> >  				return ret;
> > -			}
> >  
> >  			num_channels += ret;
> >  		}
> > -- 
> > 2.44.0
> > 
> >   


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped()
@ 2024-04-28 16:17     ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2024-04-28 16:17 UTC (permalink / raw)
  To: Marcelo Schmitt
  Cc: Pedro Mariano, anand.ashok.dumbre, michal.simek,
	Roberto Bolgheroni, linux-iio, linux-arm-kernel

On Sat, 27 Apr 2024 06:13:01 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:

> Hi Pedro, Roberto,
> 
> Patch looks overall good except for the _scoped() function name and arguments,
> must have been miss-typed or miss-copied somehow.
> Comment inline.
> 
> Regards,
> Marcelo
> 
> On 04/24, Pedro Mariano wrote:
> > Using device_for_each_child_node_scoped instead of
> > device_for_each_child_node automatically releases the handle on early exit
> > which reduces the chance of bugs that cause resource leaks.
> > 
> > Co-developed-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
> > Signed-off-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
> > Signed-off-by: Pedro Mariano <pedro.mariano@usp.br>
> > ---
> >  drivers/iio/adc/xilinx-ams.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
> > index f0b71a122..7f5571d9d 100644
> > --- a/drivers/iio/adc/xilinx-ams.c
> > +++ b/drivers/iio/adc/xilinx-ams.c
> > @@ -1261,7 +1261,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
> >  	struct ams *ams = iio_priv(indio_dev);
> >  	struct iio_chan_spec *ams_channels, *dev_channels;
> >  	struct device *dev = indio_dev->dev.parent;
> > -	struct fwnode_handle *child = NULL;
> >  	struct fwnode_handle *fwnode = dev_fwnode(dev);
> >  	size_t ams_size;
> >  	int ret, ch_cnt = 0, i, rising_off, falling_off;
> > @@ -1283,13 +1282,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
> >  		num_channels += ret;
> >  	}
> >  
> > -	fwnode_for_each_child_node(fwnode, child) {
> > +	fwnode_for_each_child_node_scoped(fwnode, child) {  
> should be
> 	device_for_each_child_node_scoped(dev, child) {

Yes, we didn't bother with a fwnode specific version of this macro because they
aren't nearly as common.  I'm not sure why this driver didn't always use the
device form or why it needs the fwnode_device_is_available()
I suspect this dates back to some confusion on why there were _available variants.

Chances are this driver only cares about DT and in that case the callback used is

static struct fwnode_handle *
of_fwnode_get_next_child_node(const struct fwnode_handle *fwnode,
			      struct fwnode_handle *child)
{
	return of_fwnode_handle(of_get_next_available_child(to_of_node(fwnode),
							    to_of_node(child)));
}

So the fwnode_for_each_child_node() + fwnode_device_is_available() end up doing the
same as device_for_each_child_node().

So I think there are more opportunities to tidy up in here than simply this scoped
change and I'd be keen to see them all done together.

Jonathan

> 
> >  		if (fwnode_device_is_available(child)) {
> >  			ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
> > -			if (ret < 0) {
> > -				fwnode_handle_put(child);
> > +			if (ret < 0)
> >  				return ret;
> > -			}
> >  
> >  			num_channels += ret;
> >  		}
> > -- 
> > 2.44.0
> > 
> >   


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped()
  2024-04-28 16:17     ` Jonathan Cameron
@ 2024-04-29  6:28       ` Michal Simek
  -1 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2024-04-29  6:28 UTC (permalink / raw)
  To: Jonathan Cameron, Marcelo Schmitt
  Cc: Pedro Mariano, anand.ashok.dumbre, Roberto Bolgheroni, linux-iio,
	linux-arm-kernel



On 4/28/24 18:17, Jonathan Cameron wrote:
> On Sat, 27 Apr 2024 06:13:01 -0300
> Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:
> 
>> Hi Pedro, Roberto,
>>
>> Patch looks overall good except for the _scoped() function name and arguments,
>> must have been miss-typed or miss-copied somehow.
>> Comment inline.
>>
>> Regards,
>> Marcelo
>>
>> On 04/24, Pedro Mariano wrote:
>>> Using device_for_each_child_node_scoped instead of
>>> device_for_each_child_node automatically releases the handle on early exit
>>> which reduces the chance of bugs that cause resource leaks.
>>>
>>> Co-developed-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
>>> Signed-off-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
>>> Signed-off-by: Pedro Mariano <pedro.mariano@usp.br>
>>> ---
>>>   drivers/iio/adc/xilinx-ams.c | 7 ++-----
>>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
>>> index f0b71a122..7f5571d9d 100644
>>> --- a/drivers/iio/adc/xilinx-ams.c
>>> +++ b/drivers/iio/adc/xilinx-ams.c
>>> @@ -1261,7 +1261,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
>>>   	struct ams *ams = iio_priv(indio_dev);
>>>   	struct iio_chan_spec *ams_channels, *dev_channels;
>>>   	struct device *dev = indio_dev->dev.parent;
>>> -	struct fwnode_handle *child = NULL;
>>>   	struct fwnode_handle *fwnode = dev_fwnode(dev);
>>>   	size_t ams_size;
>>>   	int ret, ch_cnt = 0, i, rising_off, falling_off;
>>> @@ -1283,13 +1282,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
>>>   		num_channels += ret;
>>>   	}
>>>   
>>> -	fwnode_for_each_child_node(fwnode, child) {
>>> +	fwnode_for_each_child_node_scoped(fwnode, child) {
>> should be
>> 	device_for_each_child_node_scoped(dev, child) {
> 
> Yes, we didn't bother with a fwnode specific version of this macro because they
> aren't nearly as common.  I'm not sure why this driver didn't always use the
> device form or why it needs the fwnode_device_is_available()
> I suspect this dates back to some confusion on why there were _available variants.
> 
> Chances are this driver only cares about DT and in that case the callback used is

That's correct. We are using this driver on DT system.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped()
@ 2024-04-29  6:28       ` Michal Simek
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2024-04-29  6:28 UTC (permalink / raw)
  To: Jonathan Cameron, Marcelo Schmitt
  Cc: Pedro Mariano, anand.ashok.dumbre, Roberto Bolgheroni, linux-iio,
	linux-arm-kernel



On 4/28/24 18:17, Jonathan Cameron wrote:
> On Sat, 27 Apr 2024 06:13:01 -0300
> Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:
> 
>> Hi Pedro, Roberto,
>>
>> Patch looks overall good except for the _scoped() function name and arguments,
>> must have been miss-typed or miss-copied somehow.
>> Comment inline.
>>
>> Regards,
>> Marcelo
>>
>> On 04/24, Pedro Mariano wrote:
>>> Using device_for_each_child_node_scoped instead of
>>> device_for_each_child_node automatically releases the handle on early exit
>>> which reduces the chance of bugs that cause resource leaks.
>>>
>>> Co-developed-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
>>> Signed-off-by: Roberto Bolgheroni <robertobolgheroni@usp.br>
>>> Signed-off-by: Pedro Mariano <pedro.mariano@usp.br>
>>> ---
>>>   drivers/iio/adc/xilinx-ams.c | 7 ++-----
>>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
>>> index f0b71a122..7f5571d9d 100644
>>> --- a/drivers/iio/adc/xilinx-ams.c
>>> +++ b/drivers/iio/adc/xilinx-ams.c
>>> @@ -1261,7 +1261,6 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
>>>   	struct ams *ams = iio_priv(indio_dev);
>>>   	struct iio_chan_spec *ams_channels, *dev_channels;
>>>   	struct device *dev = indio_dev->dev.parent;
>>> -	struct fwnode_handle *child = NULL;
>>>   	struct fwnode_handle *fwnode = dev_fwnode(dev);
>>>   	size_t ams_size;
>>>   	int ret, ch_cnt = 0, i, rising_off, falling_off;
>>> @@ -1283,13 +1282,11 @@ static int ams_parse_firmware(struct iio_dev *indio_dev)
>>>   		num_channels += ret;
>>>   	}
>>>   
>>> -	fwnode_for_each_child_node(fwnode, child) {
>>> +	fwnode_for_each_child_node_scoped(fwnode, child) {
>> should be
>> 	device_for_each_child_node_scoped(dev, child) {
> 
> Yes, we didn't bother with a fwnode specific version of this macro because they
> aren't nearly as common.  I'm not sure why this driver didn't always use the
> device form or why it needs the fwnode_device_is_available()
> I suspect this dates back to some confusion on why there were _available variants.
> 
> Chances are this driver only cares about DT and in that case the callback used is

That's correct. We are using this driver on DT system.

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-29  6:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 22:53 [PATCH] iio: adc: xilinx-ams: Use device_for_each_child_node_scoped() Pedro Mariano
2024-04-24 22:53 ` Pedro Mariano
2024-04-27  9:13 ` Marcelo Schmitt
2024-04-27  9:13   ` Marcelo Schmitt
2024-04-28 16:17   ` Jonathan Cameron
2024-04-28 16:17     ` Jonathan Cameron
2024-04-29  6:28     ` Michal Simek
2024-04-29  6:28       ` Michal Simek

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.