mbox series

[0/8] IIO: More use of device_for_each_child_node_scoped() and __free()

Message ID 20240330190849.1321065-1-jic23@kernel.org (mailing list archive)
Headers show
Series IIO: More use of device_for_each_child_node_scoped() and __free() | expand

Message

Jonathan Cameron March 30, 2024, 7:08 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Mixture of new code that entered in parallel with the original conversion
set to use this new scoped cleanup and cases I missed.  Note the
relevant code didn't make the 6.9 merge window but is queued up for
6.10 in the togreg branch of iio.git and linux-next.

Includes allowing easier building of the ab8500-gpadc driver to enable
testing the changes. Seems a sensible change to make in general.

This series is making us of the automated cleanup introduced in
linux/cleanup.h and new device_for_each_child_node_scoped() to avoid
the need to remember to call fwnode_handle_put() in early exits from
loops over the child nodes. This can also be used for simple scope
based cleanup as seen in the ad3552 patch. In general this makes it
easier to avoid a common class of bug.

Jonathan Cameron (8):
  iio: adc: ab8500-gpadc: Allow COMPILE_TEST builds
  iio: adc: ab8500-gpadc: Fix kernel-doc parameter names.
  iio: adc: ab8500-gpadc: Use device_for_each_child_node_scoped() to
    simplify erorr paths.
  iio: adc: ad4130: Use device_for_each_child_node_scoped() to simplify
    error paths.
  iio: adc: ad7173: Use device_for_each_child_node_scoped() to simplify
    error paths.
  iio: frequency: admfm2000: Use device_for_each_child_node_scoped() to
    simplify error paths.
  iio: dac: ad3552: Use __free(fwnode_handle) to simplify error
    handling.
  iio: adc: pac1934: Use device_for_each_available_child_node_scoped()
    to simplify error handling.

 drivers/iio/adc/Kconfig           |  2 +-
 drivers/iio/adc/ab8500-gpadc.c    |  8 ++--
 drivers/iio/adc/ad4130.c          |  7 +--
 drivers/iio/adc/ad7173.c          | 24 +++-------
 drivers/iio/adc/pac1934.c         | 77 +++++++++++++------------------
 drivers/iio/dac/ad3552r.c         | 59 +++++++++--------------
 drivers/iio/frequency/admfm2000.c | 24 +++-------
 7 files changed, 73 insertions(+), 128 deletions(-)

Comments

Nuno Sá April 4, 2024, 9:09 a.m. UTC | #1
On Sat, 2024-03-30 at 19:08 +0000, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Mixture of new code that entered in parallel with the original conversion
> set to use this new scoped cleanup and cases I missed.  Note the
> relevant code didn't make the 6.9 merge window but is queued up for
> 6.10 in the togreg branch of iio.git and linux-next.
> 
> Includes allowing easier building of the ab8500-gpadc driver to enable
> testing the changes. Seems a sensible change to make in general.
> 
> This series is making us of the automated cleanup introduced in
> linux/cleanup.h and new device_for_each_child_node_scoped() to avoid
> the need to remember to call fwnode_handle_put() in early exits from
> loops over the child nodes. This can also be used for simple scope
> based cleanup as seen in the ad3552 patch. In general this makes it
> easier to avoid a common class of bug.
> 
> Jonathan Cameron (8):
>   iio: adc: ab8500-gpadc: Allow COMPILE_TEST builds
>   iio: adc: ab8500-gpadc: Fix kernel-doc parameter names.
>   iio: adc: ab8500-gpadc: Use device_for_each_child_node_scoped() to
>     simplify erorr paths.
>   iio: adc: ad4130: Use device_for_each_child_node_scoped() to simplify
>     error paths.
>   iio: adc: ad7173: Use device_for_each_child_node_scoped() to simplify
>     error paths.
>   iio: frequency: admfm2000: Use device_for_each_child_node_scoped() to
>     simplify error paths.
>   iio: dac: ad3552: Use __free(fwnode_handle) to simplify error
>     handling.
>   iio: adc: pac1934: Use device_for_each_available_child_node_scoped()
>     to simplify error handling.
> 
>  drivers/iio/adc/Kconfig           |  2 +-
>  drivers/iio/adc/ab8500-gpadc.c    |  8 ++--
>  drivers/iio/adc/ad4130.c          |  7 +--
>  drivers/iio/adc/ad7173.c          | 24 +++-------
>  drivers/iio/adc/pac1934.c         | 77 +++++++++++++------------------
>  drivers/iio/dac/ad3552r.c         | 59 +++++++++--------------
>  drivers/iio/frequency/admfm2000.c | 24 +++-------
>  7 files changed, 73 insertions(+), 128 deletions(-)
> 

LGTM,

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Jonathan Cameron April 6, 2024, 10:29 a.m. UTC | #2
On Thu, 04 Apr 2024 11:09:31 +0200
Nuno Sá <noname.nuno@gmail.com> wrote:

> On Sat, 2024-03-30 at 19:08 +0000, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Mixture of new code that entered in parallel with the original conversion
> > set to use this new scoped cleanup and cases I missed.  Note the
> > relevant code didn't make the 6.9 merge window but is queued up for
> > 6.10 in the togreg branch of iio.git and linux-next.
> > 
> > Includes allowing easier building of the ab8500-gpadc driver to enable
> > testing the changes. Seems a sensible change to make in general.
> > 
> > This series is making us of the automated cleanup introduced in
> > linux/cleanup.h and new device_for_each_child_node_scoped() to avoid
> > the need to remember to call fwnode_handle_put() in early exits from
> > loops over the child nodes. This can also be used for simple scope
> > based cleanup as seen in the ad3552 patch. In general this makes it
> > easier to avoid a common class of bug.
> > 
> > Jonathan Cameron (8):
> >   iio: adc: ab8500-gpadc: Allow COMPILE_TEST builds
> >   iio: adc: ab8500-gpadc: Fix kernel-doc parameter names.
> >   iio: adc: ab8500-gpadc: Use device_for_each_child_node_scoped() to
> >     simplify erorr paths.
> >   iio: adc: ad4130: Use device_for_each_child_node_scoped() to simplify
> >     error paths.
> >   iio: adc: ad7173: Use device_for_each_child_node_scoped() to simplify
> >     error paths.
> >   iio: frequency: admfm2000: Use device_for_each_child_node_scoped() to
> >     simplify error paths.
> >   iio: dac: ad3552: Use __free(fwnode_handle) to simplify error
> >     handling.
> >   iio: adc: pac1934: Use device_for_each_available_child_node_scoped()
> >     to simplify error handling.
> > 
> >  drivers/iio/adc/Kconfig           |  2 +-
> >  drivers/iio/adc/ab8500-gpadc.c    |  8 ++--
> >  drivers/iio/adc/ad4130.c          |  7 +--
> >  drivers/iio/adc/ad7173.c          | 24 +++-------
> >  drivers/iio/adc/pac1934.c         | 77 +++++++++++++------------------
> >  drivers/iio/dac/ad3552r.c         | 59 +++++++++--------------
> >  drivers/iio/frequency/admfm2000.c | 24 +++-------
> >  7 files changed, 73 insertions(+), 128 deletions(-)
> >   
> 
> LGTM,
> 
> Reviewed-by: Nuno Sa <nuno.sa@analog.com>
> 

Series applies with exception of patch 1 where discussion is ongoing.

Thanks,

Jonathan