mbox series

[00/15] iio: let spi drivers return 0 in .remove()

Message ID 20211013203223.2694577-1-u.kleine-koenig@pengutronix.de (mailing list archive)
Headers show
Series iio: let spi drivers return 0 in .remove() | expand

Message

Uwe Kleine-König Oct. 13, 2021, 8:32 p.m. UTC
Hello,

this series is part of my quest to change the return type of the spi
driver .remove() callback to void. In this first stage I fix all drivers
to return 0 to be able to mechanically change all drivers in the final
step.

Returning an error code (which actually very few drivers do) doesn't
make much sense, because the only effect is that the spi core emits an
error message.

The same holds try for i2c drivers, some of them are fixed en passant.

There are no interdependencies in this series, and there is some more
work to do for the final conversion, so apply the patches from this
series at will :-)

Best regards
Uwe

Uwe Kleine-König (15):
  iio: accel: bma400: Make bma400_remove() return void
  iio: accel: bmc150: Make bmc150_accel_core_remove() return void
  iio: accel: bmi088: Make bmi088_accel_core_remove() return void
  iio: accel: kxsd9: Make kxsd9_common_remove() return void
  iio: accel: mma7455: Make mma7455_core_remove() return void
  iio: accel: ad5064: Make ad5064_core_remove() return void
  iio: dac: ad5380: Make ad5380_remove() return void
  iio: dac: ad5446: Make ad5446_remove() return void
  iio: dac: ad5592r: Make ad5592r_remove() return void
  iio: dac: ad5686: Make ad5686_remove() return void
  iio: health: afe4403: Don't return an error in .remove()
  iio: imu: st_lsm9ds0: Make st_lsm9ds0_remove() return void
  iio: magn: hmc5843: Make hmc5843_common_remove() return void
  iio: potentiometer: max5487: Don't return an error in .remove()
  iio: pressure: ms5611: Make ms5611_remove() return void

 drivers/iio/accel/bma400.h                   |  2 +-
 drivers/iio/accel/bma400_core.c              |  7 ++++---
 drivers/iio/accel/bma400_i2c.c               |  4 +++-
 drivers/iio/accel/bma400_spi.c               |  4 +++-
 drivers/iio/accel/bmc150-accel-core.c        |  4 +---
 drivers/iio/accel/bmc150-accel-i2c.c         |  4 +++-
 drivers/iio/accel/bmc150-accel-spi.c         |  4 +++-
 drivers/iio/accel/bmc150-accel.h             |  2 +-
 drivers/iio/accel/bmi088-accel-core.c        |  4 +---
 drivers/iio/accel/bmi088-accel-spi.c         |  4 +++-
 drivers/iio/accel/bmi088-accel.h             |  2 +-
 drivers/iio/accel/kxsd9-i2c.c                |  4 +++-
 drivers/iio/accel/kxsd9-spi.c                |  4 +++-
 drivers/iio/accel/kxsd9.c                    |  4 +---
 drivers/iio/accel/kxsd9.h                    |  2 +-
 drivers/iio/accel/mma7455.h                  |  2 +-
 drivers/iio/accel/mma7455_core.c             |  4 +---
 drivers/iio/accel/mma7455_i2c.c              |  4 +++-
 drivers/iio/accel/mma7455_spi.c              |  4 +++-
 drivers/iio/dac/ad5064.c                     | 12 +++++++-----
 drivers/iio/dac/ad5380.c                     | 15 ++++++++-------
 drivers/iio/dac/ad5446.c                     | 12 +++++++-----
 drivers/iio/dac/ad5592r-base.c               |  4 +---
 drivers/iio/dac/ad5592r-base.h               |  2 +-
 drivers/iio/dac/ad5592r.c                    |  4 +++-
 drivers/iio/dac/ad5593r.c                    |  4 +++-
 drivers/iio/dac/ad5686-spi.c                 |  4 +++-
 drivers/iio/dac/ad5686.c                     |  4 +---
 drivers/iio/dac/ad5686.h                     |  2 +-
 drivers/iio/dac/ad5696-i2c.c                 |  4 +++-
 drivers/iio/health/afe4403.c                 |  6 ++----
 drivers/iio/imu/st_lsm9ds0/st_lsm9ds0.h      |  2 +-
 drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c |  4 +---
 drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c  |  4 +++-
 drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c  |  4 +++-
 drivers/iio/magnetometer/hmc5843.h           |  2 +-
 drivers/iio/magnetometer/hmc5843_core.c      |  4 +---
 drivers/iio/magnetometer/hmc5843_i2c.c       |  4 +++-
 drivers/iio/magnetometer/hmc5843_spi.c       |  4 +++-
 drivers/iio/potentiometer/max5487.c          |  7 ++++++-
 drivers/iio/pressure/ms5611.h                |  2 +-
 drivers/iio/pressure/ms5611_core.c           |  4 +---
 drivers/iio/pressure/ms5611_i2c.c            |  4 +++-
 drivers/iio/pressure/ms5611_spi.c            |  4 +++-
 44 files changed, 110 insertions(+), 81 deletions(-)


