From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Note this series includes many drivers that are quite old and I'm not sure have active maintainers. Hence if anyone has time to look at some of these beyond their own drivers and sanity check them it would be much appreciated! Two motivations behind this set. 1 - General code reduction and improvement in readability in these drivers. 2 - Reduce change I'll have to ask people to change how they do this in future patches. Mostly this is just a case of letting the compiler work out it can remove the PM related functions rather than using #ifdefs in the code to do so. The __maybe_unused markings make it clear we are intentionally building functions that the compiler can see are unused and remove in some build configurations. The new pm_ptr() macro is rather convenient to got futher than many of the drivers were and when CONFIG_PM is not define ensure that the struct dev_pm_ops can also be removed. Note there is a subtlty in that we only remove that whe CONFIG_PM is not defined whereas a few of these drivers were using CONFIG_PM_SLEEP which is a tighter condition (will remove the structure in more configurations). I think that's a small price to pay for the convenience this macro brings. I did this set as one patch per driver, as personally I prefer that option for all but the most trivial patches because it makes backports that cross with this series simpler and also avoid the complex tag giving we get for sets touching code from many authors. All comments welcome. Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx> Cc: Anson Huang <anson.huang@xxxxxxx> Cc: Brian Masney <masneyb@xxxxxxxxxxxxx> Cc: Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx> Cc: Hans de Goede <hdegoede@xxxxxxxxxx> Cc: Heiko Stuebner <heiko.stuebner@xxxxxxxxxxxxxxxxxxxxx> Cc: Icenowy Zheng <icenowy@xxxxxxx> Cc: Jonathan Albrieux <jonathan.albrieux@xxxxxxxxx> Cc: Krzysztof Kozlowski <krzk@xxxxxxxxxx> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx> Cc: Luca Weiss <luca@xxxxxxxxx> Cc: Ludovic Desroches <ludovic.desroches@xxxxxxxxxxxxx> Cc: Manivannan Sadhasivam <mani@xxxxxxxxxx> Cc: Martijn Braam <martijn@xxxxxxxxx> Cc: Maslov Dmitry <maslovdmitry@xxxxxxxx> Cc: Matt Ranostay <matt.ranostay@xxxxxxxxxxxx Cc: Olivier Moysan <olivier.moysan@xxxxxxxxxxx> Cc: Stefan-Gabriel Mirea <stefan-gabriel.mirea@xxxxxxx> Cc: Vaishnav M A <vaishnav@xxxxxxxxxxxxxxx> Jonathan Cameron (49): iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:accel:dmard10: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:accel:kxsd9: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:adc:ad7606: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:light:us5182: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:magn:hmc5843: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:pressure:bmp280: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused iio:gyro:mpu3050: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused drivers/iio/accel/da280.c | 6 ++---- drivers/iio/accel/da311.c | 8 +++----- drivers/iio/accel/dmard06.c | 12 ++++-------- drivers/iio/accel/dmard10.c | 9 ++++----- drivers/iio/accel/kxsd9-i2c.c | 2 +- drivers/iio/accel/kxsd9-spi.c | 2 +- drivers/iio/accel/kxsd9.c | 8 +++----- drivers/iio/accel/mc3230.c | 8 +++----- drivers/iio/accel/mma7660.c | 12 +++--------- drivers/iio/accel/mma9551.c | 16 ++++++---------- drivers/iio/accel/mma9553.c | 16 ++++++---------- drivers/iio/accel/stk8ba50.c | 12 +++--------- drivers/iio/adc/ab8500-gpadc.c | 10 ++++------ drivers/iio/adc/ad7606.c | 8 ++------ drivers/iio/adc/ad7606.h | 5 ----- drivers/iio/adc/ad7606_par.c | 2 +- drivers/iio/adc/ad7606_spi.c | 2 +- drivers/iio/adc/at91_adc.c | 8 +++----- drivers/iio/adc/exynos_adc.c | 8 +++----- drivers/iio/adc/palmas_gpadc.c | 14 ++++++-------- drivers/iio/adc/rcar-gyroadc.c | 10 ++++------ drivers/iio/adc/rockchip_saradc.c | 8 +++----- drivers/iio/adc/stm32-adc-core.c | 12 +++++------- drivers/iio/adc/stm32-adc.c | 16 ++++++---------- drivers/iio/adc/twl6030-gpadc.c | 8 +++----- drivers/iio/adc/vf610_adc.c | 8 +++----- drivers/iio/chemical/atlas-sensor.c | 10 ++++------ drivers/iio/common/ssp_sensors/ssp_dev.c | 12 ++++-------- drivers/iio/dac/vf610_dac.c | 8 +++----- drivers/iio/gyro/mpu3050-core.c | 8 +++----- drivers/iio/gyro/mpu3050-i2c.c | 2 +- drivers/iio/light/apds9300.c | 11 +++-------- drivers/iio/light/bh1780.c | 10 ++++------ drivers/iio/light/cm3232.c | 13 ++++--------- drivers/iio/light/isl29018.c | 11 +++-------- drivers/iio/light/isl29125.c | 8 +++----- drivers/iio/light/jsa1212.c | 12 +++--------- drivers/iio/light/ltr501.c | 8 +++----- drivers/iio/light/stk3310.c | 12 +++--------- drivers/iio/light/tcs3414.c | 8 +++----- drivers/iio/light/tcs3472.c | 8 +++----- drivers/iio/light/tsl2563.c | 11 +++-------- drivers/iio/light/tsl4531.c | 11 +++-------- drivers/iio/light/us5182d.c | 10 ++++------ drivers/iio/magnetometer/ak8975.c | 10 ++++------ drivers/iio/magnetometer/hmc5843.h | 5 ----- drivers/iio/magnetometer/hmc5843_i2c.c | 2 +- drivers/iio/magnetometer/hmc5843_spi.c | 2 +- drivers/iio/magnetometer/mag3110.c | 11 +++-------- drivers/iio/magnetometer/mmc35240.c | 12 ++++-------- drivers/iio/pressure/bmp280-core.c | 6 ++---- drivers/iio/pressure/bmp280-i2c.c | 2 +- drivers/iio/pressure/bmp280-spi.c | 2 +- drivers/iio/pressure/mpl3115.c | 11 +++-------- drivers/iio/proximity/as3935.c | 12 +++--------- .../iio/proximity/pulsedlight-lidar-lite-v2.c | 10 ++++------ drivers/iio/proximity/rfd77402.c | 8 +++----- drivers/iio/proximity/sx9500.c | 12 ++++-------- drivers/iio/temperature/tmp006.c | 8 +++----- drivers/iio/temperature/tmp007.c | 8 +++----- 60 files changed, 180 insertions(+), 344 deletions(-) -- 2.34.0