iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc.
Subsystems (11)
Jonathan Cameron
maintainerv3 cover iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc.
From: Jonathan Cameron <[email protected]>
Note that I have cc'd no one for a number of drivers touched in this set because we don't have a known active maintainer, so if anyone has time to sanity check those it would be much appreciated.
Now that Paul Cercueil's rework of the pm_ptr() and related macro magic to ensure we the compiler can remove unused struct dev_pm_ops and related functions when either CONFIG_PM_SLEEP is not set or both that and CONFIG_PM are not set is upstream [1], lets revisit this series of cleanup of CONFIG_PM* guards in IIO.
Changes since v2:
1) Move to new macros where relevant.
2) Add static as the macros no longer include it DEFINE_SIMPLE_DEV_PM_OPS etc.
3) Drop complex cases (I've noted those in reply to v2 so won't go into specifics here. I'll revisit all these but after this massive set is in place. Some of these are due to interaction with the ongoing namespace work in IIO.
4) Use the new DEFINE_RUNTIME_DEV_PM_OPS for cases where the force runtime functions were used for sleep ops.
5) Add a few cases that I'd missed the first time around.
Note that there are some drivers that provide runtime callbacks but not sleep ones. The chances are high that it would be sensible to use the force runtime pm calls for those, but I considered that a separate change which should potentially be part of a follow up patch set.
Cc: Alexandre Belloni <[email protected]>
Cc: Anson Huang <[email protected]>
Cc: Brian Masney <[email protected]>
Cc: Crt Mori <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: Icenowy Zheng <[email protected]>
Cc: Jonathan Albrieux <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Luca Weiss <[email protected]>
Cc: Ludovic Desroches <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Martijn Braam <[email protected]>
Cc: Maslov Dmitry <[email protected]>
Cc: Matt Ranostay <[email protected]
Cc: Mikko Koivunen <[email protected]>
Cc: Olivier Moysan <[email protected]>
Cc: Stefan-Gabriel Mirea <[email protected]>
Cc: Vaishnav M A <[email protected]>
Jonathan Cameron (50):
iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:accel:dmard10: Switch from CONFIG_PM guards to pm_sleep_ptr() etc iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr()
iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc
iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc
iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr()
iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr()
iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr() etc
iio:accel:bma180: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
etc
iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr()
etc
iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() etc iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr()
etc
iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc iio:light:rpr0521: Switch from CONFIG_PM guards to pm_ptr() etc iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm
__maybe_unused
drivers/iio/accel/bma180.c | 9 ++------- drivers/iio/accel/da280.c | 6 ++---- drivers/iio/accel/da311.c | 6 ++---- drivers/iio/accel/dmard06.c | 10 +++------- drivers/iio/accel/dmard10.c | 7 +++---- drivers/iio/accel/mc3230.c | 6 ++---- drivers/iio/accel/mma7660.c | 11 +++-------- drivers/iio/accel/mma9551.c | 11 +++-------- drivers/iio/accel/mma9553.c | 11 +++-------- drivers/iio/accel/stk8312.c | 11 +++-------- drivers/iio/accel/stk8ba50.c | 11 +++-------- drivers/iio/adc/ab8500-gpadc.c | 13 +++---------- drivers/iio/adc/at91_adc.c | 7 +++---- drivers/iio/adc/exynos_adc.c | 9 +++------ drivers/iio/adc/palmas_gpadc.c | 10 +++------- drivers/iio/adc/rcar-gyroadc.c | 6 ++---- drivers/iio/adc/rockchip_saradc.c | 9 ++++----- drivers/iio/adc/stm32-adc-core.c | 17 ++++++----------- drivers/iio/adc/stm32-adc.c | 12 ++++-------- drivers/iio/adc/stm32-dfsdm-adc.c | 11 ++++++----- drivers/iio/adc/stm32-dfsdm-core.c | 19 +++++++++---------- drivers/iio/adc/twl6030-gpadc.c | 8 +++----- drivers/iio/adc/vf610_adc.c | 7 +++---- drivers/iio/chemical/atlas-sensor.c | 7 ++----- drivers/iio/common/ssp_sensors/ssp_dev.c | 8 ++------ drivers/iio/dac/m62332.c | 11 ++--------- drivers/iio/dac/stm32-dac-core.c | 16 ++++++++-------- drivers/iio/dac/stm32-dac.c | 9 ++++----- drivers/iio/dac/vf610_dac.c | 7 +++---- drivers/iio/imu/kmx61.c | 10 +++------- drivers/iio/light/apds9300.c | 10 +++------- drivers/iio/light/bh1780.c | 12 +++--------- drivers/iio/light/cm3232.c | 9 ++------- drivers/iio/light/isl29018.c | 10 +++------- drivers/iio/light/isl29125.c | 7 +++---- drivers/iio/light/jsa1212.c | 11 +++-------- drivers/iio/light/ltr501.c | 6 ++---- drivers/iio/light/rpr0521.c | 7 ++----- drivers/iio/light/stk3310.c | 11 +++-------- drivers/iio/light/tcs3414.c | 7 +++---- drivers/iio/light/tcs3472.c | 7 +++---- drivers/iio/light/tsl2563.c | 10 +++------- drivers/iio/light/tsl4531.c | 10 +++------- drivers/iio/magnetometer/ak8975.c | 12 +++--------- drivers/iio/magnetometer/mag3110.c | 10 +++------- drivers/iio/magnetometer/mmc35240.c | 9 +++------ drivers/iio/pressure/mpl3115.c | 10 +++------- drivers/iio/proximity/as3935.c | 10 ++-------- .../iio/proximity/pulsedlight-lidar-lite-v2.c | 7 ++----- drivers/iio/proximity/rfd77402.c | 7 +++---- drivers/iio/proximity/sx9500.c | 8 ++------ drivers/iio/temperature/mlx90614.c | 12 ++++-------- drivers/iio/temperature/tmp006.c | 6 ++---- drivers/iio/temperature/tmp007.c | 6 ++---- drivers/iio/trigger/stm32-timer-trigger.c | 12 ++++++------ 55 files changed, 173 insertions(+), 348 deletions(-)
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 1/50 iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
From: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/da311.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/accel/da311.c +2 -4
@@ -256,7 +256,6 @@ static int da311_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int da311_suspend (struct device *dev) {return da311_enable (to_i2c_client (dev), false);
@@ -266,9 +265,8 @@ static int da311_resume(struct device *dev) {return da311_enable (to_i2c_client (dev), true); } -#endif -static SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume);static const struct i2c_device_id da311_i2c_id[] = { {"da311" ,0 },
@@ -279,7 +277,7 @@ MODULE_DEVICE_TABLE(i2c, da311_i2c_id);static struct i2c_driver da311_driver = { .driver = { .name ="da311" , - .pm = &da311_pm_ops, + .pm =pm_sleep_ptr (&da311_pm_ops), }, .probe = da311_probe, .id_table = da311_i2c_id,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 2/50 iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/da280.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/accel/da280.c +2 -4
@@ -153,7 +153,6 @@ static int da280_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int da280_suspend (struct device *dev) {return da280_enable (to_i2c_client (dev), false);
@@ -163,9 +162,8 @@ static int da280_resume(struct device *dev) {return da280_enable (to_i2c_client (dev), true); } -#endif -static SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume);static const struct acpi_device_id da280_acpi_match[] = { {"MIRAACC" , da280},
@@ -184,7 +182,7 @@ static struct i2c_driver da280_driver = { .driver = { .name = "da280", .acpi_match_table = ACPI_PTR(da280_acpi_match), - .pm = &da280_pm_ops, + .pm = pm_sleep_ptr(&da280_pm_ops), }, .probe = da280_probe, .id_table = da280_i2c_id,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 3/50 iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/dmard06.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/accel/dmard06.c +3 -7
@@ -170,7 +170,6 @@ static int dmard06_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int dmard06_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -199,11 +198,8 @@ static int dmard06_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend, dmard06_resume); -#define DMARD06_PM_OPS (&dmard06_pm_ops) -#else -#define DMARD06_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend, + dmard06_resume);static const struct i2c_device_id dmard06_id[] = { {"dmard05" ,0 },
@@ -227,7 +223,7 @@ static struct i2c_driver dmard06_driver = { .driver = { .name = DMARD06_DRV_NAME, .of_match_table = dmard06_of_match, - .pm = DMARD06_PM_OPS, + .pm = pm_sleep_ptr(&dmard06_pm_ops), }, };module_i2c_driver (dmard06_driver);
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 4/50 iio:accel:dmard10: Switch from CONFIG_PM guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/dmard10.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/accel/dmard10.c +3 -4
@@ -218,7 +218,6 @@ static int dmard10_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int dmard10_suspend (struct device *dev) {return dmard10_shutdown (to_i2c_client (dev));
@@ -228,9 +227,9 @@ static int dmard10_resume(struct device *dev) {return dmard10_reset (to_i2c_client (dev)); } -#endif -static SIMPLE_DEV_PM_OPS(dmard10_pm_ops, dmard10_suspend, dmard10_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(dmard10_pm_ops, dmard10_suspend, + dmard10_resume);static const struct i2c_device_id dmard10_i2c_id[] = { {"dmard10" ,0 },
@@ -241,7 +240,7 @@ MODULE_DEVICE_TABLE(i2c, dmard10_i2c_id);static struct i2c_driver dmard10_driver = { .driver = { .name ="dmard10" , - .pm = &dmard10_pm_ops, + .pm =pm_sleep_ptr (&dmard10_pm_ops), }, .probe = dmard10_probe, .id_table = dmard10_i2c_id,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 5/50 iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/mc3230.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/accel/mc3230.c +2 -4
@@ -160,7 +160,6 @@ static int mc3230_remove(struct i2c_client *client)return mc3230_set_opcon (iio_priv (indio_dev),MC3230_MODE_OPCON_STANDBY ); } -#ifdef CONFIG_PM_SLEEP static int mc3230_suspend (struct device *dev) {struct mc3230_data *data;
@@ -178,9 +177,8 @@ static int mc3230_resume(struct device *dev)return mc3230_set_opcon (data,MC3230_MODE_OPCON_WAKE ); } -#endif -static SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume);static const struct i2c_device_id mc3230_i2c_id[] = { {"mc3230" ,0 },
@@ -191,7 +189,7 @@ MODULE_DEVICE_TABLE(i2c, mc3230_i2c_id);static struct i2c_driver mc3230_driver = { .driver = { .name ="mc3230" , - .pm = &mc3230_pm_ops, + .pm =pm_sleep_ptr (&mc3230_pm_ops), }, .probe = mc3230_probe, .remove = mc3230_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 6/50 iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/mma7660.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/iio/accel/mma7660.c +3 -8
@@ -222,7 +222,6 @@ static int mma7660_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int mma7660_suspend (struct device *dev) {struct mma7660_data *data;
@@ -241,12 +240,8 @@ static int mma7660_resume(struct device *dev)return mma7660_set_mode (data,MMA7660_MODE_ACTIVE ); } -static SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, mma7660_resume); - -#define MMA7660_PM_OPS (&mma7660_pm_ops) -#else -#define MMA7660_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, + mma7660_resume);static const struct i2c_device_id mma7660_i2c_id[] = { {"mma7660" ,0 },
@@ -270,7 +265,7 @@ MODULE_DEVICE_TABLE(acpi, mma7660_acpi_id);static struct i2c_driver mma7660_driver = { .driver = { .name ="mma7660" , - .pm =MMA7660_PM_OPS , + .pm =pm_sleep_ptr (&mma7660_pm_ops), .of_match_table = mma7660_of_match, .acpi_match_table =ACPI_PTR (mma7660_acpi_id), },
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 7/50 iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/mma9551.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/iio/accel/mma9551.c +3 -8
@@ -523,7 +523,6 @@ static int mma9551_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM static int mma9551_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -555,9 +554,7 @@ static int mma9551_runtime_resume(struct device *dev)return 0 ; } -#endif -#ifdef CONFIG_PM_SLEEP static int mma9551_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -583,12 +580,10 @@ static int mma9551_resume(struct device *dev)return ret; } -#endif static const struct dev_pm_ops mma9551_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mma9551_suspend, mma9551_resume) -SET_RUNTIME_PM_OPS (mma9551_runtime_suspend, - mma9551_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(mma9551_suspend, mma9551_resume) +RUNTIME_PM_OPS (mma9551_runtime_suspend, mma9551_runtime_resume,NULL ) };static const struct acpi_device_id mma9551_acpi_match[] = {
@@ -609,7 +604,7 @@ static struct i2c_driver mma9551_driver = { .driver = { .name = MMA9551_DRV_NAME, .acpi_match_table = ACPI_PTR(mma9551_acpi_match), - .pm = &mma9551_pm_ops, + .pm =pm_ptr (&mma9551_pm_ops), }, .probe = mma9551_probe, .remove = mma9551_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 8/50 iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/mma9553.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/iio/accel/mma9553.c +3 -8
@@ -1162,7 +1162,6 @@ static int mma9553_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM static int mma9553_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -1194,9 +1193,7 @@ static int mma9553_runtime_resume(struct device *dev)return 0 ; } -#endif -#ifdef CONFIG_PM_SLEEP static int mma9553_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -1222,12 +1219,10 @@ static int mma9553_resume(struct device *dev)return ret; } -#endif static const struct dev_pm_ops mma9553_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mma9553_suspend, mma9553_resume) -SET_RUNTIME_PM_OPS (mma9553_runtime_suspend, - mma9553_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(mma9553_suspend, mma9553_resume) +RUNTIME_PM_OPS (mma9553_runtime_suspend, mma9553_runtime_resume,NULL ) };static const struct acpi_device_id mma9553_acpi_match[] = {
@@ -1248,7 +1243,7 @@ static struct i2c_driver mma9553_driver = { .driver = { .name = MMA9553_DRV_NAME, .acpi_match_table = ACPI_PTR(mma9553_acpi_match), - .pm = &mma9553_pm_ops, + .pm =pm_ptr (&mma9553_pm_ops), }, .probe = mma9553_probe, .remove = mma9553_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 9/50 iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/stk8ba50.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/iio/accel/stk8ba50.c +3 -8
@@ -504,7 +504,6 @@ static int stk8ba50_remove(struct i2c_client *client)return stk8ba50_set_power (data,STK8BA50_MODE_SUSPEND ); } -#ifdef CONFIG_PM_SLEEP static int stk8ba50_suspend (struct device *dev) {struct stk8ba50_data *data;
@@ -523,12 +522,8 @@ static int stk8ba50_resume(struct device *dev)return stk8ba50_set_power (data,STK8BA50_MODE_NORMAL ); } -static SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend, stk8ba50_resume); - -#define STK8BA50_PM_OPS (&stk8ba50_pm_ops) -#else -#define STK8BA50_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend, + stk8ba50_resume);static const struct i2c_device_id stk8ba50_i2c_id[] = { {"stk8ba50" ,0 },
@@ -546,7 +541,7 @@ MODULE_DEVICE_TABLE(acpi, stk8ba50_acpi_id);static struct i2c_driver stk8ba50_driver = { .driver = { .name ="stk8ba50" , - .pm =STK8BA50_PM_OPS , + .pm =pm_sleep_ptr (&stk8ba50_pm_ops), .acpi_match_table =ACPI_PTR (stk8ba50_acpi_id), }, .probe = stk8ba50_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 10/50 iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/adc/at91_adc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/adc/at91_adc.c +3 -4
@@ -1234,7 +1234,6 @@ static int at91_adc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int at91_adc_suspend (struct device *dev) {struct iio_dev *idev =dev_get_drvdata (dev);
@@ -1256,9 +1255,9 @@ static int at91_adc_resume(struct device *dev)return 0 ; } -#endif -static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, + at91_adc_resume);static const struct at91_adc_trigger at91sam9260_triggers[] = { { .name ="timer-counter-0" , .value =0x1 },
@@ -1386,7 +1385,7 @@ static struct platform_driver at91_adc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = at91_adc_dt_ids, - .pm = &at91_adc_pm_ops, + .pm = pm_sleep_ptr(&at91_adc_pm_ops), }, };
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 11/50 iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/adc/exynos_adc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/iio/adc/exynos_adc.c +3 -6
@@ -968,7 +968,6 @@ static int exynos_adc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int exynos_adc_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -1001,11 +1000,9 @@ static int exynos_adc_resume(struct device *dev)return 0 ; } -#endif -static SIMPLE_DEV_PM_OPS(exynos_adc_pm_ops, - exynos_adc_suspend, - exynos_adc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(exynos_adc_pm_ops, exynos_adc_suspend, + exynos_adc_resume);static struct platform_driver exynos_adc_driver = { .probe = exynos_adc_probe,
@@ -1013,7 +1010,7 @@ static struct platform_driver exynos_adc_driver = { .driver = { .name = "exynos-adc", .of_match_table = exynos_adc_match, - .pm = &exynos_adc_pm_ops, + .pm = pm_sleep_ptr(&exynos_adc_pm_ops), }, };
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 12/50 iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
In this case SIMPLE_DEV_PM_OPS() could have been used previously. Now we have DEFINE_SIMPLE_DEV_PM_OPS() which also deals with letting the compiler remove the structure and functions so use that instead.
--- drivers/iio/adc/palmas_gpadc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/adc/palmas_gpadc.c +3 -7
@@ -653,7 +653,6 @@ static int palmas_gpadc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int palmas_adc_wakeup_configure (struct palmas_gpadc *adc) {int adc_period, conv;
@@ -822,12 +821,9 @@ static int palmas_gpadc_resume(struct device *dev)return 0 ; }; -#endif -static const struct dev_pm_ops palmas_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (palmas_gpadc_suspend, - palmas_gpadc_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(palmas_pm_ops, palmas_gpadc_suspend, + palmas_gpadc_resume);static const struct of_device_id of_palmas_gpadc_match_tbl[] = { { .compatible ="ti,palmas-gpadc" , },
@@ -840,7 +836,7 @@ static struct platform_driver palmas_gpadc_driver = { .remove = palmas_gpadc_remove, .driver = { .name = MOD_NAME, - .pm = &palmas_pm_ops, + .pm = pm_sleep_ptr(&palmas_pm_ops), .of_match_table = of_palmas_gpadc_match_tbl, }, };
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 13/50 iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/adc/rockchip_saradc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/iio/adc/rockchip_saradc.c +4 -5
@@ -481,7 +481,6 @@ static int rockchip_saradc_probe(struct platform_device *pdev)return devm_iio_device_register (&pdev->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int rockchip_saradc_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -514,17 +513,17 @@ static int rockchip_saradc_resume(struct device *dev)return ret; } -#endif -static SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops, - rockchip_saradc_suspend, rockchip_saradc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops, + rockchip_saradc_suspend, + rockchip_saradc_resume);static struct platform_driver rockchip_saradc_driver = { .probe = rockchip_saradc_probe, .driver = { .name ="rockchip-saradc" , .of_match_table = rockchip_saradc_match, - .pm = &rockchip_saradc_pm_ops, + .pm =pm_sleep_ptr (&rockchip_saradc_pm_ops), }, };
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 14/50 iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/adc/twl6030-gpadc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iio/adc/twl6030-gpadc.c +3 -5
@@ -944,7 +944,6 @@ static int twl6030_gpadc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int twl6030_gpadc_suspend (struct device *pdev) {int ret;
@@ -968,17 +967,16 @@ static int twl6030_gpadc_resume(struct device *pdev)return 0 ; }; -#endif -static SIMPLE_DEV_PM_OPS(twl6030_gpadc_pm_ops, twl6030_gpadc_suspend, - twl6030_gpadc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(twl6030_gpadc_pm_ops, twl6030_gpadc_suspend, + twl6030_gpadc_resume);static struct platform_driver twl6030_gpadc_driver = { .probe = twl6030_gpadc_probe, .remove = twl6030_gpadc_remove, .driver = { .name =DRIVER_NAME , - .pm = &twl6030_gpadc_pm_ops, + .pm =pm_sleep_ptr (&twl6030_gpadc_pm_ops), .of_match_table = of_twl6030_match_tbl, }, };
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 15/50 iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/adc/vf610_adc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/adc/vf610_adc.c +3 -4
@@ -912,7 +912,6 @@ static int vf610_adc_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int vf610_adc_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -952,9 +951,9 @@ static int vf610_adc_resume(struct device *dev)regulator_disable (info->vref);return ret; } -#endif -static SIMPLE_DEV_PM_OPS(vf610_adc_pm_ops, vf610_adc_suspend, vf610_adc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(vf610_adc_pm_ops, vf610_adc_suspend, + vf610_adc_resume);static struct platform_driver vf610_adc_driver = { .probe = vf610_adc_probe,
@@ -962,7 +961,7 @@ static struct platform_driver vf610_adc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = vf610_adc_match, - .pm = &vf610_adc_pm_ops, + .pm = pm_sleep_ptr(&vf610_adc_pm_ops), }, };
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 16/50 iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of ifdef based config guards. Also switch to SIMPLE_DEV_PM_OPS rather than open coding the structure.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/common/ssp_sensors/ssp_dev.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/iio/common/ssp_sensors/ssp_dev.c +2 -6
@@ -612,7 +612,6 @@ static int ssp_remove(struct spi_device *spi)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int ssp_suspend (struct device *dev) {int ret;
@@ -661,17 +660,14 @@ static int ssp_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM_SLEEP */ -static const struct dev_pm_ops ssp_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (ssp_suspend, ssp_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(ssp_pm_ops, ssp_suspend, ssp_resume);static struct spi_driver ssp_driver = { .probe = ssp_probe, .remove = ssp_remove, .driver = { - .pm = &ssp_pm_ops, + .pm =pm_sleep_ptr (&ssp_pm_ops), .of_match_table =of_match_ptr (ssp_of_match), .name ="sensorhub" },
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 17/50 iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/dac/vf610_dac.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/dac/vf610_dac.c +3 -4
@@ -242,7 +242,6 @@ static int vf610_dac_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int vf610_dac_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -268,9 +267,9 @@ static int vf610_dac_resume(struct device *dev)return 0 ; } -#endif -static SIMPLE_DEV_PM_OPS(vf610_dac_pm_ops, vf610_dac_suspend, vf610_dac_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(vf610_dac_pm_ops, vf610_dac_suspend, + vf610_dac_resume);static struct platform_driver vf610_dac_driver = { .probe = vf610_dac_probe,
@@ -278,7 +277,7 @@ static struct platform_driver vf610_dac_driver = { .driver = { .name = "vf610-dac", .of_match_table = vf610_dac_match, - .pm = &vf610_dac_pm_ops, + .pm = pm_sleep_ptr(&vf610_dac_pm_ops), }, };module_platform_driver (vf610_dac_driver);
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 18/50 iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/apds9300.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/light/apds9300.c +3 -7
@@ -466,7 +466,6 @@ static int apds9300_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int apds9300_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -493,11 +492,8 @@ static int apds9300_resume(struct device *dev)return ret; } -static SIMPLE_DEV_PM_OPS(apds9300_pm_ops, apds9300_suspend, apds9300_resume); -#define APDS9300_PM_OPS (&apds9300_pm_ops) -#else -#define APDS9300_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(apds9300_pm_ops, apds9300_suspend, + apds9300_resume);static const struct i2c_device_id apds9300_id[] = { {APDS9300_DRV_NAME ,0 },
@@ -509,7 +505,7 @@ MODULE_DEVICE_TABLE(i2c, apds9300_id);static struct i2c_driver apds9300_driver = { .driver = { .name =APDS9300_DRV_NAME , - .pm =APDS9300_PM_OPS , + .pm =pm_sleep_ptr (&apds9300_pm_ops), }, .probe = apds9300_probe, .remove = apds9300_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 19/50 iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards. Also switch to SIMPLE_DEV_PM_OPS rather than opencoding the same.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/cm3232.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/light/cm3232.c +2 -7
@@ -374,7 +374,6 @@ static const struct i2c_device_id cm3232_id[] = { {} }; -#ifdef CONFIG_PM_SLEEP static int cm3232_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -403,9 +402,7 @@ static int cm3232_resume(struct device *dev)return ret; } -static const struct dev_pm_ops cm3232_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (cm3232_suspend, cm3232_resume)}; -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(cm3232_pm_ops, cm3232_suspend, cm3232_resume);MODULE_DEVICE_TABLE (i2c, cm3232_id);
@@ -419,9 +416,7 @@ static struct i2c_driver cm3232_driver = { .driver = { .name = "cm3232", .of_match_table = cm3232_of_match, -#ifdef CONFIG_PM_SLEEP - .pm = &cm3232_pm_ops, -#endif + .pm = pm_sleep_ptr(&cm3232_pm_ops), }, .id_table = cm3232_id, .probe = cm3232_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 20/50 iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/isl29018.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/light/isl29018.c +3 -7
@@ -784,7 +784,6 @@ static int isl29018_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int isl29018_suspend (struct device *dev) {struct isl29018_chip *chip =iio_priv (dev_get_drvdata (dev));
@@ -830,11 +829,8 @@ static int isl29018_resume(struct device *dev)return err; } -static SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, isl29018_resume); -#define ISL29018_PM_OPS (&isl29018_pm_ops) -#else -#define ISL29018_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, + isl29018_resume);#ifdef CONFIG_ACPI static const struct acpi_device_id isl29018_acpi_match[] = {
@@ -866,7 +862,7 @@ static struct i2c_driver isl29018_driver = { .driver = { .name = "isl29018", .acpi_match_table = ACPI_PTR(isl29018_acpi_match), - .pm = ISL29018_PM_OPS, + .pm = pm_sleep_ptr(&isl29018_pm_ops), .of_match_table = isl29018_of_match, }, .probe = isl29018_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 21/50 iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/isl29125.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/light/isl29125.c +3 -4
@@ -311,7 +311,6 @@ static int isl29125_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int isl29125_suspend (struct device *dev) { struct isl29125_data *data = iio_priv(i2c_get_clientdata(
@@ -326,9 +325,9 @@ static int isl29125_resume(struct device *dev)return i2c_smbus_write_byte_data (data->client,ISL29125_CONF1 , data->conf1); } -#endif -static SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend, isl29125_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend, + isl29125_resume);static const struct i2c_device_id isl29125_id[] = { {"isl29125" ,0 },
@@ -339,7 +338,7 @@ MODULE_DEVICE_TABLE(i2c, isl29125_id);static struct i2c_driver isl29125_driver = { .driver = { .name =ISL29125_DRV_NAME , - .pm = &isl29125_pm_ops, + .pm =pm_sleep_ptr (&isl29125_pm_ops), }, .probe = isl29125_probe, .remove = isl29125_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 23/50 iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/ltr501.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/ltr501.c +2 -4
@@ -1611,7 +1611,6 @@ static int ltr501_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int ltr501_suspend (struct device *dev) { struct ltr501_data *data = iio_priv(i2c_get_clientdata(
@@ -1627,9 +1626,8 @@ static int ltr501_resume(struct device *dev)return ltr501_write_contr (data, data->als_contr, data->ps_contr); } -#endif -static SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume);static const struct acpi_device_id ltr_acpi_match[] = { {"LTER0501" , ltr501 },
@@ -1661,7 +1659,7 @@ static struct i2c_driver ltr501_driver = { .driver = { .name = LTR501_DRV_NAME, .of_match_table = ltr501_of_match, - .pm = <r501_pm_ops, + .pm = pm_sleep_ptr(<r501_pm_ops), .acpi_match_table = ACPI_PTR(ltr_acpi_match), }, .probe = ltr501_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 22/50 iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/jsa1212.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/iio/light/jsa1212.c +3 -8
@@ -383,7 +383,6 @@ static int jsa1212_remove(struct i2c_client *client)return jsa1212_power_off (data); } -#ifdef CONFIG_PM_SLEEP static int jsa1212_suspend (struct device *dev) {struct jsa1212_data *data;
@@ -421,12 +420,8 @@ static int jsa1212_resume(struct device *dev)return ret; } -static SIMPLE_DEV_PM_OPS(jsa1212_pm_ops, jsa1212_suspend, jsa1212_resume); - -#define JSA1212_PM_OPS (&jsa1212_pm_ops) -#else -#define JSA1212_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(jsa1212_pm_ops, jsa1212_suspend, + jsa1212_resume);static const struct acpi_device_id jsa1212_acpi_match[] = { {"JSA1212" ,0 },
@@ -443,7 +438,7 @@ MODULE_DEVICE_TABLE(i2c, jsa1212_id);static struct i2c_driver jsa1212_driver = { .driver = { .name =JSA1212_DRIVER_NAME , - .pm =JSA1212_PM_OPS , + .pm =pm_sleep_ptr (&jsa1212_pm_ops), .acpi_match_table =ACPI_PTR (jsa1212_acpi_match), }, .probe = jsa1212_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 24/50 iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/stk3310.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/iio/light/stk3310.c +3 -8
@@ -632,7 +632,6 @@ static int stk3310_remove(struct i2c_client *client)return stk3310_set_state (iio_priv (indio_dev),STK3310_STATE_STANDBY ); } -#ifdef CONFIG_PM_SLEEP static int stk3310_suspend (struct device *dev) {struct stk3310_data *data;
@@ -656,12 +655,8 @@ static int stk3310_resume(struct device *dev)return stk3310_set_state (data, state); } -static SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend, stk3310_resume); - -#define STK3310_PM_OPS (&stk3310_pm_ops) -#else -#define STK3310_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend, + stk3310_resume);static const struct i2c_device_id stk3310_i2c_id[] = { {"STK3310" ,0 },
@@ -692,7 +687,7 @@ static struct i2c_driver stk3310_driver = { .driver = { .name = "stk3310", .of_match_table = stk3310_of_match, - .pm = STK3310_PM_OPS, + .pm = pm_sleep_ptr(&stk3310_pm_ops), .acpi_match_table = ACPI_PTR(stk3310_acpi_id), }, .probe = stk3310_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 25/50 iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/tcs3414.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/light/tcs3414.c +3 -4
@@ -345,7 +345,6 @@ static int tcs3414_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int tcs3414_suspend (struct device *dev) { struct tcs3414_data *data = iio_priv(i2c_get_clientdata(
@@ -360,9 +359,9 @@ static int tcs3414_resume(struct device *dev)return i2c_smbus_write_byte_data (data->client,TCS3414_CONTROL , data->control); } -#endif -static SIMPLE_DEV_PM_OPS(tcs3414_pm_ops, tcs3414_suspend, tcs3414_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tcs3414_pm_ops, tcs3414_suspend, + tcs3414_resume);static const struct i2c_device_id tcs3414_id[] = { {"tcs3414" ,0 },
@@ -373,7 +372,7 @@ MODULE_DEVICE_TABLE(i2c, tcs3414_id);static struct i2c_driver tcs3414_driver = { .driver = { .name =TCS3414_DRV_NAME , - .pm = &tcs3414_pm_ops, + .pm =pm_sleep_ptr (&tcs3414_pm_ops), }, .probe = tcs3414_probe, .id_table = tcs3414_id,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 26/50 iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/tcs3472.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/light/tcs3472.c +3 -4
@@ -572,7 +572,6 @@ static int tcs3472_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int tcs3472_suspend (struct device *dev) { struct tcs3472_data *data = iio_priv(i2c_get_clientdata(
@@ -598,9 +597,9 @@ static int tcs3472_resume(struct device *dev)return ret; } -#endif -static SIMPLE_DEV_PM_OPS(tcs3472_pm_ops, tcs3472_suspend, tcs3472_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tcs3472_pm_ops, tcs3472_suspend, + tcs3472_resume);static const struct i2c_device_id tcs3472_id[] = { {"tcs3472" ,0 },
@@ -611,7 +610,7 @@ MODULE_DEVICE_TABLE(i2c, tcs3472_id);static struct i2c_driver tcs3472_driver = { .driver = { .name =TCS3472_DRV_NAME , - .pm = &tcs3472_pm_ops, + .pm =pm_sleep_ptr (&tcs3472_pm_ops), }, .probe = tcs3472_probe, .remove = tcs3472_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 27/50 iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/tsl2563.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/light/tsl2563.c +3 -7
@@ -814,7 +814,6 @@ static int tsl2563_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int tsl2563_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -857,11 +856,8 @@ static int tsl2563_resume(struct device *dev)return ret; } -static SIMPLE_DEV_PM_OPS(tsl2563_pm_ops, tsl2563_suspend, tsl2563_resume); -#define TSL2563_PM_OPS (&tsl2563_pm_ops) -#else -#define TSL2563_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(tsl2563_pm_ops, tsl2563_suspend, + tsl2563_resume);static const struct i2c_device_id tsl2563_id[] = { {"tsl2560" ,0 },
@@ -885,7 +881,7 @@ static struct i2c_driver tsl2563_i2c_driver = { .driver = { .name = "tsl2563", .of_match_table = tsl2563_of_match, - .pm = TSL2563_PM_OPS, + .pm = pm_sleep_ptr(&tsl2563_pm_ops), }, .probe = tsl2563_probe, .remove = tsl2563_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 28/50 iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/tsl4531.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/light/tsl4531.c +3 -7
@@ -215,7 +215,6 @@ static int tsl4531_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int tsl4531_suspend (struct device *dev) {return tsl4531_powerdown (to_i2c_client (dev));
@@ -227,11 +226,8 @@ static int tsl4531_resume(struct device *dev) TSL4531_MODE_NORMAL); } -static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume); -#define TSL4531_PM_OPS (&tsl4531_pm_ops) -#else -#define TSL4531_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, + tsl4531_resume);static const struct i2c_device_id tsl4531_id[] = { {"tsl4531" ,0 },
@@ -242,7 +238,7 @@ MODULE_DEVICE_TABLE(i2c, tsl4531_id);static struct i2c_driver tsl4531_driver = { .driver = { .name =TSL4531_DRV_NAME , - .pm =TSL4531_PM_OPS , + .pm =pm_sleep_ptr (&tsl4531_pm_ops), }, .probe = tsl4531_probe, .remove = tsl4531_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 29/50 iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Use the new DEFINE_RUNTIME_DEV_PM_OPS() macro to reduce boilerplate.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/magnetometer/ak8975.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/iio/magnetometer/ak8975.c +3 -9
@@ -1033,7 +1033,6 @@ static int ak8975_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM static int ak8975_runtime_suspend (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);
@@ -1074,14 +1073,9 @@ static int ak8975_runtime_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM */ -static const struct dev_pm_ops ak8975_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) -SET_RUNTIME_PM_OPS (ak8975_runtime_suspend, - ak8975_runtime_resume,NULL ) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(ak8975_dev_pm_ops, ak8975_runtime_suspend, + ak8975_runtime_resume, NULL);static const struct i2c_device_id ak8975_id[] = { {"ak8975" ,AK8975 },
@@ -1113,7 +1107,7 @@ MODULE_DEVICE_TABLE(of, ak8975_of_match);static struct i2c_driver ak8975_driver = { .driver = { .name ="ak8975" , - .pm = &ak8975_dev_pm_ops, + .pm =pm_ptr (&ak8975_dev_pm_ops), .of_match_table = ak8975_of_match, .acpi_match_table = ak_acpi_match, },
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 30/50 iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/magnetometer/mag3110.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/magnetometer/mag3110.c +3 -7
@@ -573,7 +573,6 @@ static int mag3110_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int mag3110_suspend (struct device *dev) { struct mag3110_data *data = iio_priv(i2c_get_clientdata(
@@ -623,11 +622,8 @@ static int mag3110_resume(struct device *dev) data->ctrl_reg1); } -static SIMPLE_DEV_PM_OPS(mag3110_pm_ops, mag3110_suspend, mag3110_resume); -#define MAG3110_PM_OPS (&mag3110_pm_ops) -#else -#define MAG3110_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(mag3110_pm_ops, mag3110_suspend, + mag3110_resume);static const struct i2c_device_id mag3110_id[] = { {"mag3110" ,0 },
@@ -645,7 +641,7 @@ static struct i2c_driver mag3110_driver = { .driver = { .name = "mag3110", .of_match_table = mag3110_of_match, - .pm = MAG3110_PM_OPS, + .pm = pm_sleep_ptr(&mag3110_pm_ops), }, .probe = mag3110_probe, .remove = mag3110_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 31/50 iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards. Also use SIMPLE_DEV_PM_OPS instead of open-coding the equivalent.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/magnetometer/mmc35240.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/iio/magnetometer/mmc35240.c +3 -6
@@ -521,7 +521,6 @@ static int mmc35240_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int mmc35240_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -548,11 +547,9 @@ static int mmc35240_resume(struct device *dev)return 0 ; } -#endif -static const struct dev_pm_ops mmc35240_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (mmc35240_suspend, mmc35240_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(mmc35240_pm_ops, mmc35240_suspend, + mmc35240_resume);static const struct of_device_id mmc35240_of_match[] = { { .compatible ="memsic,mmc35240" , },
@@ -576,7 +573,7 @@ static struct i2c_driver mmc35240_driver = { .driver = { .name = MMC35240_DRV_NAME, .of_match_table = mmc35240_of_match, - .pm = &mmc35240_pm_ops, + .pm = pm_sleep_ptr(&mmc35240_pm_ops), .acpi_match_table = ACPI_PTR(mmc35240_acpi_match), }, .probe = mmc35240_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 32/50 iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/pressure/mpl3115.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/pressure/mpl3115.c +3 -7
@@ -301,7 +301,6 @@ static int mpl3115_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int mpl3115_suspend (struct device *dev) { return mpl3115_standby(iio_priv(i2c_get_clientdata(
@@ -317,11 +316,8 @@ static int mpl3115_resume(struct device *dev) data->ctrl_reg1); } -static SIMPLE_DEV_PM_OPS(mpl3115_pm_ops, mpl3115_suspend, mpl3115_resume); -#define MPL3115_PM_OPS (&mpl3115_pm_ops) -#else -#define MPL3115_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(mpl3115_pm_ops, mpl3115_suspend, + mpl3115_resume);static const struct i2c_device_id mpl3115_id[] = { {"mpl3115" ,0 },
@@ -339,7 +335,7 @@ static struct i2c_driver mpl3115_driver = { .driver = { .name = "mpl3115", .of_match_table = mpl3115_of_match, - .pm = MPL3115_PM_OPS, + .pm = pm_sleep_ptr(&mpl3115_pm_ops), }, .probe = mpl3115_probe, .remove = mpl3115_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 33/50 iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/proximity/as3935.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/iio/proximity/as3935.c +2 -8
@@ -295,7 +295,6 @@ static void calibrate_as3935(struct as3935_state *st)as3935_write (st,AS3935_NFLWDTH , st->nflwdth_reg); } -#ifdef CONFIG_PM_SLEEP static int as3935_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -337,12 +336,7 @@ static int as3935_resume(struct device *dev)return ret; } -static SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume); -#define AS3935_PM_OPS (&as3935_pm_ops) - -#else -#define AS3935_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume);static void as3935_stop_work (void *data) {
@@ -472,7 +466,7 @@ static struct spi_driver as3935_driver = { .driver = { .name = "as3935", .of_match_table = as3935_of_match, - .pm = AS3935_PM_OPS, + .pm = pm_sleep_ptr(&as3935_pm_ops), }, .probe = as3935_probe, .id_table = as3935_id,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 34/50 iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/proximity/rfd77402.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/proximity/rfd77402.c +3 -4
@@ -295,7 +295,6 @@ static int rfd77402_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int rfd77402_suspend (struct device *dev) {return rfd77402_powerdown (to_i2c_client (dev));
@@ -305,9 +304,9 @@ static int rfd77402_resume(struct device *dev) {return rfd77402_init (to_i2c_client (dev)); } -#endif -static SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend, rfd77402_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend, + rfd77402_resume);static const struct i2c_device_id rfd77402_id[] = { {"rfd77402" ,0 },
@@ -318,7 +317,7 @@ MODULE_DEVICE_TABLE(i2c, rfd77402_id);static struct i2c_driver rfd77402_driver = { .driver = { .name =RFD77402_DRV_NAME , - .pm = &rfd77402_pm_ops, + .pm =pm_sleep_ptr (&rfd77402_pm_ops), }, .probe = rfd77402_probe, .id_table = rfd77402_id,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 35/50 iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/proximity/sx9500.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/iio/proximity/sx9500.c +2 -6
@@ -993,7 +993,6 @@ static int sx9500_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int sx9500_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -1030,11 +1029,8 @@ static int sx9500_resume(struct device *dev)return ret; } -#endif /* CONFIG_PM_SLEEP */ -static const struct dev_pm_ops sx9500_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (sx9500_suspend, sx9500_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(sx9500_pm_ops, sx9500_suspend, sx9500_resume);static const struct acpi_device_id sx9500_acpi_match[] = { {"SSX9500" ,0 },
@@ -1060,7 +1056,7 @@ static struct i2c_driver sx9500_driver = { .name = SX9500_DRIVER_NAME, .acpi_match_table = ACPI_PTR(sx9500_acpi_match), .of_match_table = of_match_ptr(sx9500_of_match), - .pm = &sx9500_pm_ops, + .pm = pm_sleep_ptr(&sx9500_pm_ops), }, .probe = sx9500_probe, .remove = sx9500_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 36/50 iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/temperature/tmp006.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/temperature/tmp006.c +2 -4
@@ -261,7 +261,6 @@ static int tmp006_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int tmp006_suspend (struct device *dev) {return tmp006_power (dev, false);
@@ -271,9 +270,8 @@ static int tmp006_resume(struct device *dev) {return tmp006_power (dev, true); } -#endif -static SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume);static const struct i2c_device_id tmp006_id[] = { {"tmp006" ,0 },
@@ -284,7 +282,7 @@ MODULE_DEVICE_TABLE(i2c, tmp006_id);static struct i2c_driver tmp006_driver = { .driver = { .name ="tmp006" , - .pm = &tmp006_pm_ops, + .pm =pm_sleep_ptr (&tmp006_pm_ops), }, .probe = tmp006_probe, .id_table = tmp006_id,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 37/50 iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/temperature/tmp007.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/temperature/tmp007.c +2 -4
@@ -537,7 +537,6 @@ static int tmp007_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int tmp007_suspend (struct device *dev) { struct tmp007_data *data = iio_priv(i2c_get_clientdata(
@@ -554,9 +553,8 @@ static int tmp007_resume(struct device *dev)return i2c_smbus_write_word_swapped (data->client,TMP007_CONFIG , data->config |TMP007_CONFIG_CONV_EN ); } -#endif -static SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume);static const struct of_device_id tmp007_of_match[] = { { .compatible ="ti,tmp007" , },
@@ -574,7 +572,7 @@ static struct i2c_driver tmp007_driver = { .driver = { .name = "tmp007", .of_match_table = tmp007_of_match, - .pm = &tmp007_pm_ops, + .pm = pm_sleep_ptr(&tmp007_pm_ops), }, .probe = tmp007_probe, .id_table = tmp007_id,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 38/50 iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/stk8312.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/iio/accel/stk8312.c +3 -8
@@ -611,7 +611,6 @@ static int stk8312_remove(struct i2c_client *client)return stk8312_set_mode (data,STK8312_MODE_STANDBY ); } -#ifdef CONFIG_PM_SLEEP static int stk8312_suspend (struct device *dev) {struct stk8312_data *data;
@@ -630,12 +629,8 @@ static int stk8312_resume(struct device *dev)return stk8312_set_mode (data, data->mode |STK8312_MODE_ACTIVE ); } -static SIMPLE_DEV_PM_OPS(stk8312_pm_ops, stk8312_suspend, stk8312_resume); - -#define STK8312_PM_OPS (&stk8312_pm_ops) -#else -#define STK8312_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(stk8312_pm_ops, stk8312_suspend, + stk8312_resume);static const struct i2c_device_id stk8312_i2c_id[] = {/* Deprecated in favour of lowercase form */
@@ -648,7 +643,7 @@ MODULE_DEVICE_TABLE(i2c, stk8312_i2c_id);static struct i2c_driver stk8312_driver = { .driver = { .name =STK8312_DRIVER_NAME , - .pm =STK8312_PM_OPS , + .pm =pm_sleep_ptr (&stk8312_pm_ops), }, .probe = stk8312_probe, .remove = stk8312_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 39/50 iio:accel:bma180: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/accel/bma180.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/accel/bma180.c +2 -7
@@ -1065,7 +1065,6 @@ static int bma180_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int bma180_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -1092,11 +1091,7 @@ static int bma180_resume(struct device *dev)return ret; } -static SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume); -#define BMA180_PM_OPS (&bma180_pm_ops) -#else -#define BMA180_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume);static const struct i2c_device_id bma180_ids[] = { {"bma023" ,BMA023 },
@@ -1137,7 +1132,7 @@ MODULE_DEVICE_TABLE(of, bma180_of_match);static struct i2c_driver bma180_driver = { .driver = { .name ="bma180" , - .pm =BMA180_PM_OPS , + .pm =pm_sleep_ptr (&bma180_pm_ops), .of_match_table = bma180_of_match, }, .probe = bma180_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 40/50 iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Note that in this case the storage for saving state was protected by CONFIG_PM guards. The storage is very small and unlikely to make any real difference to the space allocated for state so just drop those guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/dac/m62332.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/iio/dac/m62332.c +2 -9
@@ -25,9 +25,7 @@ struct m62332_data {struct regulator *vcc;struct mutex mutex;u8 raw[M62332_CHANNELS ]; -#ifdef CONFIG_PM_SLEEP u8 save[M62332_CHANNELS ]; -#endif };static int m62332_set_value (struct iio_dev *indio_dev,u8 val,int channel)
@@ -124,7 +122,6 @@ static int m62332_write_raw(struct iio_dev *indio_dev,return -EINVAL ; } -#ifdef CONFIG_PM_SLEEP static int m62332_suspend (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);
@@ -156,11 +153,7 @@ static int m62332_resume(struct device *dev)return m62332_set_value (indio_dev, data->save[1 ],1 ); } -static SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume); -#define M62332_PM_OPS (&m62332_pm_ops) -#else -#define M62332_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume);static const struct iio_info m62332_info = { .read_raw = m62332_read_raw,
@@ -246,7 +239,7 @@ MODULE_DEVICE_TABLE(i2c, m62332_id);static struct i2c_driver m62332_driver = { .driver = { .name ="m62332" , - .pm =M62332_PM_OPS , + .pm =pm_sleep_ptr (&m62332_pm_ops), }, .probe = m62332_probe, .remove = m62332_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 41/50 iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without one or more of CONFIG_PM/CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/imu/kmx61.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/imu/kmx61.c +3 -7
@@ -1440,7 +1440,6 @@ static int kmx61_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM_SLEEP static int kmx61_suspend (struct device *dev) {int ret;
@@ -1466,9 +1465,7 @@ static int kmx61_resume(struct device *dev)return kmx61_set_mode (data, stby,KMX61_ACC |KMX61_MAG , true); } -#endif -#ifdef CONFIG_PM static int kmx61_runtime_suspend (struct device *dev) {struct kmx61_data *data =i2c_get_clientdata (to_i2c_client (dev));
@@ -1493,11 +1490,10 @@ static int kmx61_runtime_resume(struct device *dev)return kmx61_set_mode (data, stby,KMX61_ACC |KMX61_MAG , true); } -#endif static const struct dev_pm_ops kmx61_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(kmx61_suspend, kmx61_resume) -SET_RUNTIME_PM_OPS (kmx61_runtime_suspend, kmx61_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(kmx61_suspend, kmx61_resume) +RUNTIME_PM_OPS (kmx61_runtime_suspend, kmx61_runtime_resume,NULL ) };static const struct acpi_device_id kmx61_acpi_match[] = {
@@ -1518,7 +1514,7 @@ static struct i2c_driver kmx61_driver = { .driver = { .name = KMX61_DRV_NAME, .acpi_match_table = ACPI_PTR(kmx61_acpi_match), - .pm = &kmx61_pm_ops, + .pm = pm_ptr(&kmx61_pm_ops), }, .probe = kmx61_probe, .remove = kmx61_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 42/50 iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without one or more of CONFIG_PM/CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/temperature/mlx90614.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/iio/temperature/mlx90614.c +4 -8
@@ -600,7 +600,6 @@ static const struct of_device_id mlx90614_of_match[] = { };MODULE_DEVICE_TABLE (of, mlx90614_of_match); -#ifdef CONFIG_PM_SLEEP static int mlx90614_pm_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -630,9 +629,7 @@ static int mlx90614_pm_resume(struct device *dev)return 0 ; } -#endif -#ifdef CONFIG_PM static int mlx90614_pm_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -648,19 +645,18 @@ static int mlx90614_pm_runtime_resume(struct device *dev)return mlx90614_wakeup (data); } -#endif static const struct dev_pm_ops mlx90614_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume) -SET_RUNTIME_PM_OPS (mlx90614_pm_runtime_suspend, - mlx90614_pm_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume) +RUNTIME_PM_OPS (mlx90614_pm_runtime_suspend, + mlx90614_pm_runtime_resume,NULL ) };static struct i2c_driver mlx90614_driver = { .driver = { .name ="mlx90614" , .of_match_table = mlx90614_of_match, - .pm = &mlx90614_pm_ops, + .pm =pm_ptr (&mlx90614_pm_ops), }, .probe = mlx90614_probe, .remove = mlx90614_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 43/50 iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
This case uses the new DEFINE_RUNTIME_DEV_PM_OPS() to reduce boilerplate.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/adc/ab8500-gpadc.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/iio/adc/ab8500-gpadc.c +3 -10
@@ -942,7 +942,6 @@ static const struct iio_info ab8500_gpadc_info = { .read_raw = ab8500_gpadc_read_raw, }; -#ifdef CONFIG_PM static int ab8500_gpadc_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -965,7 +964,6 @@ static int ab8500_gpadc_runtime_resume(struct device *dev)return ret; } -#endif /** * ab8500_gpadc_parse_channel() - process devicetree channel configuration
@@ -1199,20 +1197,15 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)return 0 ; } -static const struct dev_pm_ops ab8500_gpadc_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) -SET_RUNTIME_PM_OPS (ab8500_gpadc_runtime_suspend, - ab8500_gpadc_runtime_resume, -NULL ) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(ab8500_gpadc_runtime_suspend, + ab8500_gpadc_runtime_resume, NULL);static struct platform_driver ab8500_gpadc_driver = { .probe = ab8500_gpadc_probe, .remove = ab8500_gpadc_remove, .driver = { .name ="ab8500-gpadc" , - .pm = &ab8500_gpadc_pm_ops, + .pm =pm_ptr (&ab8500_gpadc_pm_ops), }, };builtin_platform_driver (ab8500_gpadc_driver);
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 45/50 iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/adc/rcar-gyroadc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/rcar-gyroadc.c +2 -4
@@ -577,7 +577,6 @@ static int rcar_gyroadc_remove(struct platform_device *pdev)return 0 ; } -#if defined(CONFIG_PM )static int rcar_gyroadc_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -597,10 +596,9 @@ static int rcar_gyroadc_resume(struct device *dev)return 0 ; } -#endif static const struct dev_pm_ops rcar_gyroadc_pm_ops = { -SET_RUNTIME_PM_OPS (rcar_gyroadc_suspend, rcar_gyroadc_resume,NULL ) +RUNTIME_PM_OPS (rcar_gyroadc_suspend, rcar_gyroadc_resume,NULL ) };static struct platform_driver rcar_gyroadc_driver = {
@@ -609,7 +607,7 @@ static struct platform_driver rcar_gyroadc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = rcar_gyroadc_match, - .pm = &rcar_gyroadc_pm_ops, + .pm = pm_ptr(&rcar_gyroadc_pm_ops), }, };
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 44/50 iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
The new DEFINE_RUNTIME_DEV_PM_OPS() macro reduces boilerplate.
--- drivers/iio/adc/stm32-adc-core.c | 17 ++++++----------- drivers/iio/adc/stm32-adc.c | 12 ++++-------- 2 files changed, 10 insertions(+), 19 deletions(-)
drivers/iio/adc/stm32-adc-core.c +6 -11
@@ -763,7 +763,6 @@ static int stm32_adc_remove(struct platform_device *pdev)return 0 ; } -#if defined(CONFIG_PM )static int stm32_adc_core_runtime_suspend (struct device *dev) {stm32_adc_core_hw_stop (dev);
@@ -782,15 +781,11 @@ static int stm32_adc_core_runtime_idle(struct device *dev)return 0 ; } -#endif - -static const struct dev_pm_ops stm32_adc_core_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) -SET_RUNTIME_PM_OPS (stm32_adc_core_runtime_suspend, - stm32_adc_core_runtime_resume, - stm32_adc_core_runtime_idle) -}; + +static DEFINE_RUNTIME_DEV_PM_OPS(stm32_adc_core_pm_ops, + stm32_adc_core_runtime_suspend, + stm32_adc_core_runtime_resume, + stm32_adc_core_runtime_idle);static const struct stm32_adc_priv_cfg stm32f4_adc_priv_cfg = { .regs = &stm32f4_adc_common_regs,
@@ -836,7 +831,7 @@ static struct platform_driver stm32_adc_driver = { .driver = { .name = "stm32-adc-core", .of_match_table = stm32_adc_of_match, - .pm = &stm32_adc_core_pm_ops, + .pm = pm_ptr(&stm32_adc_core_pm_ops), }, };module_platform_driver (stm32_adc_driver);
drivers/iio/adc/stm32-adc.c +4 -8
@@ -2352,7 +2352,6 @@ static int stm32_adc_remove(struct platform_device *pdev)return 0 ; } -#if defined(CONFIG_PM_SLEEP )static int stm32_adc_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -2382,9 +2381,7 @@ static int stm32_adc_resume(struct device *dev)return stm32_adc_buffer_postenable (indio_dev); } -#endif -#if defined(CONFIG_PM )static int stm32_adc_runtime_suspend (struct device *dev) {return stm32_adc_hw_stop (dev);
@@ -2394,12 +2391,11 @@ static int stm32_adc_runtime_resume(struct device *dev) {return stm32_adc_hw_start (dev); } -#endif static const struct dev_pm_ops stm32_adc_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(stm32_adc_suspend, stm32_adc_resume) -SET_RUNTIME_PM_OPS (stm32_adc_runtime_suspend, stm32_adc_runtime_resume, -NULL ) + SYSTEM_SLEEP_PM_OPS(stm32_adc_suspend, stm32_adc_resume) +RUNTIME_PM_OPS (stm32_adc_runtime_suspend, stm32_adc_runtime_resume, +NULL ) };static const struct stm32_adc_cfg stm32f4_adc_cfg = {
@@ -2453,7 +2449,7 @@ static struct platform_driver stm32_adc_driver = { .driver = { .name = "stm32-adc", .of_match_table = stm32_adc_of_match, - .pm = &stm32_adc_pm_ops, + .pm = pm_ptr(&stm32_adc_pm_ops), }, };module_platform_driver (stm32_adc_driver);
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 46/50 iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Use the new DEFINE_RUNTIME_DEV_PM_OPS to reduce boilerplate.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/bh1780.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/iio/light/bh1780.c +3 -9
@@ -221,7 +221,6 @@ static int bh1780_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM static int bh1780_runtime_suspend (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);
@@ -256,14 +255,9 @@ static int bh1780_runtime_resume(struct device *dev)return 0 ; } -#endif /* CONFIG_PM */ -static const struct dev_pm_ops bh1780_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) -SET_RUNTIME_PM_OPS (bh1780_runtime_suspend, - bh1780_runtime_resume,NULL ) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(bh1780_dev_pm_ops, bh1780_runtime_suspend, + bh1780_runtime_resume, NULL);static const struct i2c_device_id bh1780_id[] = { {"bh1780" ,0 },
@@ -284,7 +278,7 @@ static struct i2c_driver bh1780_driver = { .id_table = bh1780_id, .driver = { .name = "bh1780", - .pm = &bh1780_dev_pm_ops, + .pm = pm_ptr(&bh1780_dev_pm_ops), .of_match_table = of_bh1780_match, }, };
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 47/50 iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +2 -5
@@ -338,7 +338,6 @@ static const struct of_device_id lidar_dt_ids[] = { };MODULE_DEVICE_TABLE (of, lidar_dt_ids); -#ifdef CONFIG_PM static int lidar_pm_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -358,18 +357,16 @@ static int lidar_pm_runtime_resume(struct device *dev)return ret; } -#endif static const struct dev_pm_ops lidar_pm_ops = { -SET_RUNTIME_PM_OPS (lidar_pm_runtime_suspend, - lidar_pm_runtime_resume,NULL ) +RUNTIME_PM_OPS (lidar_pm_runtime_suspend, lidar_pm_runtime_resume,NULL ) };static struct i2c_driver lidar_driver = { .driver = { .name =LIDAR_DRV_NAME , .of_match_table = lidar_dt_ids, - .pm = &lidar_pm_ops, + .pm =pm_ptr (&lidar_pm_ops), }, .probe = lidar_probe, .remove = lidar_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 48/50 iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/chemical/atlas-sensor.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/chemical/atlas-sensor.c +2 -5
@@ -737,7 +737,6 @@ static int atlas_remove(struct i2c_client *client)return atlas_set_powermode (data,0 ); } -#ifdef CONFIG_PM static int atlas_runtime_suspend (struct device *dev) { struct atlas_data *data =
@@ -753,18 +752,16 @@ static int atlas_runtime_resume(struct device *dev)return atlas_set_powermode (data,1 ); } -#endif static const struct dev_pm_ops atlas_pm_ops = { -SET_RUNTIME_PM_OPS (atlas_runtime_suspend, - atlas_runtime_resume,NULL ) +RUNTIME_PM_OPS (atlas_runtime_suspend, atlas_runtime_resume,NULL ) };static struct i2c_driver atlas_driver = { .driver = { .name =ATLAS_DRV_NAME , .of_match_table = atlas_dt_ids, - .pm = &atlas_pm_ops, + .pm =pm_ptr (&atlas_pm_ops), }, .probe = atlas_probe, .remove = atlas_remove,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 49/50 iio:light:rpr0521: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/rpr0521.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/light/rpr0521.c +2 -5
@@ -1055,7 +1055,6 @@ static int rpr0521_remove(struct i2c_client *client)return 0 ; } -#ifdef CONFIG_PM static int rpr0521_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -1101,11 +1100,9 @@ static int rpr0521_runtime_resume(struct device *dev)return 0 ; } -#endif static const struct dev_pm_ops rpr0521_pm_ops = { -SET_RUNTIME_PM_OPS (rpr0521_runtime_suspend, - rpr0521_runtime_resume,NULL ) +RUNTIME_PM_OPS (rpr0521_runtime_suspend, rpr0521_runtime_resume,NULL ) };static const struct acpi_device_id rpr0521_acpi_match[] = {
@@ -1124,7 +1121,7 @@ MODULE_DEVICE_TABLE(i2c, rpr0521_id);static struct i2c_driver rpr0521_driver = { .driver = { .name =RPR0521_DRV_NAME , - .pm = &rpr0521_pm_ops, + .pm =pm_ptr (&rpr0521_pm_ops), .acpi_match_table =ACPI_PTR (rpr0521_acpi_match), }, .probe = rpr0521_probe,
Signature · 1 line
2.35.1
Jonathan Cameron
maintainerPATCH v3 50/50 iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
The combinations of either
* pm_sleep_ptr() and DEFINE_SIMPLE_DEV_PM_OPS()
* pm_ptr() and RUNTIME_PM_OPS()/SYSTEM_SLEEP_PM_OPS
Make sure the functions are always visible to the compiler and removed by it rather than requring #ifdef magic.
This removes the need to mark the functions as __maybe_unused and saves additional space with some build options as the dev_pm_ops structure itself can be dropped automatically if CONFIG_PM is not enabled.
--- drivers/iio/adc/stm32-dfsdm-adc.c | 11 ++++++----- drivers/iio/adc/stm32-dfsdm-core.c | 19 +++++++++---------- drivers/iio/dac/stm32-dac-core.c | 16 ++++++++-------- drivers/iio/dac/stm32-dac.c | 9 ++++----- drivers/iio/trigger/stm32-timer-trigger.c | 12 ++++++------ 5 files changed, 33 insertions(+), 34 deletions(-)
drivers/iio/adc/stm32-dfsdm-adc.c +6 -5
@@ -1632,7 +1632,7 @@ static int stm32_dfsdm_adc_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_dfsdm_adc_suspend (struct device *dev) +static int stm32_dfsdm_adc_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -1642,7 +1642,7 @@ static int __maybe_unused stm32_dfsdm_adc_suspend(struct device *dev)return 0 ; } -static int __maybe_unused stm32_dfsdm_adc_resume (struct device *dev) +static int stm32_dfsdm_adc_resume (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);struct stm32_dfsdm_adc *adc =iio_priv (indio_dev);
@@ -1665,14 +1665,15 @@ static int __maybe_unused stm32_dfsdm_adc_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(stm32_dfsdm_adc_pm_ops, - stm32_dfsdm_adc_suspend, stm32_dfsdm_adc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_dfsdm_adc_pm_ops, + stm32_dfsdm_adc_suspend, + stm32_dfsdm_adc_resume);static struct platform_driver stm32_dfsdm_adc_driver = { .driver = { .name ="stm32-dfsdm-adc" , .of_match_table = stm32_dfsdm_adc_match, - .pm = &stm32_dfsdm_adc_pm_ops, + .pm =pm_sleep_ptr (&stm32_dfsdm_adc_pm_ops), }, .probe = stm32_dfsdm_adc_probe, .remove = stm32_dfsdm_adc_remove,
drivers/iio/adc/stm32-dfsdm-core.c +9 -10
@@ -381,7 +381,7 @@ static int stm32_dfsdm_core_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_dfsdm_core_suspend (struct device *dev) +static int stm32_dfsdm_core_suspend (struct device *dev) {struct stm32_dfsdm *dfsdm =dev_get_drvdata (dev);struct dfsdm_priv *priv =to_stm32_dfsdm_priv (dfsdm);
@@ -397,7 +397,7 @@ static int __maybe_unused stm32_dfsdm_core_suspend(struct device *dev)return pinctrl_pm_select_sleep_state (dev); } -static int __maybe_unused stm32_dfsdm_core_resume (struct device *dev) +static int stm32_dfsdm_core_resume (struct device *dev) {struct stm32_dfsdm *dfsdm =dev_get_drvdata (dev);struct dfsdm_priv *priv =to_stm32_dfsdm_priv (dfsdm);
@@ -414,7 +414,7 @@ static int __maybe_unused stm32_dfsdm_core_resume(struct device *dev)return pm_runtime_force_resume (dev); } -static int __maybe_unused stm32_dfsdm_core_runtime_suspend (struct device *dev) +static int stm32_dfsdm_core_runtime_suspend (struct device *dev) {struct stm32_dfsdm *dfsdm =dev_get_drvdata (dev);
@@ -423,7 +423,7 @@ static int __maybe_unused stm32_dfsdm_core_runtime_suspend(struct device *dev)return 0 ; } -static int __maybe_unused stm32_dfsdm_core_runtime_resume (struct device *dev) +static int stm32_dfsdm_core_runtime_resume (struct device *dev) {struct stm32_dfsdm *dfsdm =dev_get_drvdata (dev);
@@ -431,11 +431,10 @@ static int __maybe_unused stm32_dfsdm_core_runtime_resume(struct device *dev) }static const struct dev_pm_ops stm32_dfsdm_core_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(stm32_dfsdm_core_suspend, - stm32_dfsdm_core_resume) -SET_RUNTIME_PM_OPS (stm32_dfsdm_core_runtime_suspend, - stm32_dfsdm_core_runtime_resume, -NULL ) + SYSTEM_SLEEP_PM_OPS(stm32_dfsdm_core_suspend, stm32_dfsdm_core_resume) +RUNTIME_PM_OPS (stm32_dfsdm_core_runtime_suspend, + stm32_dfsdm_core_runtime_resume, +NULL ) };static struct platform_driver stm32_dfsdm_driver = {
@@ -444,7 +443,7 @@ static struct platform_driver stm32_dfsdm_driver = { .driver = { .name = "stm32-dfsdm", .of_match_table = stm32_dfsdm_of_match, - .pm = &stm32_dfsdm_core_pm_ops, + .pm = pm_ptr(&stm32_dfsdm_core_pm_ops), }, };
drivers/iio/dac/stm32-dac-core.c +8 -8
@@ -195,7 +195,7 @@ static int stm32_dac_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_dac_core_resume (struct device *dev) +static int stm32_dac_core_resume (struct device *dev) {struct stm32_dac_common *common =dev_get_drvdata (dev);struct stm32_dac_priv *priv =to_stm32_dac_priv (common);
@@ -213,23 +213,23 @@ static int __maybe_unused stm32_dac_core_resume(struct device *dev)return pm_runtime_force_resume (dev); } -static int __maybe_unused stm32_dac_core_runtime_suspend (struct device *dev) +static int stm32_dac_core_runtime_suspend (struct device *dev) {stm32_dac_core_hw_stop (dev);return 0 ; } -static int __maybe_unused stm32_dac_core_runtime_resume (struct device *dev) +static int stm32_dac_core_runtime_resume (struct device *dev) {return stm32_dac_core_hw_start (dev); }static const struct dev_pm_ops stm32_dac_core_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, stm32_dac_core_resume) -SET_RUNTIME_PM_OPS (stm32_dac_core_runtime_suspend, - stm32_dac_core_runtime_resume, -NULL ) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, stm32_dac_core_resume) +RUNTIME_PM_OPS (stm32_dac_core_runtime_suspend, + stm32_dac_core_runtime_resume, +NULL ) };static const struct stm32_dac_cfg stm32h7_dac_cfg = {
@@ -253,7 +253,7 @@ static struct platform_driver stm32_dac_driver = { .driver = { .name = "stm32-dac-core", .of_match_table = stm32_dac_of_match, - .pm = &stm32_dac_core_pm_ops, + .pm = pm_ptr(&stm32_dac_core_pm_ops), }, };module_platform_driver (stm32_dac_driver);
drivers/iio/dac/stm32-dac.c +4 -5
@@ -372,7 +372,7 @@ static int stm32_dac_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_dac_suspend (struct device *dev) +static int stm32_dac_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);int channel = indio_dev->channels[0 ].channel;
@@ -386,9 +386,8 @@ static int __maybe_unused stm32_dac_suspend(struct device *dev)return pm_runtime_force_suspend (dev); } -static const struct dev_pm_ops stm32_dac_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (stm32_dac_suspend, pm_runtime_force_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_dac_pm_ops, stm32_dac_suspend, + pm_runtime_force_resume);static const struct of_device_id stm32_dac_of_match[] = { { .compatible ="st,stm32-dac" , },
@@ -402,7 +401,7 @@ static struct platform_driver stm32_dac_driver = { .driver = { .name = "stm32-dac", .of_match_table = stm32_dac_of_match, - .pm = &stm32_dac_pm_ops, + .pm = pm_sleep_ptr(&stm32_dac_pm_ops), }, };module_platform_driver (stm32_dac_driver);
drivers/iio/trigger/stm32-timer-trigger.c +6 -6
@@ -827,7 +827,7 @@ static int stm32_timer_trigger_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_timer_trigger_suspend (struct device *dev) +static int stm32_timer_trigger_suspend (struct device *dev) {struct stm32_timer_trigger *priv =dev_get_drvdata (dev);
@@ -849,7 +849,7 @@ static int __maybe_unused stm32_timer_trigger_suspend(struct device *dev)return 0 ; } -static int __maybe_unused stm32_timer_trigger_resume (struct device *dev) +static int stm32_timer_trigger_resume (struct device *dev) {struct stm32_timer_trigger *priv =dev_get_drvdata (dev);int ret;
@@ -875,9 +875,9 @@ static int __maybe_unused stm32_timer_trigger_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(stm32_timer_trigger_pm_ops, - stm32_timer_trigger_suspend, - stm32_timer_trigger_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_timer_trigger_pm_ops, + stm32_timer_trigger_suspend, + stm32_timer_trigger_resume);static const struct stm32_timer_trigger_cfg stm32_timer_trg_cfg = { .valids_table = valids_table,
@@ -907,7 +907,7 @@ static struct platform_driver stm32_timer_trigger_driver = { .driver = { .name = "stm32-timer-trigger", .of_match_table = stm32_trig_of_match, - .pm = &stm32_timer_trigger_pm_ops, + .pm = pm_sleep_ptr(&stm32_timer_trigger_pm_ops), }, };module_platform_driver (stm32_timer_trigger_driver);
Signature · 1 line
2.35.1
Re: [PATCH v3 42/50] iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr() etc
In reply to Jonathan CameronI don't have setup ready for a quick test of this, but it is consistent with other changes.
Best regards,
Crt
Quoted 65 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without one or more of CONFIG_PM/CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being copied into new drivers.
Signed-off-by Jonathan Cameron <[email protected]>Cc Crt Mori <[email protected]>--- drivers/iio/temperature/mlx90614.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/iio/temperature/mlx90614.c +4
-9@@ -600,7 +600,6 @@ static const struct of_device_id mlx90614_of_match[] = { };MODULE_DEVICE_TABLE (of, mlx90614_of_match); -#ifdef CONFIG_PM_SLEEP static int mlx90614_pm_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));@@ -630,9 +629,7 @@ static int mlx90614_pm_resume(struct device *dev)return 0 ; } -#endif -#ifdef CONFIG_PM static int mlx90614_pm_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));@@ -648,19 +645,18 @@ static int mlx90614_pm_runtime_resume(struct device *dev)return mlx90614_wakeup (data); } -#endif static const struct dev_pm_ops mlx90614_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume) -SET_RUNTIME_PM_OPS (mlx90614_pm_runtime_suspend, - mlx90614_pm_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume) +RUNTIME_PM_OPS (mlx90614_pm_runtime_suspend, + mlx90614_pm_runtime_resume,NULL ) };static struct i2c_driver mlx90614_driver = { .driver = { .name ="mlx90614" , .of_match_table = mlx90614_of_match, - .pm = &mlx90614_pm_ops, + .pm =pm_ptr (&mlx90614_pm_ops), }, .probe = mlx90614_probe, .remove = mlx90614_remove, --2.35.1
Quoted 7 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Note that I have cc'd no one for a number of drivers touched in this set because we don't have a known active maintainer, so if anyone has time to sanity check those it would be much appreciated.
Quoted 5 lines
Now that Paul Cercueil's rework of the
pm_ptr()and related macro magic to ensure we the compiler can remove unused structdev_pm_opsand related functions when eitherCONFIG_PM_SLEEPis not set or both that andCONFIG_PMare not set is upstream [1], lets revisit this series of cleanup of CONFIG_PM* guards in IIO.
I have not done an in-depth review of any particular patch, but I have glanced over all of them and I am perfectly happy with this version, and I'd say you should just put them into linux-next once no more Acks come in. If anything breaks, it can be fixed on top.
Arnd
Hi Jonathan,
for the whole series.
Cheers,
-Paul
Quoted 217 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Note that I have cc'd no one for a number of drivers touched in this set because we don't have a known active maintainer, so if anyone has time to sanity check those it would be much appreciated.
Now that Paul Cercueil's rework of the
pm_ptr()and related macro magic to ensure we the compiler can remove unused structdev_pm_opsand related functions when eitherCONFIG_PM_SLEEPis not set or both that andCONFIG_PMare not set is upstream [1], lets revisit this series of cleanup of CONFIG_PM* guards in IIO.Changes since v2:
1) Move to new macros where relevant.
2) Add static as the macros no longer include itDEFINE_SIMPLE_DEV_PM_OPSetc.
3) Drop complex cases (I've noted those in reply to v2 so won't go into specifics here. I'll revisit all these but after this
massive
set is in place. Some of these are due to interaction with the ongoing namespace work in IIO.
4) Use the newDEFINE_RUNTIME_DEV_PM_OPSfor cases where the force runtime functions were used for sleep ops.
5) Add a few cases that I'd missed the first time around.Note that there are some drivers that provide runtime callbacks but not sleep ones. The chances are high that it would be sensible to use the force runtime pm calls for those, but I considered that a separate change which should potentially be part of a follow up patch set.
Cc: Alexandre Belloni <[email protected]>
Cc: Anson Huang <[email protected]>
Cc: Brian Masney <[email protected]>
Cc: Crt Mori <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: Icenowy Zheng <[email protected]>
Cc: Jonathan Albrieux <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Luca Weiss <[email protected]>
Cc: Ludovic Desroches <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Martijn Braam <[email protected]>
Cc: Maslov Dmitry <[email protected]>
Cc: Matt Ranostay <[email protected]
Cc: Mikko Koivunen <[email protected]>
Cc: Olivier Moysan <[email protected]>
Cc: Stefan-Gabriel Mirea <[email protected]>
Cc: Vaishnav M A <[email protected]>
Jonathan Cameron (50):
iio:accel:da311: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:accel:da280: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:accel:dmard06: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:accel:dmard10: Switch fromCONFIG_PMguards topm_sleep_ptr()
etc
iio:accel:mc3230: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:accel:mma7660: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()iio:accel:mma9551: Switch from
CONFIG_PMguards topm_ptr()etc iio:accel:mma9553: Switch fromCONFIG_PMguards topm_ptr()etc iio:accel:stk8ba50: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:adc:at91-adc: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:adc:exynos_adc: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr() iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()iio:adc:rockchip: Switch from
CONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:adc:twl6030: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:adc:vf610: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:common:ssp: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:dac:vf610: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:light:apds9300: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:cm3232: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:light:isl29018: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()iio:light:isl29125: Switch from
CONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:jsa1212: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:ltr501: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:light:stk3310: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:tcs3414: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:tcs3472: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:tsl2563: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:tsl4531: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:magn:ak8975: Switch fromCONFIG_PMguards topm_ptr()etc iio:magn:mag3110: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:magn:mmc35240: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:pressure:mpl3115: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:proximity:as3935: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:proximity:rfd77492: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:proximity:sx9500: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:temperature:tmp006: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:temperature:tmp007: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:accel:stk8312: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:accel:bma180: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:dac:m62332: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:imu:kmx61: Switch from CONFIG_PM* guards topm_ptr()etc iio:temperature:mlx90614: Switch from CONFIG_PM* guards topm_ptr()
etc
iio:adc:ab8500: Switch fromCONFIG_PMguards topm_ptr()etc iio:adc:stm32:Switch fromCONFIG_PMguards topm_ptr()iio:adc:rcar: Switch fromCONFIG_PMguards topm_ptr()etc iio:light:bh1780: Switch fromCONFIG_PMguards topm_ptr()etc iio:proximity:pulsedlight: Switch fromCONFIG_PMguards topm_ptr()
etc
iio:chemical:atlas: Switch fromCONFIG_PMguards topm_ptr()etc iio:light:rpr0521: Switch fromCONFIG_PMguards topm_ptr()etc iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm
__maybe_unuseddrivers/iio/accel/bma180.c | 9 ++------- drivers/iio/accel/da280.c | 6 ++---- drivers/iio/accel/da311.c | 6 ++---- drivers/iio/accel/dmard06.c | 10 +++------- drivers/iio/accel/dmard10.c | 7 +++---- drivers/iio/accel/mc3230.c | 6 ++---- drivers/iio/accel/mma7660.c | 11 +++-------- drivers/iio/accel/mma9551.c | 11 +++-------- drivers/iio/accel/mma9553.c | 11 +++-------- drivers/iio/accel/stk8312.c | 11 +++-------- drivers/iio/accel/stk8ba50.c | 11 +++-------- drivers/iio/adc/ab8500-gpadc.c | 13 +++---------- drivers/iio/adc/at91_adc.c | 7 +++---- drivers/iio/adc/exynos_adc.c | 9 +++------ drivers/iio/adc/palmas_gpadc.c | 10 +++------- drivers/iio/adc/rcar-gyroadc.c | 6 ++---- drivers/iio/adc/rockchip_saradc.c | 9 ++++----- drivers/iio/adc/stm32-adc-core.c | 17 ++++++----------- drivers/iio/adc/stm32-adc.c | 12 ++++-------- drivers/iio/adc/stm32-dfsdm-adc.c | 11 ++++++----- drivers/iio/adc/stm32-dfsdm-core.c | 19 +++++++++---------- drivers/iio/adc/twl6030-gpadc.c | 8 +++----- drivers/iio/adc/vf610_adc.c | 7 +++---- drivers/iio/chemical/atlas-sensor.c | 7 ++----- drivers/iio/common/ssp_sensors/ssp_dev.c | 8 ++------ drivers/iio/dac/m62332.c | 11 ++--------- drivers/iio/dac/stm32-dac-core.c | 16 ++++++++-------- drivers/iio/dac/stm32-dac.c | 9 ++++----- drivers/iio/dac/vf610_dac.c | 7 +++---- drivers/iio/imu/kmx61.c | 10 +++------- drivers/iio/light/apds9300.c | 10 +++------- drivers/iio/light/bh1780.c | 12 +++--------- drivers/iio/light/cm3232.c | 9 ++------- drivers/iio/light/isl29018.c | 10 +++------- drivers/iio/light/isl29125.c | 7 +++---- drivers/iio/light/jsa1212.c | 11 +++-------- drivers/iio/light/ltr501.c | 6 ++---- drivers/iio/light/rpr0521.c | 7 ++----- drivers/iio/light/stk3310.c | 11 +++-------- drivers/iio/light/tcs3414.c | 7 +++---- drivers/iio/light/tcs3472.c | 7 +++---- drivers/iio/light/tsl2563.c | 10 +++------- drivers/iio/light/tsl4531.c | 10 +++------- drivers/iio/magnetometer/ak8975.c | 12 +++--------- drivers/iio/magnetometer/mag3110.c | 10 +++------- drivers/iio/magnetometer/mmc35240.c | 9 +++------ drivers/iio/pressure/mpl3115.c | 10 +++------- drivers/iio/proximity/as3935.c | 10 ++-------- .../iio/proximity/pulsedlight-lidar-lite-v2.c | 7 ++----- drivers/iio/proximity/rfd77402.c | 7 +++---- drivers/iio/proximity/sx9500.c | 8 ++------ drivers/iio/temperature/mlx90614.c | 12 ++++-------- drivers/iio/temperature/tmp006.c | 6 ++---- drivers/iio/temperature/tmp007.c | 6 ++---- drivers/iio/trigger/stm32-timer-trigger.c | 12 ++++++------ 55 files changed, 173 insertions(+), 348 deletions(-)--
2.35.1
Re: [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused
In reply to Jonathan CameronQuoted 8 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
The combinations of either
*pm_sleep_ptr()andDEFINE_SIMPLE_DEV_PM_OPS()
*pm_ptr()and RUNTIME_PM_OPS()/SYSTEM_SLEEP_PM_OPS
Make sure the functions are always visible to the compiler and removed by it rather than requring #ifdef magic.
Quoted 8 lines
This removes the need to mark the functions as
__maybe_unusedand saves additional space with some build options as thedev_pm_opsstructure itself can be dropped automatically ifCONFIG_PMis not enabled.Signed-off-by Jonathan Cameron <[email protected]>Cc Olivier Moysan <[email protected]>Cc Fabrice Gasnier <[email protected]>---
Hi Jonathan,
You can add my:
Thanks for the patch,
Best Regards,
Fabrice
Quoted 244 lines
drivers/iio/adc/stm32-dfsdm-adc.c | 11 ++++++----- drivers/iio/adc/stm32-dfsdm-core.c | 19 +++++++++---------- drivers/iio/dac/stm32-dac-core.c | 16 ++++++++-------- drivers/iio/dac/stm32-dac.c | 9 ++++----- drivers/iio/trigger/stm32-timer-trigger.c | 12 ++++++------ 5 files changed, 33 insertions(+), 34 deletions(-)drivers/iio/adc/stm32-dfsdm-adc.c +6
-5@@ -1632,7 +1632,7 @@ static int stm32_dfsdm_adc_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_dfsdm_adc_suspend (struct device *dev) +static int stm32_dfsdm_adc_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);@@ -1642,7 +1642,7 @@ static int __maybe_unused stm32_dfsdm_adc_suspend(struct device *dev)return 0 ; } -static int __maybe_unused stm32_dfsdm_adc_resume (struct device *dev) +static int stm32_dfsdm_adc_resume (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);struct stm32_dfsdm_adc *adc =iio_priv (indio_dev);@@ -1665,14 +1665,15 @@ static int __maybe_unused stm32_dfsdm_adc_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(stm32_dfsdm_adc_pm_ops, - stm32_dfsdm_adc_suspend, stm32_dfsdm_adc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_dfsdm_adc_pm_ops, + stm32_dfsdm_adc_suspend, + stm32_dfsdm_adc_resume);static struct platform_driver stm32_dfsdm_adc_driver = { .driver = { .name ="stm32-dfsdm-adc" , .of_match_table = stm32_dfsdm_adc_match, - .pm = &stm32_dfsdm_adc_pm_ops, + .pm =pm_sleep_ptr (&stm32_dfsdm_adc_pm_ops), }, .probe = stm32_dfsdm_adc_probe, .remove = stm32_dfsdm_adc_remove,drivers/iio/adc/stm32-dfsdm-core.c +9
-10@@ -381,7 +381,7 @@ static int stm32_dfsdm_core_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_dfsdm_core_suspend (struct device *dev) +static int stm32_dfsdm_core_suspend (struct device *dev) {struct stm32_dfsdm *dfsdm =dev_get_drvdata (dev);struct dfsdm_priv *priv =to_stm32_dfsdm_priv (dfsdm);@@ -397,7 +397,7 @@ static int __maybe_unused stm32_dfsdm_core_suspend(struct device *dev)return pinctrl_pm_select_sleep_state (dev); } -static int __maybe_unused stm32_dfsdm_core_resume (struct device *dev) +static int stm32_dfsdm_core_resume (struct device *dev) {struct stm32_dfsdm *dfsdm =dev_get_drvdata (dev);struct dfsdm_priv *priv =to_stm32_dfsdm_priv (dfsdm);@@ -414,7 +414,7 @@ static int __maybe_unused stm32_dfsdm_core_resume(struct device *dev)return pm_runtime_force_resume (dev); } -static int __maybe_unused stm32_dfsdm_core_runtime_suspend (struct device *dev) +static int stm32_dfsdm_core_runtime_suspend (struct device *dev) {struct stm32_dfsdm *dfsdm =dev_get_drvdata (dev);@@ -423,7 +423,7 @@ static int __maybe_unused stm32_dfsdm_core_runtime_suspend(struct device *dev)return 0 ; } -static int __maybe_unused stm32_dfsdm_core_runtime_resume (struct device *dev) +static int stm32_dfsdm_core_runtime_resume (struct device *dev) {struct stm32_dfsdm *dfsdm =dev_get_drvdata (dev);@@ -431,11 +431,10 @@ static int __maybe_unused stm32_dfsdm_core_runtime_resume(struct device *dev) }static const struct dev_pm_ops stm32_dfsdm_core_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(stm32_dfsdm_core_suspend, - stm32_dfsdm_core_resume) -SET_RUNTIME_PM_OPS (stm32_dfsdm_core_runtime_suspend, - stm32_dfsdm_core_runtime_resume, -NULL ) + SYSTEM_SLEEP_PM_OPS(stm32_dfsdm_core_suspend, stm32_dfsdm_core_resume) +RUNTIME_PM_OPS (stm32_dfsdm_core_runtime_suspend, + stm32_dfsdm_core_runtime_resume, +NULL ) };static struct platform_driver stm32_dfsdm_driver = {@@ -444,7 +443,7 @@ static struct platform_driver stm32_dfsdm_driver = { .driver = { .name = "stm32-dfsdm", .of_match_table = stm32_dfsdm_of_match, - .pm = &stm32_dfsdm_core_pm_ops, + .pm = pm_ptr(&stm32_dfsdm_core_pm_ops), }, };drivers/iio/dac/stm32-dac-core.c +8
-8@@ -195,7 +195,7 @@ static int stm32_dac_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_dac_core_resume (struct device *dev) +static int stm32_dac_core_resume (struct device *dev) {struct stm32_dac_common *common =dev_get_drvdata (dev);struct stm32_dac_priv *priv =to_stm32_dac_priv (common);@@ -213,23 +213,23 @@ static int __maybe_unused stm32_dac_core_resume(struct device *dev)return pm_runtime_force_resume (dev); } -static int __maybe_unused stm32_dac_core_runtime_suspend (struct device *dev) +static int stm32_dac_core_runtime_suspend (struct device *dev) {stm32_dac_core_hw_stop (dev);return 0 ; } -static int __maybe_unused stm32_dac_core_runtime_resume (struct device *dev) +static int stm32_dac_core_runtime_resume (struct device *dev) {return stm32_dac_core_hw_start (dev); }static const struct dev_pm_ops stm32_dac_core_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, stm32_dac_core_resume) -SET_RUNTIME_PM_OPS (stm32_dac_core_runtime_suspend, - stm32_dac_core_runtime_resume, -NULL ) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, stm32_dac_core_resume) +RUNTIME_PM_OPS (stm32_dac_core_runtime_suspend, + stm32_dac_core_runtime_resume, +NULL ) };static const struct stm32_dac_cfg stm32h7_dac_cfg = {@@ -253,7 +253,7 @@ static struct platform_driver stm32_dac_driver = { .driver = { .name = "stm32-dac-core", .of_match_table = stm32_dac_of_match, - .pm = &stm32_dac_core_pm_ops, + .pm = pm_ptr(&stm32_dac_core_pm_ops), }, };module_platform_driver (stm32_dac_driver);drivers/iio/dac/stm32-dac.c +4
-5@@ -372,7 +372,7 @@ static int stm32_dac_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_dac_suspend (struct device *dev) +static int stm32_dac_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);int channel = indio_dev->channels[0 ].channel;@@ -386,9 +386,8 @@ static int __maybe_unused stm32_dac_suspend(struct device *dev)return pm_runtime_force_suspend (dev); } -static const struct dev_pm_ops stm32_dac_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (stm32_dac_suspend, pm_runtime_force_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_dac_pm_ops, stm32_dac_suspend, + pm_runtime_force_resume);static const struct of_device_id stm32_dac_of_match[] = { { .compatible ="st,stm32-dac" , },@@ -402,7 +401,7 @@ static struct platform_driver stm32_dac_driver = { .driver = { .name = "stm32-dac", .of_match_table = stm32_dac_of_match, - .pm = &stm32_dac_pm_ops, + .pm = pm_sleep_ptr(&stm32_dac_pm_ops), }, };module_platform_driver (stm32_dac_driver);drivers/iio/trigger/stm32-timer-trigger.c +6
-6@@ -827,7 +827,7 @@ static int stm32_timer_trigger_remove(struct platform_device *pdev)return 0 ; } -static int __maybe_unused stm32_timer_trigger_suspend (struct device *dev) +static int stm32_timer_trigger_suspend (struct device *dev) {struct stm32_timer_trigger *priv =dev_get_drvdata (dev);@@ -849,7 +849,7 @@ static int __maybe_unused stm32_timer_trigger_suspend(struct device *dev)return 0 ; } -static int __maybe_unused stm32_timer_trigger_resume (struct device *dev) +static int stm32_timer_trigger_resume (struct device *dev) {struct stm32_timer_trigger *priv =dev_get_drvdata (dev);int ret;@@ -875,9 +875,9 @@ static int __maybe_unused stm32_timer_trigger_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(stm32_timer_trigger_pm_ops, - stm32_timer_trigger_suspend, - stm32_timer_trigger_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_timer_trigger_pm_ops, + stm32_timer_trigger_suspend, + stm32_timer_trigger_resume);static const struct stm32_timer_trigger_cfg stm32_timer_trg_cfg = { .valids_table = valids_table,@@ -907,7 +907,7 @@ static struct platform_driver stm32_timer_trigger_driver = { .driver = { .name = "stm32-timer-trigger", .of_match_table = stm32_trig_of_match, - .pm = &stm32_timer_trigger_pm_ops, + .pm = pm_sleep_ptr(&stm32_timer_trigger_pm_ops), }, };module_platform_driver (stm32_timer_trigger_driver);
Jonathan Cameron
maintainerQuoted 5 lines · On Wed, 09 Feb 2022 11:41:26 +0000 Paul Cercueil <[email protected]> wrote:
Hi Jonathan,
Reviewed-by Paul Cercueil <[email protected]>for the whole series.
Thanks!
Series applied with a bit of fuzz to the togreg branch of iio.git and pushed out as testing to let the autobuilders see if they can find anything we missed
Thanks,
Jonathan
Quoted 229 lines
Cheers,
-PaulQuoted 220 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Note that I have cc'd no one for a number of drivers touched in this set because we don't have a known active maintainer, so if anyone has time to sanity check those it would be much appreciated.
Now that Paul Cercueil's rework of the
pm_ptr()and related macro magic
to ensure we the compiler can remove unused structdev_pm_opsand related
functions when eitherCONFIG_PM_SLEEPis not set or both that andCONFIG_PMare not set is upstream [1], lets revisit this series of cleanup of CONFIG_PM* guards in IIO.Changes since v2:
1) Move to new macros where relevant.
2) Add static as the macros no longer include itDEFINE_SIMPLE_DEV_PM_OPSetc.
3) Drop complex cases (I've noted those in reply to v2 so won't go into specifics here. I'll revisit all these but after this
massive
set is in place. Some of these are due to interaction with the ongoing namespace work in IIO.
4) Use the newDEFINE_RUNTIME_DEV_PM_OPSfor cases where the force runtime functions were used for sleep ops.
5) Add a few cases that I'd missed the first time around.Note that there are some drivers that provide runtime callbacks but not sleep ones. The chances are high that it would be sensible to use the force runtime pm calls for those, but I considered that a separate change which should potentially be part of a follow up patch set.
Cc: Alexandre Belloni <[email protected]>
Cc: Anson Huang <[email protected]>
Cc: Brian Masney <[email protected]>
Cc: Crt Mori <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: Icenowy Zheng <[email protected]>
Cc: Jonathan Albrieux <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Luca Weiss <[email protected]>
Cc: Ludovic Desroches <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Martijn Braam <[email protected]>
Cc: Maslov Dmitry <[email protected]>
Cc: Matt Ranostay <[email protected]
Cc: Mikko Koivunen <[email protected]>
Cc: Olivier Moysan <[email protected]>
Cc: Stefan-Gabriel Mirea <[email protected]>
Cc: Vaishnav M A <[email protected]>
Jonathan Cameron (50):
iio:accel:da311: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:accel:da280: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:accel:dmard06: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:accel:dmard10: Switch fromCONFIG_PMguards topm_sleep_ptr()
etc
iio:accel:mc3230: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:accel:mma7660: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()iio:accel:mma9551: Switch from
CONFIG_PMguards topm_ptr()etc iio:accel:mma9553: Switch fromCONFIG_PMguards topm_ptr()etc iio:accel:stk8ba50: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:adc:at91-adc: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:adc:exynos_adc: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr() iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()iio:adc:rockchip: Switch from
CONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:adc:twl6030: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:adc:vf610: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:common:ssp: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:dac:vf610: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:light:apds9300: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:cm3232: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:light:isl29018: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()iio:light:isl29125: Switch from
CONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:jsa1212: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:ltr501: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:light:stk3310: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:tcs3414: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:tcs3472: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:tsl2563: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:light:tsl4531: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:magn:ak8975: Switch fromCONFIG_PMguards topm_ptr()etc iio:magn:mag3110: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:magn:mmc35240: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:pressure:mpl3115: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:proximity:as3935: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:proximity:rfd77492: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:proximity:sx9500: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:temperature:tmp006: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:temperature:tmp007: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:accel:stk8312: Switch fromCONFIG_PM_SLEEPguards to
pm_sleep_ptr()etc
iio:accel:bma180: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:dac:m62332: Switch fromCONFIG_PM_SLEEPguards topm_sleep_ptr()
etc
iio:imu:kmx61: Switch from CONFIG_PM* guards topm_ptr()etc iio:temperature:mlx90614: Switch from CONFIG_PM* guards topm_ptr()
etc
iio:adc:ab8500: Switch fromCONFIG_PMguards topm_ptr()etc iio:adc:stm32:Switch fromCONFIG_PMguards topm_ptr()iio:adc:rcar: Switch fromCONFIG_PMguards topm_ptr()etc iio:light:bh1780: Switch fromCONFIG_PMguards topm_ptr()etc iio:proximity:pulsedlight: Switch fromCONFIG_PMguards topm_ptr()
etc
iio:chemical:atlas: Switch fromCONFIG_PMguards topm_ptr()etc iio:light:rpr0521: Switch fromCONFIG_PMguards topm_ptr()etc iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm
__maybe_unuseddrivers/iio/accel/bma180.c | 9 ++------- drivers/iio/accel/da280.c | 6 ++---- drivers/iio/accel/da311.c | 6 ++---- drivers/iio/accel/dmard06.c | 10 +++------- drivers/iio/accel/dmard10.c | 7 +++---- drivers/iio/accel/mc3230.c | 6 ++---- drivers/iio/accel/mma7660.c | 11 +++-------- drivers/iio/accel/mma9551.c | 11 +++-------- drivers/iio/accel/mma9553.c | 11 +++-------- drivers/iio/accel/stk8312.c | 11 +++-------- drivers/iio/accel/stk8ba50.c | 11 +++-------- drivers/iio/adc/ab8500-gpadc.c | 13 +++---------- drivers/iio/adc/at91_adc.c | 7 +++---- drivers/iio/adc/exynos_adc.c | 9 +++------ drivers/iio/adc/palmas_gpadc.c | 10 +++------- drivers/iio/adc/rcar-gyroadc.c | 6 ++---- drivers/iio/adc/rockchip_saradc.c | 9 ++++----- drivers/iio/adc/stm32-adc-core.c | 17 ++++++----------- drivers/iio/adc/stm32-adc.c | 12 ++++-------- drivers/iio/adc/stm32-dfsdm-adc.c | 11 ++++++----- drivers/iio/adc/stm32-dfsdm-core.c | 19 +++++++++---------- drivers/iio/adc/twl6030-gpadc.c | 8 +++----- drivers/iio/adc/vf610_adc.c | 7 +++---- drivers/iio/chemical/atlas-sensor.c | 7 ++----- drivers/iio/common/ssp_sensors/ssp_dev.c | 8 ++------ drivers/iio/dac/m62332.c | 11 ++--------- drivers/iio/dac/stm32-dac-core.c | 16 ++++++++-------- drivers/iio/dac/stm32-dac.c | 9 ++++----- drivers/iio/dac/vf610_dac.c | 7 +++---- drivers/iio/imu/kmx61.c | 10 +++------- drivers/iio/light/apds9300.c | 10 +++------- drivers/iio/light/bh1780.c | 12 +++--------- drivers/iio/light/cm3232.c | 9 ++------- drivers/iio/light/isl29018.c | 10 +++------- drivers/iio/light/isl29125.c | 7 +++---- drivers/iio/light/jsa1212.c | 11 +++-------- drivers/iio/light/ltr501.c | 6 ++---- drivers/iio/light/rpr0521.c | 7 ++----- drivers/iio/light/stk3310.c | 11 +++-------- drivers/iio/light/tcs3414.c | 7 +++---- drivers/iio/light/tcs3472.c | 7 +++---- drivers/iio/light/tsl2563.c | 10 +++------- drivers/iio/light/tsl4531.c | 10 +++------- drivers/iio/magnetometer/ak8975.c | 12 +++--------- drivers/iio/magnetometer/mag3110.c | 10 +++------- drivers/iio/magnetometer/mmc35240.c | 9 +++------ drivers/iio/pressure/mpl3115.c | 10 +++------- drivers/iio/proximity/as3935.c | 10 ++-------- .../iio/proximity/pulsedlight-lidar-lite-v2.c | 7 ++----- drivers/iio/proximity/rfd77402.c | 7 +++---- drivers/iio/proximity/sx9500.c | 8 ++------ drivers/iio/temperature/mlx90614.c | 12 ++++-------- drivers/iio/temperature/tmp006.c | 6 ++---- drivers/iio/temperature/tmp007.c | 6 ++---- drivers/iio/trigger/stm32-timer-trigger.c | 12 ++++++------ 55 files changed, 173 insertions(+), 348 deletions(-)--
2.35.1
Jonathan Cameron
maintainerRe: [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronQuoted 40 lines · On Sun, 30 Jan 2022 19:31:40 +0000 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without
CONFIG_PMsupport is simpler and less error prone than the use of #ifdef based config guards.This case uses the new
DEFINE_RUNTIME_DEV_PM_OPS()to reduce boilerplate.Removing instances of this approach from IIO also stops them being copied into new drivers.
Signed-off-by Jonathan Cameron <[email protected]>Reviewed-by Linus Walleij <[email protected]>--- drivers/iio/adc/ab8500-gpadc.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)drivers/iio/adc/ab8500-gpadc.c +0
-2@@ -942,7 +942,6 @@ static const struct iio_info ab8500_gpadc_info = { .read_raw = ab8500_gpadc_read_raw, }; -#ifdef CONFIG_PM static int ab8500_gpadc_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);@@ -965,7 +964,6 @@ static int ab8500_gpadc_runtime_resume(struct device *dev)return ret; } -#endif /** * ab8500_gpadc_parse_channel() - process devicetree channel configuration @@ -1199,20 +1197,15 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)return 0 ;
drivers/iio/adc/ab8500-gpadc.c static int ab8500_gpadc_remove(struct platform_device *pdev) · line 1200
Quoted 10 lines
drivers/iio/adc/ab8500-gpadc.c +1
-7} -static const struct dev_pm_ops ab8500_gpadc_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) -SET_RUNTIME_PM_OPS (ab8500_gpadc_runtime_suspend, - ab8500_gpadc_runtime_resume, -NULL ) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(ab8500_gpadc_runtime_suspend,
0-day actually managed to build this driver unlike my test setups. Anyhow, I managed to lose the name of the dev_pm_ops structure.
I've fixed that up and tested by hacking out the dependencies in Kconfig. At somepoint I'll check if we can actually add a COMPILE_TEST option for this one or if there are some actual requirements that my really quick test didn't pick up on.
Fresh testing branch pushed out.
Quoted 12 lines
drivers/iio/adc/ab8500-gpadc.c +2
-1+ ab8500_gpadc_runtime_resume, NULL);static struct platform_driver ab8500_gpadc_driver = { .probe = ab8500_gpadc_probe, .remove = ab8500_gpadc_remove, .driver = { .name ="ab8500-gpadc" , - .pm = &ab8500_gpadc_pm_ops, + .pm =pm_ptr (&ab8500_gpadc_pm_ops), }, };builtin_platform_driver (ab8500_gpadc_driver);