base-commit: 9e1ff307c779ce1f0f810c7ecce3d95bbae40896

Comments

Alexandru Ardelean Oct. 14, 2021, 7:45 a.m. UTC | #1
On Wed, Oct 13, 2021 at 11:33 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Hello,
>
> this series is part of my quest to change the return type of the spi
> driver .remove() callback to void. In this first stage I fix all drivers
> to return 0 to be able to mechanically change all drivers in the final
> step.
>
> Returning an error code (which actually very few drivers do) doesn't
> make much sense, because the only effect is that the spi core emits an
> error message.
>
> The same holds try for i2c drivers, some of them are fixed en passant.
>
> There are no interdependencies in this series, and there is some more
> work to do for the final conversion, so apply the patches from this
> series at will :-)
>

Series looks good.
However this set also makes a case for doing more conversions to devm_
usage in probe.

With devm_ , we get slightly less code, with some mirrored unwinding
in error and remove paths.
There are currently ~170 places (not necessarily the same amount of
drivers), where devm_ can be used.

What I typically do is run this command in a kernel tree:  "git grep
-w iio_device_unregister | wc -l"
When I run it without "wc -l", I will pick a file and take a look
inside it and check it's convertibility to using
devm_iio_device_unregister()
The rationale is, that for IIO drivers, if you get
devm_iio_device_unregister() (properly) called last, then it's fully
converted to devm_ functions.

For this series particularly:

Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>

