iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc.
Subsystems (11)
Jonathan Cameron
maintainerv2 cover iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc.
From: Jonathan Cameron <[email protected]>
Previously "iio: Tree wide switch from CONFIG_PM* to __maybe_unused etc."
Note I've kept tags given for v1 having concluded the changes were fairly minor, but if anyone wants me to drop a tag let me know (it was a bit borderline in my view).
I have a follow up series to convert the existing cases that looked like the results of the v1 version of this series but will sit on that until this has had some review given this set is already rather too large. For those I'll probably do some groupings rather than one patch per file.
In the discussion of v1 Paul proposed a change to how pm_ptr() and related macros are defined to remove the need to mark the various functions as __maybe_unused. That culminated in the patch:
which is currently queued up by Rafael in the linux-pm tree for the merge window. This series depends on that patch.
So the main changes since v1:
* Drop all the __maybe_unused markings
* Switch from SIMPLE_DEV_PM_OPS() to DEFINE_SIMPLE_DEV_PM_OPS()
* Switch from SET_RUNTIME_PM_OPS() to RUNTIME_PM_OPS()
* Switch from SET_SYSTEM_SLEEP_PM_OPS() to SYSTEM_SLEEP_PM_OPS()
* Use pm_sleep_ptr() with DEFINE_SIMPLE_DEV_PM_OPS() cases
* Use pm_ptr() with al other cases
* Drop patches change cases where the dev_pm_ops structure is exported to other modules as the compiler can't remove those cases automatically and more thought is needed.
* Add some additional drivers that I'd missed on the first round.
Note this does not cover all cases of CONFIG_PM* in IIO as some are considerably more complicated and this approach may not be suitable.
Overall motivation for the series remains the same as for V1:
* Code reduction and improvement in readability.
* Reduce the chance I'll have to ask people to change how they do this in future drivers (cut and paste fun)
Note that in some cases letting the compiler remove the code results in small reductions in module size, particularly when CONFIG_PM_SLEEP is not defined.
I've kept this at one patch per driver as personally I prefer to do this for all but most trivial of patches as it makes backports that cross with this series simpler (though they will now require the dependency called out above). It also avoids the complexity of tagging when people wish to call out the subset they have reviewed.
Note there are drivers in here where the author has probably moved onto other things, so if people have time to review patches in addition to those I've explicitly cc'd them on that would be great!
Jonathan Cameron (51):
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:accel:kxsd9: Switch from CONFIG_PM guards to pm_ptr() etc
iio:adc:ab8500: Switch from CONFIG_PM guards to pm_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:stm32:Switch from CONFIG_PM guards to pm_ptr()
iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc
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:bh1780: Switch from CONFIG_PM guards to pm_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:light:us5182: Switch from CONFIG_PM guards to pm_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:pulsedlight: Switch from CONFIG_PM guards to pm_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:chemical:atlas: Switch from CONFIG_PM guards to pm_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:light:rpr0521: Switch from CONFIG_PM guards to pm_ptr() etc iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr()
etc
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/kxsd9-i2c.c | 2 +- drivers/iio/accel/kxsd9-spi.c | 2 +- drivers/iio/accel/kxsd9.c | 8 ++------ drivers/iio/accel/mc3230.c | 6 ++---- drivers/iio/accel/mma7660.c | 10 ++-------- drivers/iio/accel/mma9551.c | 11 +++-------- drivers/iio/accel/mma9553.c | 11 +++-------- drivers/iio/accel/stk8312.c | 10 ++-------- drivers/iio/accel/stk8ba50.c | 10 ++-------- drivers/iio/adc/ab8500-gpadc.c | 12 ++++-------- drivers/iio/adc/at91_adc.c | 6 ++---- drivers/iio/adc/exynos_adc.c | 10 ++++------ drivers/iio/adc/palmas_gpadc.c | 10 +++------- drivers/iio/adc/rcar-gyroadc.c | 6 ++---- drivers/iio/adc/rockchip_saradc.c | 6 ++---- drivers/iio/adc/stm32-adc-core.c | 13 +++++-------- drivers/iio/adc/stm32-adc.c | 12 ++++-------- drivers/iio/adc/twl6030-gpadc.c | 8 +++----- drivers/iio/adc/vf610_adc.c | 6 ++---- drivers/iio/chemical/atlas-sensor.c | 7 ++----- drivers/iio/common/ssp_sensors/ssp_dev.c | 8 ++------ drivers/iio/dac/m62332.c | 9 ++------- drivers/iio/dac/vf610_dac.c | 6 ++---- drivers/iio/imu/kmx61.c | 10 +++------- drivers/iio/light/apds9300.c | 9 ++------- drivers/iio/light/bh1780.c | 10 +++------- drivers/iio/light/cm3232.c | 9 ++------- drivers/iio/light/isl29018.c | 9 ++------- drivers/iio/light/isl29125.c | 6 ++---- drivers/iio/light/jsa1212.c | 10 ++-------- drivers/iio/light/ltr501.c | 6 ++---- drivers/iio/light/rpr0521.c | 7 ++----- drivers/iio/light/stk3310.c | 10 ++-------- drivers/iio/light/tcs3414.c | 6 ++---- drivers/iio/light/tcs3472.c | 6 ++---- drivers/iio/light/tsl2563.c | 9 ++------- drivers/iio/light/tsl4531.c | 9 ++------- drivers/iio/light/us5182d.c | 8 +++----- drivers/iio/magnetometer/ak8975.c | 10 +++------- drivers/iio/magnetometer/mag3110.c | 9 ++------- drivers/iio/magnetometer/mmc35240.c | 8 ++------ drivers/iio/pressure/mpl3115.c | 9 ++------- drivers/iio/proximity/as3935.c | 10 ++-------- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 7 ++----- drivers/iio/proximity/rfd77402.c | 6 ++---- drivers/iio/proximity/sx9500.c | 8 ++------ drivers/iio/temperature/mlx90614.c | 12 ++++-------- drivers/iio/temperature/tmp006.c | 6 ++---- drivers/iio/temperature/tmp007.c | 6 ++---- 54 files changed, 127 insertions(+), 315 deletions(-)
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH v2 1/51 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); +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.34.1
Jonathan Cameron
maintainerPATCH v2 2/51 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); +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.34.1
Jonathan Cameron
maintainerPATCH v2 3/51 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
@@ -7,6 +7,7 @@#include <linux/module.h> #include <linux/mod_devicetable.h> +#include <linux/compiler.h> #include <linux/i2c.h> #include <linux/iio/iio.h>
@@ -170,7 +171,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 +199,7 @@ 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 +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.34.1
Jonathan Cameron
maintainerPATCH v2 4/51 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
@@ -7,6 +7,7 @@*/ #include <linux/module.h> +#include <linux/compiler.h> #include <linux/i2c.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h>
@@ -218,7 +219,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 +228,8 @@ 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); +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.34.1
Jonathan Cameron
maintainerPATCH v2 5/51 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); +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.34.1
Jonathan Cameron
maintainerPATCH v2 6/51 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 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/iio/accel/mma7660.c +2 -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,7 @@ 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 +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 +264,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.34.1
Jonathan Cameron
maintainerPATCH v2 7/51 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.34.1
Jonathan Cameron
maintainerPATCH v2 8/51 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.34.1
Jonathan Cameron
maintainerPATCH v2 9/51 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 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/iio/accel/stk8ba50.c +2 -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,7 @@ 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 +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 +540,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.34.1
Jonathan Cameron
maintainerPATCH v2 10/51 iio:accel:kxsd9: 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/kxsd9-i2c.c | 2 +- drivers/iio/accel/kxsd9-spi.c | 2 +- drivers/iio/accel/kxsd9.c | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-)
drivers/iio/accel/kxsd9-i2c.c +1 -1
@@ -55,7 +55,7 @@ static struct i2c_driver kxsd9_i2c_driver = { .driver = { .name = "kxsd9", .of_match_table = kxsd9_of_match, - .pm = &kxsd9_dev_pm_ops, + .pm = pm_ptr(&kxsd9_dev_pm_ops), }, .probe = kxsd9_i2c_probe, .remove = kxsd9_i2c_remove,
drivers/iio/accel/kxsd9-spi.c +1 -1
@@ -54,7 +54,7 @@ MODULE_DEVICE_TABLE(of, kxsd9_of_match);static struct spi_driver kxsd9_spi_driver = { .driver = { .name ="kxsd9" , - .pm = &kxsd9_dev_pm_ops, + .pm =pm_ptr (&kxsd9_dev_pm_ops), .of_match_table = kxsd9_of_match, }, .probe = kxsd9_spi_probe,
drivers/iio/accel/kxsd9.c +2 -6
@@ -492,7 +492,6 @@ void kxsd9_common_remove(struct device *dev) }EXPORT_SYMBOL (kxsd9_common_remove); -#ifdef CONFIG_PM static int kxsd9_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);
@@ -508,13 +507,10 @@ static int kxsd9_runtime_resume(struct device *dev)return kxsd9_power_up (st); } -#endif /* CONFIG_PM */ const struct dev_pm_ops kxsd9_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) -SET_RUNTIME_PM_OPS (kxsd9_runtime_suspend, - kxsd9_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) +RUNTIME_PM_OPS (kxsd9_runtime_suspend, kxsd9_runtime_resume,NULL ) };EXPORT_SYMBOL (kxsd9_dev_pm_ops);
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH v2 11/51 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.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/adc/ab8500-gpadc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/iio/adc/ab8500-gpadc.c +4 -8
@@ -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
@@ -1200,11 +1198,9 @@ static int ab8500_gpadc_remove(struct platform_device *pdev) }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 ) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) +RUNTIME_PM_OPS (ab8500_gpadc_runtime_suspend, + ab8500_gpadc_runtime_resume,NULL ) };static struct platform_driver ab8500_gpadc_driver = {
@@ -1212,7 +1208,7 @@ static struct platform_driver ab8500_gpadc_driver = { .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.34.1
Jonathan Cameron
maintainerPATCH v2 12/51 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/at91_adc.c +2 -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,8 @@ 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); +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 +1384,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.34.1
Jonathan Cameron
maintainerPATCH v2 13/51 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 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/iio/adc/exynos_adc.c +4 -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,10 @@ 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); +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 +1011,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.34.1
Jonathan Cameron
maintainerPATCH v2 14/51 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) -}; +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.34.1
Jonathan Cameron
maintainerPATCH v2 15/51 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.
--- drivers/iio/adc/stm32-adc-core.c | 13 +++++-------- drivers/iio/adc/stm32-adc.c | 12 ++++-------- 2 files changed, 9 insertions(+), 16 deletions(-)
drivers/iio/adc/stm32-adc-core.c +5 -8
@@ -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,14 +781,12 @@ 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) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) +RUNTIME_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 = {
@@ -836,7 +833,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.34.1
Jonathan Cameron
maintainerPATCH v2 16/51 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.34.1
Jonathan Cameron
maintainerPATCH v2 17/51 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/rockchip_saradc.c +2 -4
@@ -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,9 +513,8 @@ static int rockchip_saradc_resume(struct device *dev)return ret; } -#endif -static SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops, +DEFINE_SIMPLE_DEV_PM_OPS (rockchip_saradc_pm_ops, rockchip_saradc_suspend, rockchip_saradc_resume);static struct platform_driver rockchip_saradc_driver = {
@@ -524,7 +522,7 @@ static struct platform_driver rockchip_saradc_driver = { .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.34.1
Jonathan Cameron
maintainerPATCH v2 18/51 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); +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.34.1
Jonathan Cameron
maintainerPATCH v2 19/51 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/vf610_adc.c +2 -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,8 @@ 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); +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 +960,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.34.1
Jonathan Cameron
maintainerPATCH v2 20/51 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) -}; +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.34.1
Jonathan Cameron
maintainerPATCH v2 21/51 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/dac/vf610_dac.c +2 -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,8 @@ 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); +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 +276,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.34.1
Jonathan Cameron
maintainerPATCH v2 22/51 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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/light/apds9300.c +2 -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,7 @@ 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 +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 +504,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.34.1
Jonathan Cameron
maintainerPATCH v2 23/51 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.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/light/bh1780.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/light/bh1780.c +3 -7
@@ -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,13 +255,10 @@ 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 ) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) +RUNTIME_PM_OPS (bh1780_runtime_suspend, bh1780_runtime_resume,NULL ) };static const struct i2c_device_id bh1780_id[] = {
@@ -284,7 +280,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.34.1
Jonathan Cameron
maintainerPATCH v2 24/51 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 +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.34.1
Jonathan Cameron
maintainerPATCH v2 25/51 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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/light/isl29018.c +2 -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,7 @@ 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 +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 +861,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.34.1
Jonathan Cameron
maintainerPATCH v2 26/51 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/isl29125.c +2 -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,8 @@ 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); +DEFINE_SIMPLE_DEV_PM_OPS (isl29125_pm_ops, isl29125_suspend, isl29125_resume);static const struct i2c_device_id isl29125_id[] = { {"isl29125" ,0 },
@@ -339,7 +337,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.34.1
Jonathan Cameron
maintainerPATCH v2 27/51 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 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/iio/light/jsa1212.c +2 -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,7 @@ 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 +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 +437,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.34.1
Jonathan Cameron
maintainerPATCH v2 28/51 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); +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.34.1
Jonathan Cameron
maintainerPATCH v2 29/51 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 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/iio/light/stk3310.c +2 -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,7 @@ 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 +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 +686,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.34.1
Jonathan Cameron
maintainerPATCH v2 30/51 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/tcs3414.c +2 -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,8 @@ 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); +DEFINE_SIMPLE_DEV_PM_OPS (tcs3414_pm_ops, tcs3414_suspend, tcs3414_resume);static const struct i2c_device_id tcs3414_id[] = { {"tcs3414" ,0 },
@@ -373,7 +371,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.34.1
Jonathan Cameron
maintainerPATCH v2 31/51 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/tcs3472.c +2 -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,8 @@ static int tcs3472_resume(struct device *dev)return ret; } -#endif -static SIMPLE_DEV_PM_OPS(tcs3472_pm_ops, tcs3472_suspend, tcs3472_resume); +DEFINE_SIMPLE_DEV_PM_OPS (tcs3472_pm_ops, tcs3472_suspend, tcs3472_resume);static const struct i2c_device_id tcs3472_id[] = { {"tcs3472" ,0 },
@@ -611,7 +609,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.34.1
Jonathan Cameron
maintainerPATCH v2 32/51 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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/light/tsl2563.c +2 -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,7 @@ 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 +DEFINE_SIMPLE_DEV_PM_OPS (tsl2563_pm_ops, tsl2563_suspend, tsl2563_resume);static const struct i2c_device_id tsl2563_id[] = { {"tsl2560" ,0 },
@@ -885,7 +880,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.34.1
Jonathan Cameron
maintainerPATCH v2 33/51 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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/light/tsl4531.c +2 -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,7 @@ 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 +DEFINE_SIMPLE_DEV_PM_OPS (tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume);static const struct i2c_device_id tsl4531_id[] = { {"tsl4531" ,0 },
@@ -242,7 +237,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.34.1
Jonathan Cameron
maintainerPATCH v2 34/51 iio:light:us5182: 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/us5182d.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iio/light/us5182d.c +3 -5
@@ -916,7 +916,6 @@ static int us5182d_remove(struct i2c_client *client)return us5182d_shutdown_en (data,US5182D_CFG0_SHUTDOWN_EN ); } -#if defined(CONFIG_PM_SLEEP ) || defined(CONFIG_PM )static int us5182d_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));
@@ -939,11 +938,10 @@ static int us5182d_resume(struct device *dev)return 0 ; } -#endif static const struct dev_pm_ops us5182d_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) -SET_RUNTIME_PM_OPS (us5182d_suspend, us5182d_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) +RUNTIME_PM_OPS (us5182d_suspend, us5182d_resume,NULL ) };static const struct acpi_device_id us5182d_acpi_match[] = {
@@ -969,7 +967,7 @@ MODULE_DEVICE_TABLE(of, us5182d_of_match);static struct i2c_driver us5182d_driver = { .driver = { .name =US5182D_DRV_NAME , - .pm = &us5182d_pm_ops, + .pm =pm_ptr (&us5182d_pm_ops), .of_match_table = us5182d_of_match, .acpi_match_table =ACPI_PTR (us5182d_acpi_match), },
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerPATCH v2 35/51 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.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/magnetometer/ak8975.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/magnetometer/ak8975.c +3 -7
@@ -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,13 +1073,10 @@ 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 ) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) +RUNTIME_PM_OPS (ak8975_runtime_suspend, ak8975_runtime_resume,NULL ) };static const struct i2c_device_id ak8975_id[] = {
@@ -1113,7 +1109,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.34.1
Jonathan Cameron
maintainerPATCH v2 36/51 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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/magnetometer/mag3110.c +2 -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,7 @@ 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 +DEFINE_SIMPLE_DEV_PM_OPS (mag3110_pm_ops, mag3110_suspend, mag3110_resume);static const struct i2c_device_id mag3110_id[] = { {"mag3110" ,0 },
@@ -645,7 +640,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.34.1
Jonathan Cameron
maintainerPATCH v2 37/51 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 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/iio/magnetometer/mmc35240.c +2 -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,8 @@ 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) -}; +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 +572,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.34.1
Jonathan Cameron
maintainerPATCH v2 38/51 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 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/pressure/mpl3115.c +2 -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,7 @@ 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 +DEFINE_SIMPLE_DEV_PM_OPS (mpl3115_pm_ops, mpl3115_suspend, mpl3115_resume);static const struct i2c_device_id mpl3115_id[] = { {"mpl3115" ,0 },
@@ -339,7 +334,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.34.1
Jonathan Cameron
maintainerPATCH v2 39/51 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 +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.34.1
Jonathan Cameron
maintainerPATCH v2 40/51 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.34.1
Jonathan Cameron
maintainerPATCH v2 41/51 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/proximity/rfd77402.c +2 -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,8 @@ 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); +DEFINE_SIMPLE_DEV_PM_OPS (rfd77402_pm_ops, rfd77402_suspend, rfd77402_resume);static const struct i2c_device_id rfd77402_id[] = { {"rfd77402" ,0 },
@@ -318,7 +316,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.34.1
Jonathan Cameron
maintainerPATCH v2 42/51 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) -}; +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.34.1
Jonathan Cameron
maintainerPATCH v2 43/51 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); +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.34.1
Jonathan Cameron
maintainerPATCH v2 44/51 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); +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.34.1
Jonathan Cameron
maintainerPATCH v2 45/51 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.34.1
Jonathan Cameron
maintainerPATCH v2 46/51 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 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/iio/accel/stk8312.c +2 -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,7 @@ 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 +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 +642,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.34.1
Jonathan Cameron
maintainerPATCH v2 47/51 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 +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.34.1
Jonathan Cameron
maintainerPATCH v2 48/51 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.
Removing instances of this approach from IIO also stops them being copied into new drivers.
--- drivers/iio/dac/m62332.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iio/dac/m62332.c +2 -7
@@ -124,7 +124,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 +155,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 +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 +241,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.34.1
Jonathan Cameron
maintainerPATCH v2 49/51 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.34.1
Jonathan Cameron
maintainerPATCH v2 50/51 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.34.1
Jonathan Cameron
maintainerPATCH v2 51/51 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.34.1
Re: [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan Camerondrivers/iio/accel/da311.c static int da311_resume(struct device *dev) · line 269
Quoted 4 lines · Jonathan Cameron
drivers/iio/accel/da311.c +1
-1-static SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume); +DEFINE_SIMPLE_DEV_PM_OPS (da311_pm_ops, da311_suspend, da311_resume);
Does the new DEFINE_SIMPLE_DEV_PM_OPS imply 'static'? I see that you remove the specifier in all the patches, which would not work otherwise, but I wonder what that
means for drivers that actually define the pm-ops globally on purpose and can't do
that any more after the conversion.
Arnd
Re: [PATCH v2 44/51] iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronQuoted 10 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without
CONFIG_PM_SLEEPsupport 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]>
Thanks,
Mani
Quoted 40 lines
Cc Manivannan Sadhasivam <[email protected]>--- 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); +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.34.1
Jonathan Cameron
maintainerRe: [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Arnd BergmannQuoted 5 lines · On Sun, 2 Jan 2022 09:15:06 -0500 Arnd Bergmann <[email protected]> wrote:
drivers/iio/accel/da311.c static int da311_resume(struct device *dev) · line 269
Quoted 4 lines · Jonathan Cameron
drivers/iio/accel/da311.c +1
-1-static SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume); +DEFINE_SIMPLE_DEV_PM_OPS (da311_pm_ops, da311_suspend, da311_resume);
Hi Arnd,
Quoted 2 lines
Does the new
DEFINE_SIMPLE_DEV_PM_OPSimply 'static'?
It does.
Quoted 6 lines
I see that you remove
the specifier in all the patches, which would not work otherwise, but I wonder what that
means for drivers that actually define the pm-ops globally on purpose and can't do
that any more after the conversion.
That came up in discussion of the patch series introducing this macro
https://lore.kernel.org/linux-pm/20211216110936.6ccd07d3@jic23-huawei/
Most of the cases that don't define it as static
also export the symbol for use by other modules so the approach of letting the compiler detect it as dead code won't always work.
Exceptions from a bit of grepping are net/ethernet/broadcom/bnx2x/ scsi/esas2r/esas2r_init.c
not sure on reasoning behind the file splits in these drivers but definitely looks like it we could just merge a few files and let this be static + the compiler remove it neatly.
vs 17 cases where the symbol is exported and more cleverness will be needed.
Jonathan
Quoted 2 lines
Arnd
Re: [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Quoted 16 lines · Jonathan Cameron
On Sun, 2 Jan 2022 09:15:06 -0500 Arnd Bergmann <[email protected]> wrote:
That came up in discussion of the patch series introducing this macro
https://lore.kernel.org/linux-pm/20211216110936.6ccd07d3@jic23-huawei/Most of the cases that don't define it as static
also export the symbol for use by other modules so the approach of letting the compiler detect it as dead code won't always work.Exceptions from a bit of grepping are
net/ethernet/broadcom/bnx2x/scsi/esas2r/esas2r_init.c
not sure on reasoning behind the file splits in these drivers but definitely looks like it we could just merge a few files and let this be static + the compiler remove it neatly.
Quoted 2 lines
vs 17 cases where the symbol is exported and more cleverness will be needed.
I don't see why exporting the symbol makes a difference at all, either it is needed in another file or it is not.
I think it would be more natural to not include 'static' in the macro, that is certainly what all other macros like this do, and it's still trivial to add 'static' manually, but impossible to remove it.
Arnd
Re: [PATCH v2 42/51] iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronQuoted 7 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without
CONFIG_PM_SLEEPsupport is simpler and less error prone than the use of #ifdef based config guards.
Quoted 5 lines
Removing instances of this approach from IIO also stops them being copied into new drivers.
Signed-off-by Jonathan Cameron <[email protected]>---
Quoted 40 lines
drivers/iio/proximity/sx9500.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/iio/proximity/sx9500.c +2
-7@@ -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) -}; +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, --2.34.1
Re: [PATCH v2 39/51] iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronQuoted 7 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without
CONFIG_PM_SLEEPsupport is simpler and less error prone than the use of #ifdef based config guards.
Quoted 6 lines
Removing instances of this approach from IIO also stops them being copied into new drivers.
Acked-by Matt Ranostay <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>---
To speed the transition to the new PM_OPS macros, we can use cocci to automate the process a little. I had to use sed script so cocci can identify the structure and function names:
find $DIR -type f -name \*.c \ -exec sed -i 's/static SIMPLE_DEV_PM_OPS(\(.*\), */gg_type \1 = gg_arg(/' {} \+ spatch -sp_file no_SIMPLE_DEV_PM_OPS.cocci -dir $DIR | patch -p 1 -d $DIR sed -i 's/gg_type \(.*\) = gg_arg(/DEFINE_SIMPLE_DEV_PM_OPS(\1, /' $(git diff --name-only)
where no_SIMPLE_DEV_PM_OPS.cocci is:
@ Replacement @
identifier operation;
identifier suspend, resume;
@@
gg_type operation = gg_arg(suspend, resume);
@@
identifier Replacement.suspend;
identifier dev;
@@
- __maybe_unusedsuspend(struct device* dev ) { ... }
@@
identifier Replacement.resume;
identifier dev;
@@
- __maybe_unusedresume(struct device* dev ) { ... }
@@
identifier Replacement.operation;
@@
- &operation
+ pm_sleep_ptr(&operation)
Quoted 41 lines
drivers/iio/proximity/as3935.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/iio/proximity/as3935.c +2
-9@@ -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 +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, --2.34.1
Re: [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Arnd BergmannQuoted 17 lines · On Mon, 3 Jan 2022 12:58:46 -0500 Arnd Bergmann <[email protected]> wrote:
Quoted 16 lines · Jonathan Cameron
On Sun, 2 Jan 2022 09:15:06 -0500 Arnd Bergmann <[email protected]> wrote:
That came up in discussion of the patch series introducing this macro
https://lore.kernel.org/linux-pm/20211216110936.6ccd07d3@jic23-huawei/Most of the cases that don't define it as static
also export the symbol for use by other modules so the approach of letting the compiler detect it as dead code won't always work.Exceptions from a bit of grepping are
net/ethernet/broadcom/bnx2x/scsi/esas2r/esas2r_init.c
not sure on reasoning behind the file splits in these drivers but definitely looks like it we could just merge a few files and let this be static + the compiler remove it neatly.
Quoted 5 lines
Quoted 2 lines
vs 17 cases where the symbol is exported and more cleverness will be needed.
I don't see why exporting the symbol makes a difference at all, either it is needed in another file or it is not.
Ah. My reasoning was that the purpose behind that patch set (letting compiler remove the functions etc when unused) was not applicable in EXPORT* cases. However, I'd neglected that the DEFINE_SIMPLE_DEV_PM_OPS() macro is probably useful anyway as those cases would need CONFIG_PM* guards if they want to remove the code when PM stuff isn't enabled.
Quoted 4 lines
I think it would be more natural to not include 'static' in the macro, that is certainly what all other macros like this do, and it's still trivial to add 'static' manually, but impossible to remove it.
IIRC there are other cases like this, but it was exactly this somewhat unusual element that made me raise the question in the original discussion.
Paul, over to you for reasoning. If we are going to change this now is the time before they get significant use and we end up having to add static to lots of places.
Jonathan
Quoted 2 lines
Arnd
Re: [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Quoted 24 lines · Jonathan Cameron
Quoted 20 lines · On Mon, 3 Jan 2022 12:58:46 -0500 Arnd Bergmann <[email protected]> wrote:
Quoted 18 lines · Jonathan Cameron
On Sun, 2 Jan 2022 09:15:06 -0500 Arnd Bergmann <[email protected]> wrote:
That came up in discussion of the patch series introducing this macro
https://lore.kernel.org/linux-pm/20211216110936.6ccd07d3@jic23-huawei/Most of the cases that don't define it as static
also export the symbol for use by other modules so the approach of letting the compiler detect it as dead code won't always work.Exceptions from a bit of grepping are
net/ethernet/broadcom/bnx2x/scsi/esas2r/esas2r_init.c
not sure on reasoning behind the file splits in these drivers but definitely looks like it we could just merge a few files and let this be static + the compiler remove it neatly.vs 17 cases where the symbol is exported and more cleverness will be needed.
Quoted 8 lines
Quoted 2 lines
I don't see why exporting the symbol makes a difference at all, either it is needed in another file or it is not.
Ah. My reasoning was that the purpose behind that patch set (letting compiler remove the functions etc when unused) was not applicable in EXPORT* cases. However, I'd neglected that the
DEFINE_SIMPLE_DEV_PM_OPS()macro is probably useful anyway as those cases would need CONFIG_PM* guards if they want to remove the code when PM stuff isn't enabled.
I agree with Arnd that including "static" in the DEFINE_UNIVERSAL_DEV_PM_OPS and DEFINE_SIMPLE_DEV_PM_OPS is not particularly useful.
Quoted 11 lines
Quoted 4 lines
I think it would be more natural to not include 'static' in the macro, that is certainly what all other macros like this do, and it's still trivial to add 'static' manually, but impossible to remove it.
IIRC there are other cases like this, but it was exactly this somewhat unusual element that made me raise the question in the original discussion.
Paul, over to you for reasoning. If we are going to change this now is the time before they get significant use and we end up having to add static to lots of places.
So please feel free to submit a patch removing these "static" qualifiers from the macros in question or I will do that.
Thanks!
Re: [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronHi,
Quoted 44 lines · Jonathan Cameron
Quoted 22 lines · On Mon, 3 Jan 2022 12:58:46 -0500 Arnd Bergmann <[email protected]> wrote:
Quoted 1 line · Jonathan Cameron
On Sun, 2 Jan 2022 09:15:06 -0500 Arnd Bergmann <[email protected]>
Quoted 2 lines · wrote:
That came up in discussion of the patch series introducing this
macro
Quoted 1 line
https://lore.kernel.org/linux-pm/20211216110936.6ccd07d3@jic23-huawei/
Quoted 3 lines
Most of the cases that don't define it as static
also export the symbol for use by other modules so the approachof letting
Quoted 9 lines
the compiler detect it as dead code won't always work.
Exceptions from a bit of grepping are
net/ethernet/broadcom/bnx2x/scsi/esas2r/esas2r_init.c
not sure on reasoning behind the file splits in these drivers but definitely looks like it we could just merge a few files and let this be static + the compiler remove it neatly.Quoted 6 lines
Quoted 2 lines
vs 17 cases where the symbol is exported and more cleverness will be needed.
I don't see why exporting the symbol makes a difference at all,
either
it is needed in another file or it is not.Ah. My reasoning was that the purpose behind that patch set (letting compiler remove the functions etc when unused) was not applicable in EXPORT* cases. However, I'd neglected that the
DEFINE_SIMPLE_DEV_PM_OPS()macro is probably useful anyway as those cases would need CONFIG_PM* guards if they want to remove the code when PM stuff isn't enabled.Quoted 5 lines
I think it would be more natural to not include 'static' in the
macro,
that is certainly what all other macros like this do, and it's still trivial to add 'static' manually, but impossible to remove it.
Quoted 6 lines
IIRC there are other cases like this, but it was exactly this somewhat unusual element that made me raise the question in the original discussion.
Paul, over to you for reasoning. If we are going to change this now is the time before they get significant use and we end up having to add static to lots of places.
I have an idea on how to tackle automatic dead code removal on exported dev_pm_ops symbols. It means introducing a separate EXPORTED_SIMPLE_DEV_PM_OPS(), so the current DEFINE_SIMPLE_DEV_PM_OPS() macro could keep the "static". Unless you still think it's a bad idea, then in this case we can remove it.
Cheers,
-Paul
Re: [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Quoted 11 lines · Paul Cercueil
Le mar., janv. 4 2022 at 14:16:01 +0000, Jonathan Cameron
Quoted 4 lines
Paul, over to you for reasoning. If we are going to change this now is the time before they get significant use and we end up having to add static to lots of places.
I have an idea on how to tackle automatic dead code removal on exported
dev_pm_opssymbols. It means introducing a separateEXPORTED_SIMPLE_DEV_PM_OPS(), so the currentDEFINE_SIMPLE_DEV_PM_OPS()macro could keep the "static". Unless you still think it's a bad idea, then in this case we can remove it.
I would prefer removing the implicit 'static' if only for consistency reasons, which to me outweighs the simplicity aspect in this case.
Arnd
Re: [PATCH v2 48/51] iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
In reply to Jonathan CameronQuoted 10 lines · On Sun, 2 Jan 2022 12:56:14 +0000 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
Letting the compiler remove these functions when the kernel is built without
CONFIG_PM_SLEEPsupport 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]>
I missed that there were some CONFIG_PM guards around iio_priv()->save that also need dropping. Will do that in v3.
Jonathan
Quoted 38 lines
--- drivers/iio/dac/m62332.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)drivers/iio/dac/m62332.c +2
-7@@ -124,7 +124,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 +155,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 +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 +241,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,
Jonathan Cameron
maintainerRe: [PATCH v2 10/51] iio:accel:kxsd9: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronQuoted 10 lines · On Sun, 2 Jan 2022 12:55:36 +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.Removing instances of this approach from IIO also stops them being copied into new drivers.
Signed-off-by Jonathan Cameron <[email protected]>
I'm going to drop this from v3 because of the clash with the namespace patch that is already on list.
Once that's in I'll post an updated version with the a precursor patch to add new PM macros to export the pm_ops in a namespace.
Jonathan
Quoted 60 lines
--- drivers/iio/accel/kxsd9-i2c.c | 2 +- drivers/iio/accel/kxsd9-spi.c | 2 +- drivers/iio/accel/kxsd9.c | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-)drivers/iio/accel/kxsd9-i2c.c +1
-1@@ -55,7 +55,7 @@ static struct i2c_driver kxsd9_i2c_driver = { .driver = { .name = "kxsd9", .of_match_table = kxsd9_of_match, - .pm = &kxsd9_dev_pm_ops, + .pm = pm_ptr(&kxsd9_dev_pm_ops), }, .probe = kxsd9_i2c_probe, .remove = kxsd9_i2c_remove,drivers/iio/accel/kxsd9-spi.c +1
-1@@ -54,7 +54,7 @@ MODULE_DEVICE_TABLE(of, kxsd9_of_match);static struct spi_driver kxsd9_spi_driver = { .driver = { .name ="kxsd9" , - .pm = &kxsd9_dev_pm_ops, + .pm =pm_ptr (&kxsd9_dev_pm_ops), .of_match_table = kxsd9_of_match, }, .probe = kxsd9_spi_probe,drivers/iio/accel/kxsd9.c +2
-6@@ -492,7 +492,6 @@ void kxsd9_common_remove(struct device *dev) }EXPORT_SYMBOL (kxsd9_common_remove); -#ifdef CONFIG_PM static int kxsd9_runtime_suspend (struct device *dev) {struct iio_dev *indio_dev =dev_get_drvdata (dev);@@ -508,13 +507,10 @@ static int kxsd9_runtime_resume(struct device *dev)return kxsd9_power_up (st); } -#endif /* CONFIG_PM */ const struct dev_pm_ops kxsd9_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) -SET_RUNTIME_PM_OPS (kxsd9_runtime_suspend, - kxsd9_runtime_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) +RUNTIME_PM_OPS (kxsd9_runtime_suspend, kxsd9_runtime_resume,NULL ) };EXPORT_SYMBOL (kxsd9_dev_pm_ops);
Jonathan Cameron
maintainerRe: [PATCH v2 34/51] iio:light:us5182: Switch from CONFIG_PM guards to pm_ptr() etc
In reply to Jonathan CameronQuoted 10 lines · On Sun, 2 Jan 2022 12:56:00 +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.Removing instances of this approach from IIO also stops them being copied into new drivers.
Signed-off-by Jonathan Cameron <[email protected]>
Dropping this (for now) from v3 as need to take a closer look at what we should be doing for the interaction of sleep and runtime pm ops. Probably wants to use the force runtime macros but needs more care than I'm going to give it today!
Jonathan
Quoted 39 lines
--- drivers/iio/light/us5182d.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/iio/light/us5182d.c +3
-5@@ -916,7 +916,6 @@ static int us5182d_remove(struct i2c_client *client)return us5182d_shutdown_en (data,US5182D_CFG0_SHUTDOWN_EN ); } -#if defined(CONFIG_PM_SLEEP ) || defined(CONFIG_PM )static int us5182d_suspend (struct device *dev) {struct iio_dev *indio_dev =i2c_get_clientdata (to_i2c_client (dev));@@ -939,11 +938,10 @@ static int us5182d_resume(struct device *dev)return 0 ; } -#endif static const struct dev_pm_ops us5182d_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) -SET_RUNTIME_PM_OPS (us5182d_suspend, us5182d_resume,NULL ) + SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) +RUNTIME_PM_OPS (us5182d_suspend, us5182d_resume,NULL ) };static const struct acpi_device_id us5182d_acpi_match[] = {@@ -969,7 +967,7 @@ MODULE_DEVICE_TABLE(of, us5182d_of_match);static struct i2c_driver us5182d_driver = { .driver = { .name =US5182D_DRV_NAME , - .pm = &us5182d_pm_ops, + .pm =pm_ptr (&us5182d_pm_ops), .of_match_table = us5182d_of_match, .acpi_match_table =ACPI_PTR (us5182d_acpi_match), },