> Best regards
> Uwe
>
> Uwe Kleine-König (15):
>   iio: accel: bma400: Make bma400_remove() return void
>   iio: accel: bmc150: Make bmc150_accel_core_remove() return void
>   iio: accel: bmi088: Make bmi088_accel_core_remove() return void
>   iio: accel: kxsd9: Make kxsd9_common_remove() return void
>   iio: accel: mma7455: Make mma7455_core_remove() return void
>   iio: accel: ad5064: Make ad5064_core_remove() return void
>   iio: dac: ad5380: Make ad5380_remove() return void
>   iio: dac: ad5446: Make ad5446_remove() return void
>   iio: dac: ad5592r: Make ad5592r_remove() return void
>   iio: dac: ad5686: Make ad5686_remove() return void
>   iio: health: afe4403: Don't return an error in .remove()
>   iio: imu: st_lsm9ds0: Make st_lsm9ds0_remove() return void
>   iio: magn: hmc5843: Make hmc5843_common_remove() return void
>   iio: potentiometer: max5487: Don't return an error in .remove()
>   iio: pressure: ms5611: Make ms5611_remove() return void
>
>  drivers/iio/accel/bma400.h                   |  2 +-
>  drivers/iio/accel/bma400_core.c              |  7 ++++---
>  drivers/iio/accel/bma400_i2c.c               |  4 +++-
>  drivers/iio/accel/bma400_spi.c               |  4 +++-
>  drivers/iio/accel/bmc150-accel-core.c        |  4 +---
>  drivers/iio/accel/bmc150-accel-i2c.c         |  4 +++-
>  drivers/iio/accel/bmc150-accel-spi.c         |  4 +++-
>  drivers/iio/accel/bmc150-accel.h             |  2 +-
>  drivers/iio/accel/bmi088-accel-core.c        |  4 +---
>  drivers/iio/accel/bmi088-accel-spi.c         |  4 +++-
>  drivers/iio/accel/bmi088-accel.h             |  2 +-
>  drivers/iio/accel/kxsd9-i2c.c                |  4 +++-
>  drivers/iio/accel/kxsd9-spi.c                |  4 +++-
>  drivers/iio/accel/kxsd9.c                    |  4 +---
>  drivers/iio/accel/kxsd9.h                    |  2 +-
>  drivers/iio/accel/mma7455.h                  |  2 +-
>  drivers/iio/accel/mma7455_core.c             |  4 +---
>  drivers/iio/accel/mma7455_i2c.c              |  4 +++-
>  drivers/iio/accel/mma7455_spi.c              |  4 +++-
>  drivers/iio/dac/ad5064.c                     | 12 +++++++-----
>  drivers/iio/dac/ad5380.c                     | 15 ++++++++-------
>  drivers/iio/dac/ad5446.c                     | 12 +++++++-----
>  drivers/iio/dac/ad5592r-base.c               |  4 +---
>  drivers/iio/dac/ad5592r-base.h               |  2 +-
>  drivers/iio/dac/ad5592r.c                    |  4 +++-
>  drivers/iio/dac/ad5593r.c                    |  4 +++-
>  drivers/iio/dac/ad5686-spi.c                 |  4 +++-
>  drivers/iio/dac/ad5686.c                     |  4 +---
>  drivers/iio/dac/ad5686.h                     |  2 +-
>  drivers/iio/dac/ad5696-i2c.c                 |  4 +++-
>  drivers/iio/health/afe4403.c                 |  6 ++----
>  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0.h      |  2 +-
>  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c |  4 +---
>  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c  |  4 +++-
>  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c  |  4 +++-
>  drivers/iio/magnetometer/hmc5843.h           |  2 +-
>  drivers/iio/magnetometer/hmc5843_core.c      |  4 +---
>  drivers/iio/magnetometer/hmc5843_i2c.c       |  4 +++-
>  drivers/iio/magnetometer/hmc5843_spi.c       |  4 +++-
>  drivers/iio/potentiometer/max5487.c          |  7 ++++++-
>  drivers/iio/pressure/ms5611.h                |  2 +-
>  drivers/iio/pressure/ms5611_core.c           |  4 +---
>  drivers/iio/pressure/ms5611_i2c.c            |  4 +++-
>  drivers/iio/pressure/ms5611_spi.c            |  4 +++-
>  44 files changed, 110 insertions(+), 81 deletions(-)
>
>
> base-commit: 9e1ff307c779ce1f0f810c7ecce3d95bbae40896
> --
> 2.30.2
>
Jonathan Cameron Oct. 14, 2021, 5:35 p.m. UTC | #2
On Thu, 14 Oct 2021 10:45:36 +0300
Alexandru Ardelean <ardeleanalex@gmail.com> wrote:

> On Wed, Oct 13, 2021 at 11:33 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> >
> > Hello,
> >
> > this series is part of my quest to change the return type of the spi
> > driver .remove() callback to void. In this first stage I fix all drivers
> > to return 0 to be able to mechanically change all drivers in the final
> > step.
> >
> > Returning an error code (which actually very few drivers do) doesn't
> > make much sense, because the only effect is that the spi core emits an
> > error message.
> >
> > The same holds try for i2c drivers, some of them are fixed en passant.
> >
> > There are no interdependencies in this series, and there is some more
> > work to do for the final conversion, so apply the patches from this
> > series at will :-)
> >  
> 
> Series looks good.
> However this set also makes a case for doing more conversions to devm_
> usage in probe.
Indeed. 2 of these were already done :)

Rest of the series applied to the togreg branch of iio.git and pushed out
as testing for 0-day to poke at it and see if we missed anything.

Thanks,

Jonathan

> 
> With devm_ , we get slightly less code, with some mirrored unwinding
> in error and remove paths.
> There are currently ~170 places (not necessarily the same amount of
> drivers), where devm_ can be used.
> 
> What I typically do is run this command in a kernel tree:  "git grep
> -w iio_device_unregister | wc -l"
> When I run it without "wc -l", I will pick a file and take a look
> inside it and check it's convertibility to using
> devm_iio_device_unregister()
> The rationale is, that for IIO drivers, if you get
> devm_iio_device_unregister() (properly) called last, then it's fully
> converted to devm_ functions.
> 
> For this series particularly:
> 
> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> 
> > Best regards
> > Uwe
> >
> > Uwe Kleine-König (15):
> >   iio: accel: bma400: Make bma400_remove() return void
> >   iio: accel: bmc150: Make bmc150_accel_core_remove() return void
> >   iio: accel: bmi088: Make bmi088_accel_core_remove() return void
> >   iio: accel: kxsd9: Make kxsd9_common_remove() return void
> >   iio: accel: mma7455: Make mma7455_core_remove() return void
> >   iio: accel: ad5064: Make ad5064_core_remove() return void
> >   iio: dac: ad5380: Make ad5380_remove() return void
> >   iio: dac: ad5446: Make ad5446_remove() return void
> >   iio: dac: ad5592r: Make ad5592r_remove() return void
> >   iio: dac: ad5686: Make ad5686_remove() return void
> >   iio: health: afe4403: Don't return an error in .remove()
> >   iio: imu: st_lsm9ds0: Make st_lsm9ds0_remove() return void
> >   iio: magn: hmc5843: Make hmc5843_common_remove() return void
> >   iio: potentiometer: max5487: Don't return an error in .remove()
> >   iio: pressure: ms5611: Make ms5611_remove() return void
> >
> >  drivers/iio/accel/bma400.h                   |  2 +-
> >  drivers/iio/accel/bma400_core.c              |  7 ++++---
> >  drivers/iio/accel/bma400_i2c.c               |  4 +++-
> >  drivers/iio/accel/bma400_spi.c               |  4 +++-
> >  drivers/iio/accel/bmc150-accel-core.c        |  4 +---
> >  drivers/iio/accel/bmc150-accel-i2c.c         |  4 +++-
> >  drivers/iio/accel/bmc150-accel-spi.c         |  4 +++-
> >  drivers/iio/accel/bmc150-accel.h             |  2 +-
> >  drivers/iio/accel/bmi088-accel-core.c        |  4 +---
> >  drivers/iio/accel/bmi088-accel-spi.c         |  4 +++-
> >  drivers/iio/accel/bmi088-accel.h             |  2 +-
> >  drivers/iio/accel/kxsd9-i2c.c                |  4 +++-
> >  drivers/iio/accel/kxsd9-spi.c                |  4 +++-
> >  drivers/iio/accel/kxsd9.c                    |  4 +---
> >  drivers/iio/accel/kxsd9.h                    |  2 +-
> >  drivers/iio/accel/mma7455.h                  |  2 +-
> >  drivers/iio/accel/mma7455_core.c             |  4 +---
> >  drivers/iio/accel/mma7455_i2c.c              |  4 +++-
> >  drivers/iio/accel/mma7455_spi.c              |  4 +++-
> >  drivers/iio/dac/ad5064.c                     | 12 +++++++-----
> >  drivers/iio/dac/ad5380.c                     | 15 ++++++++-------
> >  drivers/iio/dac/ad5446.c                     | 12 +++++++-----
> >  drivers/iio/dac/ad5592r-base.c               |  4 +---
> >  drivers/iio/dac/ad5592r-base.h               |  2 +-
> >  drivers/iio/dac/ad5592r.c                    |  4 +++-
> >  drivers/iio/dac/ad5593r.c                    |  4 +++-
> >  drivers/iio/dac/ad5686-spi.c                 |  4 +++-
> >  drivers/iio/dac/ad5686.c                     |  4 +---
> >  drivers/iio/dac/ad5686.h                     |  2 +-
> >  drivers/iio/dac/ad5696-i2c.c                 |  4 +++-
> >  drivers/iio/health/afe4403.c                 |  6 ++----
> >  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0.h      |  2 +-
> >  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_core.c |  4 +---
> >  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c  |  4 +++-
> >  drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c  |  4 +++-
> >  drivers/iio/magnetometer/hmc5843.h           |  2 +-
> >  drivers/iio/magnetometer/hmc5843_core.c      |  4 +---
> >  drivers/iio/magnetometer/hmc5843_i2c.c       |  4 +++-
> >  drivers/iio/magnetometer/hmc5843_spi.c       |  4 +++-
> >  drivers/iio/potentiometer/max5487.c          |  7 ++++++-
> >  drivers/iio/pressure/ms5611.h                |  2 +-
> >  drivers/iio/pressure/ms5611_core.c           |  4 +---
> >  drivers/iio/pressure/ms5611_i2c.c            |  4 +++-
> >  drivers/iio/pressure/ms5611_spi.c            |  4 +++-
> >  44 files changed, 110 insertions(+), 81 deletions(-)
> >
> >
> > base-commit: 9e1ff307c779ce1f0f810c7ecce3d95bbae40896
> > --
> > 2.30.2
> >