All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/50]  iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc.
@ 2022-01-30 19:30 Jonathan Cameron
  2022-01-30 19:30 ` [PATCH v3 01/50] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
                   ` (51 more replies)
  0 siblings, 52 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:30 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Alexandre Belloni, Anson Huang, Brian Masney,
	Crt Mori, Fabrice Gasnier, Hans de Goede, Heiko Stuebner,
	Icenowy Zheng, Jonathan Albrieux, Krzysztof Kozlowski,
	Linus Walleij, Luca Weiss, Ludovic Desroches,
	Manivannan Sadhasivam, Martijn Braam, Maslov Dmitry,
	Mikko Koivunen, Olivier Moysan, Stefan-Gabriel Mirea,
	Vaishnav M A

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Note that I have cc'd no one for a number of drivers touched in this
set because we don't have a known active maintainer, so if anyone
has time to sanity check those it would be much appreciated.

Now that Paul Cercueil's rework of the pm_ptr() and related macro magic
to ensure we the compiler can remove unused struct dev_pm_ops and related
functions when either CONFIG_PM_SLEEP is not set or both that and
CONFIG_PM are not set is upstream [1], lets revisit this series of
cleanup of CONFIG_PM* guards in IIO.

Changes since v2:
1) Move to new macros where relevant.
2) Add static as the macros no longer include it
   DEFINE_SIMPLE_DEV_PM_OPS etc.
3) Drop complex cases (I've noted those in reply to v2 so won't
   go into specifics here.  I'll revisit all these but after this massive
   set is in place. Some of these are due to interaction with
   the ongoing namespace work in IIO.
4) Use the new DEFINE_RUNTIME_DEV_PM_OPS for cases where the
   force runtime functions were used for sleep ops.
5) Add a few cases that I'd missed the first time around.

Note that there are some drivers that provide runtime callbacks
but not sleep ones.  The chances are high that it would be
sensible to use the force runtime pm calls for those, but
I considered that a separate change which should potentially be
part of a follow up patch set.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9d8619190031af0a314bee865262d8975473e4dd

Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Anson Huang <anson.huang@nxp.com>
Cc: Brian Masney <masneyb@onstation.org>
Cc: Crt Mori <cmo@melexis.com>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Cc: Icenowy Zheng <icenowy@aosc.io>
Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Luca Weiss <luca@z3ntu.xyz>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Manivannan Sadhasivam <mani@kernel.org>
Cc: Martijn Braam <martijn@brixit.nl>
Cc: Maslov Dmitry <maslovdmitry@seeed.cc>
Cc: Matt Ranostay <matt.ranostay@konsulko.com
Cc: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
Cc: Olivier Moysan <olivier.moysan@foss.st.com>
Cc: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Cc: Vaishnav M A <vaishnav@beagleboard.org>
Jonathan Cameron (50):
  iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:accel:dmard10: Switch from CONFIG_PM guards to pm_sleep_ptr() etc
  iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr()
  iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc
  iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc
  iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr()
  iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr()
  iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr()
  iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc
  iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to
    pm_sleep_ptr() etc
  iio:accel:bma180: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
    etc
  iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc
  iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr()
    etc
  iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc
  iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr()
  iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc
  iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() etc
  iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr()
    etc
  iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc
  iio:light:rpr0521: Switch from CONFIG_PM guards to pm_ptr() etc
  iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm
    __maybe_unused

 drivers/iio/accel/bma180.c                    |  9 ++-------
 drivers/iio/accel/da280.c                     |  6 ++----
 drivers/iio/accel/da311.c                     |  6 ++----
 drivers/iio/accel/dmard06.c                   | 10 +++-------
 drivers/iio/accel/dmard10.c                   |  7 +++----
 drivers/iio/accel/mc3230.c                    |  6 ++----
 drivers/iio/accel/mma7660.c                   | 11 +++--------
 drivers/iio/accel/mma9551.c                   | 11 +++--------
 drivers/iio/accel/mma9553.c                   | 11 +++--------
 drivers/iio/accel/stk8312.c                   | 11 +++--------
 drivers/iio/accel/stk8ba50.c                  | 11 +++--------
 drivers/iio/adc/ab8500-gpadc.c                | 13 +++----------
 drivers/iio/adc/at91_adc.c                    |  7 +++----
 drivers/iio/adc/exynos_adc.c                  |  9 +++------
 drivers/iio/adc/palmas_gpadc.c                | 10 +++-------
 drivers/iio/adc/rcar-gyroadc.c                |  6 ++----
 drivers/iio/adc/rockchip_saradc.c             |  9 ++++-----
 drivers/iio/adc/stm32-adc-core.c              | 17 ++++++-----------
 drivers/iio/adc/stm32-adc.c                   | 12 ++++--------
 drivers/iio/adc/stm32-dfsdm-adc.c             | 11 ++++++-----
 drivers/iio/adc/stm32-dfsdm-core.c            | 19 +++++++++----------
 drivers/iio/adc/twl6030-gpadc.c               |  8 +++-----
 drivers/iio/adc/vf610_adc.c                   |  7 +++----
 drivers/iio/chemical/atlas-sensor.c           |  7 ++-----
 drivers/iio/common/ssp_sensors/ssp_dev.c      |  8 ++------
 drivers/iio/dac/m62332.c                      | 11 ++---------
 drivers/iio/dac/stm32-dac-core.c              | 16 ++++++++--------
 drivers/iio/dac/stm32-dac.c                   |  9 ++++-----
 drivers/iio/dac/vf610_dac.c                   |  7 +++----
 drivers/iio/imu/kmx61.c                       | 10 +++-------
 drivers/iio/light/apds9300.c                  | 10 +++-------
 drivers/iio/light/bh1780.c                    | 12 +++---------
 drivers/iio/light/cm3232.c                    |  9 ++-------
 drivers/iio/light/isl29018.c                  | 10 +++-------
 drivers/iio/light/isl29125.c                  |  7 +++----
 drivers/iio/light/jsa1212.c                   | 11 +++--------
 drivers/iio/light/ltr501.c                    |  6 ++----
 drivers/iio/light/rpr0521.c                   |  7 ++-----
 drivers/iio/light/stk3310.c                   | 11 +++--------
 drivers/iio/light/tcs3414.c                   |  7 +++----
 drivers/iio/light/tcs3472.c                   |  7 +++----
 drivers/iio/light/tsl2563.c                   | 10 +++-------
 drivers/iio/light/tsl4531.c                   | 10 +++-------
 drivers/iio/magnetometer/ak8975.c             | 12 +++---------
 drivers/iio/magnetometer/mag3110.c            | 10 +++-------
 drivers/iio/magnetometer/mmc35240.c           |  9 +++------
 drivers/iio/pressure/mpl3115.c                | 10 +++-------
 drivers/iio/proximity/as3935.c                | 10 ++--------
 .../iio/proximity/pulsedlight-lidar-lite-v2.c |  7 ++-----
 drivers/iio/proximity/rfd77402.c              |  7 +++----
 drivers/iio/proximity/sx9500.c                |  8 ++------
 drivers/iio/temperature/mlx90614.c            | 12 ++++--------
 drivers/iio/temperature/tmp006.c              |  6 ++----
 drivers/iio/temperature/tmp007.c              |  6 ++----
 drivers/iio/trigger/stm32-timer-trigger.c     | 12 ++++++------
 55 files changed, 173 insertions(+), 348 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH v3 01/50] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
@ 2022-01-30 19:30 ` Jonathan Cameron
  2022-01-30 19:30 ` [PATCH v3 02/50] iio:accel:da280: " Jonathan Cameron
                   ` (50 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:30 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/da311.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/accel/da311.c b/drivers/iio/accel/da311.c
index 04e13487e706..ec4e29d260f7 100644
--- a/drivers/iio/accel/da311.c
+++ b/drivers/iio/accel/da311.c
@@ -256,7 +256,6 @@ static int da311_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int da311_suspend(struct device *dev)
 {
 	return da311_enable(to_i2c_client(dev), false);
@@ -266,9 +265,8 @@ static int da311_resume(struct device *dev)
 {
 	return da311_enable(to_i2c_client(dev), true);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume);
 
 static const struct i2c_device_id da311_i2c_id[] = {
 	{"da311", 0},
@@ -279,7 +277,7 @@ MODULE_DEVICE_TABLE(i2c, da311_i2c_id);
 static struct i2c_driver da311_driver = {
 	.driver = {
 		.name = "da311",
-		.pm = &da311_pm_ops,
+		.pm = pm_sleep_ptr(&da311_pm_ops),
 	},
 	.probe		= da311_probe,
 	.id_table	= da311_i2c_id,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 02/50] iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
  2022-01-30 19:30 ` [PATCH v3 01/50] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
@ 2022-01-30 19:30 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 03/50] iio:accel:dmard06: " Jonathan Cameron
                   ` (49 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:30 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/da280.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
index 9633bdae5fd4..04e9c5678964 100644
--- a/drivers/iio/accel/da280.c
+++ b/drivers/iio/accel/da280.c
@@ -153,7 +153,6 @@ static int da280_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int da280_suspend(struct device *dev)
 {
 	return da280_enable(to_i2c_client(dev), false);
@@ -163,9 +162,8 @@ static int da280_resume(struct device *dev)
 {
 	return da280_enable(to_i2c_client(dev), true);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume);
 
 static const struct acpi_device_id da280_acpi_match[] = {
 	{"MIRAACC", da280},
@@ -184,7 +182,7 @@ static struct i2c_driver da280_driver = {
 	.driver = {
 		.name = "da280",
 		.acpi_match_table = ACPI_PTR(da280_acpi_match),
-		.pm = &da280_pm_ops,
+		.pm = pm_sleep_ptr(&da280_pm_ops),
 	},
 	.probe		= da280_probe,
 	.id_table	= da280_i2c_id,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 03/50] iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
  2022-01-30 19:30 ` [PATCH v3 01/50] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
  2022-01-30 19:30 ` [PATCH v3 02/50] iio:accel:da280: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 04/50] iio:accel:dmard10: Switch from CONFIG_PM " Jonathan Cameron
                   ` (48 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/dmard06.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/accel/dmard06.c b/drivers/iio/accel/dmard06.c
index de2868c28d95..4b69c8530f5e 100644
--- a/drivers/iio/accel/dmard06.c
+++ b/drivers/iio/accel/dmard06.c
@@ -170,7 +170,6 @@ static int dmard06_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int dmard06_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -199,11 +198,8 @@ static int dmard06_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend, dmard06_resume);
-#define DMARD06_PM_OPS (&dmard06_pm_ops)
-#else
-#define DMARD06_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend,
+				dmard06_resume);
 
 static const struct i2c_device_id dmard06_id[] = {
 	{ "dmard05", 0 },
@@ -227,7 +223,7 @@ static struct i2c_driver dmard06_driver = {
 	.driver = {
 		.name = DMARD06_DRV_NAME,
 		.of_match_table = dmard06_of_match,
-		.pm = DMARD06_PM_OPS,
+		.pm = pm_sleep_ptr(&dmard06_pm_ops),
 	},
 };
 module_i2c_driver(dmard06_driver);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 04/50] iio:accel:dmard10: Switch from CONFIG_PM guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (2 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 03/50] iio:accel:dmard06: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 05/50] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
                   ` (47 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/dmard10.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/accel/dmard10.c b/drivers/iio/accel/dmard10.c
index f9f173eec202..8ac62ec0a04a 100644
--- a/drivers/iio/accel/dmard10.c
+++ b/drivers/iio/accel/dmard10.c
@@ -218,7 +218,6 @@ static int dmard10_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int dmard10_suspend(struct device *dev)
 {
 	return dmard10_shutdown(to_i2c_client(dev));
@@ -228,9 +227,9 @@ static int dmard10_resume(struct device *dev)
 {
 	return dmard10_reset(to_i2c_client(dev));
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(dmard10_pm_ops, dmard10_suspend, dmard10_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(dmard10_pm_ops, dmard10_suspend,
+				dmard10_resume);
 
 static const struct i2c_device_id dmard10_i2c_id[] = {
 	{"dmard10", 0},
@@ -241,7 +240,7 @@ MODULE_DEVICE_TABLE(i2c, dmard10_i2c_id);
 static struct i2c_driver dmard10_driver = {
 	.driver = {
 		.name = "dmard10",
-		.pm = &dmard10_pm_ops,
+		.pm = pm_sleep_ptr(&dmard10_pm_ops),
 	},
 	.probe		= dmard10_probe,
 	.id_table	= dmard10_i2c_id,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 05/50] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (3 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 04/50] iio:accel:dmard10: Switch from CONFIG_PM " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 06/50] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
                   ` (46 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Hans de Goede

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/iio/accel/mc3230.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/accel/mc3230.c b/drivers/iio/accel/mc3230.c
index 735002b716f3..679e69cd7657 100644
--- a/drivers/iio/accel/mc3230.c
+++ b/drivers/iio/accel/mc3230.c
@@ -160,7 +160,6 @@ static int mc3230_remove(struct i2c_client *client)
 	return mc3230_set_opcon(iio_priv(indio_dev), MC3230_MODE_OPCON_STANDBY);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mc3230_suspend(struct device *dev)
 {
 	struct mc3230_data *data;
@@ -178,9 +177,8 @@ static int mc3230_resume(struct device *dev)
 
 	return mc3230_set_opcon(data, MC3230_MODE_OPCON_WAKE);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume);
 
 static const struct i2c_device_id mc3230_i2c_id[] = {
 	{"mc3230", 0},
@@ -191,7 +189,7 @@ MODULE_DEVICE_TABLE(i2c, mc3230_i2c_id);
 static struct i2c_driver mc3230_driver = {
 	.driver = {
 		.name = "mc3230",
-		.pm = &mc3230_pm_ops,
+		.pm = pm_sleep_ptr(&mc3230_pm_ops),
 	},
 	.probe		= mc3230_probe,
 	.remove		= mc3230_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 06/50] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (4 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 05/50] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 07/50] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
                   ` (45 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/mma7660.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/accel/mma7660.c b/drivers/iio/accel/mma7660.c
index 24b83ccdb950..112a5a33c29f 100644
--- a/drivers/iio/accel/mma7660.c
+++ b/drivers/iio/accel/mma7660.c
@@ -222,7 +222,6 @@ static int mma7660_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mma7660_suspend(struct device *dev)
 {
 	struct mma7660_data *data;
@@ -241,12 +240,8 @@ static int mma7660_resume(struct device *dev)
 	return mma7660_set_mode(data, MMA7660_MODE_ACTIVE);
 }
 
-static SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, mma7660_resume);
-
-#define MMA7660_PM_OPS (&mma7660_pm_ops)
-#else
-#define MMA7660_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend,
+				mma7660_resume);
 
 static const struct i2c_device_id mma7660_i2c_id[] = {
 	{"mma7660", 0},
@@ -270,7 +265,7 @@ MODULE_DEVICE_TABLE(acpi, mma7660_acpi_id);
 static struct i2c_driver mma7660_driver = {
 	.driver = {
 		.name = "mma7660",
-		.pm = MMA7660_PM_OPS,
+		.pm = pm_sleep_ptr(&mma7660_pm_ops),
 		.of_match_table = mma7660_of_match,
 		.acpi_match_table = ACPI_PTR(mma7660_acpi_id),
 	},
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 07/50] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (5 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 06/50] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 08/50] iio:accel:mma9553: " Jonathan Cameron
                   ` (44 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/mma9551.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c
index 4c359fb05480..fb9c8fac5911 100644
--- a/drivers/iio/accel/mma9551.c
+++ b/drivers/iio/accel/mma9551.c
@@ -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,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 08/50] iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (6 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 07/50] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 09/50] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
                   ` (43 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/mma9553.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c
index 0570ab1cc064..673e5c4beefe 100644
--- a/drivers/iio/accel/mma9553.c
+++ b/drivers/iio/accel/mma9553.c
@@ -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,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 09/50] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (7 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 08/50] iio:accel:mma9553: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 10/50] iio:adc:at91-adc: " Jonathan Cameron
                   ` (42 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/stk8ba50.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
index 517c57ed9e94..0067ec5cbae8 100644
--- a/drivers/iio/accel/stk8ba50.c
+++ b/drivers/iio/accel/stk8ba50.c
@@ -504,7 +504,6 @@ static int stk8ba50_remove(struct i2c_client *client)
 	return stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stk8ba50_suspend(struct device *dev)
 {
 	struct stk8ba50_data *data;
@@ -523,12 +522,8 @@ static int stk8ba50_resume(struct device *dev)
 	return stk8ba50_set_power(data, STK8BA50_MODE_NORMAL);
 }
 
-static SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend, stk8ba50_resume);
-
-#define STK8BA50_PM_OPS (&stk8ba50_pm_ops)
-#else
-#define STK8BA50_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend,
+				stk8ba50_resume);
 
 static const struct i2c_device_id stk8ba50_i2c_id[] = {
 	{"stk8ba50", 0},
@@ -546,7 +541,7 @@ MODULE_DEVICE_TABLE(acpi, stk8ba50_acpi_id);
 static struct i2c_driver stk8ba50_driver = {
 	.driver = {
 		.name = "stk8ba50",
-		.pm = STK8BA50_PM_OPS,
+		.pm = pm_sleep_ptr(&stk8ba50_pm_ops),
 		.acpi_match_table = ACPI_PTR(stk8ba50_acpi_id),
 	},
 	.probe =            stk8ba50_probe,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 10/50] iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (8 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 09/50] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 11/50] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
                   ` (41 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Alexandre Belloni, Ludovic Desroches

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 drivers/iio/adc/at91_adc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 5a7d3a3a5fa8..532daaa6f943 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1234,7 +1234,6 @@ static int at91_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int at91_adc_suspend(struct device *dev)
 {
 	struct iio_dev *idev = dev_get_drvdata(dev);
@@ -1256,9 +1255,9 @@ static int at91_adc_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend,
+				at91_adc_resume);
 
 static const struct at91_adc_trigger at91sam9260_triggers[] = {
 	{ .name = "timer-counter-0", .value = 0x1 },
@@ -1386,7 +1385,7 @@ static struct platform_driver at91_adc_driver = {
 	.driver = {
 		   .name = DRIVER_NAME,
 		   .of_match_table = at91_adc_dt_ids,
-		   .pm = &at91_adc_pm_ops,
+		   .pm = pm_sleep_ptr(&at91_adc_pm_ops),
 	},
 };
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 11/50] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (9 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 10/50] iio:adc:at91-adc: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 12/50] iio:adc:palmas_gpadc: " Jonathan Cameron
                   ` (40 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Krzysztof Kozlowski

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/exynos_adc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 3b3868aa2533..cff1ba57fb16 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -968,7 +968,6 @@ static int exynos_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int exynos_adc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -1001,11 +1000,9 @@ static int exynos_adc_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(exynos_adc_pm_ops,
-			exynos_adc_suspend,
-			exynos_adc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(exynos_adc_pm_ops, exynos_adc_suspend,
+				exynos_adc_resume);
 
 static struct platform_driver exynos_adc_driver = {
 	.probe		= exynos_adc_probe,
@@ -1013,7 +1010,7 @@ static struct platform_driver exynos_adc_driver = {
 	.driver		= {
 		.name	= "exynos-adc",
 		.of_match_table = exynos_adc_match,
-		.pm	= &exynos_adc_pm_ops,
+		.pm	= pm_sleep_ptr(&exynos_adc_pm_ops),
 	},
 };
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 12/50] iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (10 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 11/50] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 13/50] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
                   ` (39 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/palmas_gpadc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c
index f9c8385c72d3..61e80bf3d05e 100644
--- a/drivers/iio/adc/palmas_gpadc.c
+++ b/drivers/iio/adc/palmas_gpadc.c
@@ -653,7 +653,6 @@ static int palmas_gpadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc)
 {
 	int adc_period, conv;
@@ -822,12 +821,9 @@ static int palmas_gpadc_resume(struct device *dev)
 
 	return 0;
 };
-#endif
 
-static const struct dev_pm_ops palmas_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(palmas_gpadc_suspend,
-				palmas_gpadc_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(palmas_pm_ops, palmas_gpadc_suspend,
+				palmas_gpadc_resume);
 
 static const struct of_device_id of_palmas_gpadc_match_tbl[] = {
 	{ .compatible = "ti,palmas-gpadc", },
@@ -840,7 +836,7 @@ static struct platform_driver palmas_gpadc_driver = {
 	.remove = palmas_gpadc_remove,
 	.driver = {
 		.name = MOD_NAME,
-		.pm = &palmas_pm_ops,
+		.pm = pm_sleep_ptr(&palmas_pm_ops),
 		.of_match_table = of_palmas_gpadc_match_tbl,
 	},
 };
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 13/50] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (11 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 12/50] iio:adc:palmas_gpadc: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 14/50] iio:adc:twl6030: " Jonathan Cameron
                   ` (38 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Heiko Stuebner

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
---
 drivers/iio/adc/rockchip_saradc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index 14b8df4ca9c8..b87ea7148b58 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -481,7 +481,6 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	return devm_iio_device_register(&pdev->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int rockchip_saradc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -514,17 +513,17 @@ static int rockchip_saradc_resume(struct device *dev)
 
 	return ret;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops,
-			 rockchip_saradc_suspend, rockchip_saradc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops,
+				rockchip_saradc_suspend,
+				rockchip_saradc_resume);
 
 static struct platform_driver rockchip_saradc_driver = {
 	.probe		= rockchip_saradc_probe,
 	.driver		= {
 		.name	= "rockchip-saradc",
 		.of_match_table = rockchip_saradc_match,
-		.pm	= &rockchip_saradc_pm_ops,
+		.pm	= pm_sleep_ptr(&rockchip_saradc_pm_ops),
 	},
 };
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 14/50] iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (12 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 13/50] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 15/50] iio:adc:vf610: " Jonathan Cameron
                   ` (37 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/twl6030-gpadc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
index afdb59e0b526..4966997b5319 100644
--- a/drivers/iio/adc/twl6030-gpadc.c
+++ b/drivers/iio/adc/twl6030-gpadc.c
@@ -944,7 +944,6 @@ static int twl6030_gpadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int twl6030_gpadc_suspend(struct device *pdev)
 {
 	int ret;
@@ -968,17 +967,16 @@ static int twl6030_gpadc_resume(struct device *pdev)
 
 	return 0;
 };
-#endif
 
-static SIMPLE_DEV_PM_OPS(twl6030_gpadc_pm_ops, twl6030_gpadc_suspend,
-					twl6030_gpadc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(twl6030_gpadc_pm_ops, twl6030_gpadc_suspend,
+				twl6030_gpadc_resume);
 
 static struct platform_driver twl6030_gpadc_driver = {
 	.probe		= twl6030_gpadc_probe,
 	.remove		= twl6030_gpadc_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
-		.pm	= &twl6030_gpadc_pm_ops,
+		.pm	= pm_sleep_ptr(&twl6030_gpadc_pm_ops),
 		.of_match_table = of_twl6030_match_tbl,
 	},
 };
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 15/50] iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (13 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 14/50] iio:adc:twl6030: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 16/50] iio:common:ssp: " Jonathan Cameron
                   ` (36 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Stefan-Gabriel Mirea

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
---
 drivers/iio/adc/vf610_adc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c
index fd57fc43e8e5..c84293efc129 100644
--- a/drivers/iio/adc/vf610_adc.c
+++ b/drivers/iio/adc/vf610_adc.c
@@ -912,7 +912,6 @@ static int vf610_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int vf610_adc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -952,9 +951,9 @@ static int vf610_adc_resume(struct device *dev)
 	regulator_disable(info->vref);
 	return ret;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(vf610_adc_pm_ops, vf610_adc_suspend, vf610_adc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(vf610_adc_pm_ops, vf610_adc_suspend,
+				vf610_adc_resume);
 
 static struct platform_driver vf610_adc_driver = {
 	.probe          = vf610_adc_probe,
@@ -962,7 +961,7 @@ static struct platform_driver vf610_adc_driver = {
 	.driver         = {
 		.name   = DRIVER_NAME,
 		.of_match_table = vf610_adc_match,
-		.pm     = &vf610_adc_pm_ops,
+		.pm     = pm_sleep_ptr(&vf610_adc_pm_ops),
 	},
 };
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 16/50] iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (14 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 15/50] iio:adc:vf610: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 17/50] iio:dac:vf610: " Jonathan Cameron
                   ` (35 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/common/ssp_sensors/ssp_dev.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c
index 1aee87100038..49f228836a5c 100644
--- a/drivers/iio/common/ssp_sensors/ssp_dev.c
+++ b/drivers/iio/common/ssp_sensors/ssp_dev.c
@@ -612,7 +612,6 @@ static int ssp_remove(struct spi_device *spi)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ssp_suspend(struct device *dev)
 {
 	int ret;
@@ -661,17 +660,14 @@ static int ssp_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static const struct dev_pm_ops ssp_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(ssp_suspend, ssp_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(ssp_pm_ops, ssp_suspend, ssp_resume);
 
 static struct spi_driver ssp_driver = {
 	.probe = ssp_probe,
 	.remove = ssp_remove,
 	.driver = {
-		.pm = &ssp_pm_ops,
+		.pm = pm_sleep_ptr(&ssp_pm_ops),
 		.of_match_table = of_match_ptr(ssp_of_match),
 		.name = "sensorhub"
 	},
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 17/50] iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (15 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 16/50] iio:common:ssp: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 18/50] iio:light:apds9300: " Jonathan Cameron
                   ` (34 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/dac/vf610_dac.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/dac/vf610_dac.c b/drivers/iio/dac/vf610_dac.c
index 636b4009f763..92429c0d2685 100644
--- a/drivers/iio/dac/vf610_dac.c
+++ b/drivers/iio/dac/vf610_dac.c
@@ -242,7 +242,6 @@ static int vf610_dac_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int vf610_dac_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -268,9 +267,9 @@ static int vf610_dac_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(vf610_dac_pm_ops, vf610_dac_suspend, vf610_dac_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(vf610_dac_pm_ops, vf610_dac_suspend,
+				vf610_dac_resume);
 
 static struct platform_driver vf610_dac_driver = {
 	.probe          = vf610_dac_probe,
@@ -278,7 +277,7 @@ static struct platform_driver vf610_dac_driver = {
 	.driver         = {
 		.name   = "vf610-dac",
 		.of_match_table = vf610_dac_match,
-		.pm     = &vf610_dac_pm_ops,
+		.pm     = pm_sleep_ptr(&vf610_dac_pm_ops),
 	},
 };
 module_platform_driver(vf610_dac_driver);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 18/50] iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (16 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 17/50] iio:dac:vf610: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 19/50] iio:light:cm3232: " Jonathan Cameron
                   ` (33 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/apds9300.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/apds9300.c b/drivers/iio/light/apds9300.c
index baaf202dce05..0f9d77598997 100644
--- a/drivers/iio/light/apds9300.c
+++ b/drivers/iio/light/apds9300.c
@@ -466,7 +466,6 @@ static int apds9300_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int apds9300_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -493,11 +492,8 @@ static int apds9300_resume(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(apds9300_pm_ops, apds9300_suspend, apds9300_resume);
-#define APDS9300_PM_OPS (&apds9300_pm_ops)
-#else
-#define APDS9300_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(apds9300_pm_ops, apds9300_suspend,
+				apds9300_resume);
 
 static const struct i2c_device_id apds9300_id[] = {
 	{ APDS9300_DRV_NAME, 0 },
@@ -509,7 +505,7 @@ MODULE_DEVICE_TABLE(i2c, apds9300_id);
 static struct i2c_driver apds9300_driver = {
 	.driver = {
 		.name	= APDS9300_DRV_NAME,
-		.pm	= APDS9300_PM_OPS,
+		.pm	= pm_sleep_ptr(&apds9300_pm_ops),
 	},
 	.probe		= apds9300_probe,
 	.remove		= apds9300_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 19/50] iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (17 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 18/50] iio:light:apds9300: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 20/50] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
                   ` (32 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/cm3232.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c
index 18a410340dc5..2c80a0535d2c 100644
--- a/drivers/iio/light/cm3232.c
+++ b/drivers/iio/light/cm3232.c
@@ -374,7 +374,6 @@ static const struct i2c_device_id cm3232_id[] = {
 	{}
 };
 
-#ifdef CONFIG_PM_SLEEP
 static int cm3232_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -403,9 +402,7 @@ static int cm3232_resume(struct device *dev)
 	return ret;
 }
 
-static const struct dev_pm_ops cm3232_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(cm3232_suspend, cm3232_resume)};
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(cm3232_pm_ops, cm3232_suspend, cm3232_resume);
 
 MODULE_DEVICE_TABLE(i2c, cm3232_id);
 
@@ -419,9 +416,7 @@ static struct i2c_driver cm3232_driver = {
 	.driver = {
 		.name	= "cm3232",
 		.of_match_table = cm3232_of_match,
-#ifdef CONFIG_PM_SLEEP
-		.pm	= &cm3232_pm_ops,
-#endif
+		.pm	= pm_sleep_ptr(&cm3232_pm_ops),
 	},
 	.id_table	= cm3232_id,
 	.probe		= cm3232_probe,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 20/50] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (18 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 19/50] iio:light:cm3232: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 21/50] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
                   ` (31 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Anson Huang, Brian Masney

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Anson Huang <anson.huang@nxp.com>
Cc: Brian Masney <masneyb@onstation.org>
---
 drivers/iio/light/isl29018.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c
index 2689867467a8..b36f8b7ca68e 100644
--- a/drivers/iio/light/isl29018.c
+++ b/drivers/iio/light/isl29018.c
@@ -784,7 +784,6 @@ static int isl29018_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int isl29018_suspend(struct device *dev)
 {
 	struct isl29018_chip *chip = iio_priv(dev_get_drvdata(dev));
@@ -830,11 +829,8 @@ static int isl29018_resume(struct device *dev)
 	return err;
 }
 
-static SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, isl29018_resume);
-#define ISL29018_PM_OPS (&isl29018_pm_ops)
-#else
-#define ISL29018_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend,
+				isl29018_resume);
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id isl29018_acpi_match[] = {
@@ -866,7 +862,7 @@ static struct i2c_driver isl29018_driver = {
 	.driver	 = {
 			.name = "isl29018",
 			.acpi_match_table = ACPI_PTR(isl29018_acpi_match),
-			.pm = ISL29018_PM_OPS,
+			.pm = pm_sleep_ptr(&isl29018_pm_ops),
 			.of_match_table = isl29018_of_match,
 		    },
 	.probe	 = isl29018_probe,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 21/50] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (19 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 20/50] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 22/50] iio:light:jsa1212: " Jonathan Cameron
                   ` (30 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/isl29125.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c
index ba53b50d711a..eb68a52aab82 100644
--- a/drivers/iio/light/isl29125.c
+++ b/drivers/iio/light/isl29125.c
@@ -311,7 +311,6 @@ static int isl29125_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int isl29125_suspend(struct device *dev)
 {
 	struct isl29125_data *data = iio_priv(i2c_get_clientdata(
@@ -326,9 +325,9 @@ static int isl29125_resume(struct device *dev)
 	return i2c_smbus_write_byte_data(data->client, ISL29125_CONF1,
 		data->conf1);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend, isl29125_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend,
+				isl29125_resume);
 
 static const struct i2c_device_id isl29125_id[] = {
 	{ "isl29125", 0 },
@@ -339,7 +338,7 @@ MODULE_DEVICE_TABLE(i2c, isl29125_id);
 static struct i2c_driver isl29125_driver = {
 	.driver = {
 		.name	= ISL29125_DRV_NAME,
-		.pm	= &isl29125_pm_ops,
+		.pm	= pm_sleep_ptr(&isl29125_pm_ops),
 	},
 	.probe		= isl29125_probe,
 	.remove		= isl29125_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 22/50] iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (20 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 21/50] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 23/50] iio:light:ltr501: " Jonathan Cameron
                   ` (29 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/jsa1212.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/light/jsa1212.c b/drivers/iio/light/jsa1212.c
index 724a0ec9f35c..a55194263d23 100644
--- a/drivers/iio/light/jsa1212.c
+++ b/drivers/iio/light/jsa1212.c
@@ -383,7 +383,6 @@ static int jsa1212_remove(struct i2c_client *client)
 	return jsa1212_power_off(data);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int jsa1212_suspend(struct device *dev)
 {
 	struct jsa1212_data *data;
@@ -421,12 +420,8 @@ static int jsa1212_resume(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(jsa1212_pm_ops, jsa1212_suspend, jsa1212_resume);
-
-#define JSA1212_PM_OPS (&jsa1212_pm_ops)
-#else
-#define JSA1212_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(jsa1212_pm_ops, jsa1212_suspend,
+				jsa1212_resume);
 
 static const struct acpi_device_id jsa1212_acpi_match[] = {
 	{"JSA1212", 0},
@@ -443,7 +438,7 @@ MODULE_DEVICE_TABLE(i2c, jsa1212_id);
 static struct i2c_driver jsa1212_driver = {
 	.driver = {
 		.name	= JSA1212_DRIVER_NAME,
-		.pm	= JSA1212_PM_OPS,
+		.pm	= pm_sleep_ptr(&jsa1212_pm_ops),
 		.acpi_match_table = ACPI_PTR(jsa1212_acpi_match),
 	},
 	.probe		= jsa1212_probe,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 23/50] iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (21 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 22/50] iio:light:jsa1212: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 24/50] iio:light:stk3310: " Jonathan Cameron
                   ` (28 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Maslov Dmitry

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Maslov Dmitry <maslovdmitry@seeed.cc>
---
 drivers/iio/light/ltr501.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index d1532ef5f08b..679a1e1086ae 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -1611,7 +1611,6 @@ static int ltr501_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ltr501_suspend(struct device *dev)
 {
 	struct ltr501_data *data = iio_priv(i2c_get_clientdata(
@@ -1627,9 +1626,8 @@ static int ltr501_resume(struct device *dev)
 	return ltr501_write_contr(data, data->als_contr,
 		data->ps_contr);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume);
 
 static const struct acpi_device_id ltr_acpi_match[] = {
 	{ "LTER0501", ltr501 },
@@ -1661,7 +1659,7 @@ static struct i2c_driver ltr501_driver = {
 	.driver = {
 		.name   = LTR501_DRV_NAME,
 		.of_match_table = ltr501_of_match,
-		.pm	= &ltr501_pm_ops,
+		.pm	= pm_sleep_ptr(&ltr501_pm_ops),
 		.acpi_match_table = ACPI_PTR(ltr_acpi_match),
 	},
 	.probe  = ltr501_probe,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 24/50] iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (22 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 23/50] iio:light:ltr501: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 25/50] iio:light:tcs3414: " Jonathan Cameron
                   ` (27 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Icenowy Zheng, Luca Weiss, Martijn Braam

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Icenowy Zheng <icenowy@aosc.io>
Cc: Luca Weiss <luca@z3ntu.xyz>
Cc: Martijn Braam <martijn@brixit.nl>
---
 drivers/iio/light/stk3310.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
index fc63856ed54d..1d02dfbc29d1 100644
--- a/drivers/iio/light/stk3310.c
+++ b/drivers/iio/light/stk3310.c
@@ -632,7 +632,6 @@ static int stk3310_remove(struct i2c_client *client)
 	return stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stk3310_suspend(struct device *dev)
 {
 	struct stk3310_data *data;
@@ -656,12 +655,8 @@ static int stk3310_resume(struct device *dev)
 	return stk3310_set_state(data, state);
 }
 
-static SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend, stk3310_resume);
-
-#define STK3310_PM_OPS (&stk3310_pm_ops)
-#else
-#define STK3310_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend,
+				stk3310_resume);
 
 static const struct i2c_device_id stk3310_i2c_id[] = {
 	{"STK3310", 0},
@@ -692,7 +687,7 @@ static struct i2c_driver stk3310_driver = {
 	.driver = {
 		.name = "stk3310",
 		.of_match_table = stk3310_of_match,
-		.pm = STK3310_PM_OPS,
+		.pm = pm_sleep_ptr(&stk3310_pm_ops),
 		.acpi_match_table = ACPI_PTR(stk3310_acpi_id),
 	},
 	.probe =            stk3310_probe,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 25/50] iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (23 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 24/50] iio:light:stk3310: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 26/50] iio:light:tcs3472: " Jonathan Cameron
                   ` (26 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/tcs3414.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c
index b87222141429..3951536022b3 100644
--- a/drivers/iio/light/tcs3414.c
+++ b/drivers/iio/light/tcs3414.c
@@ -345,7 +345,6 @@ static int tcs3414_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tcs3414_suspend(struct device *dev)
 {
 	struct tcs3414_data *data = iio_priv(i2c_get_clientdata(
@@ -360,9 +359,9 @@ static int tcs3414_resume(struct device *dev)
 	return i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL,
 		data->control);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(tcs3414_pm_ops, tcs3414_suspend, tcs3414_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tcs3414_pm_ops, tcs3414_suspend,
+				tcs3414_resume);
 
 static const struct i2c_device_id tcs3414_id[] = {
 	{ "tcs3414", 0 },
@@ -373,7 +372,7 @@ MODULE_DEVICE_TABLE(i2c, tcs3414_id);
 static struct i2c_driver tcs3414_driver = {
 	.driver = {
 		.name	= TCS3414_DRV_NAME,
-		.pm	= &tcs3414_pm_ops,
+		.pm	= pm_sleep_ptr(&tcs3414_pm_ops),
 	},
 	.probe		= tcs3414_probe,
 	.id_table	= tcs3414_id,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 26/50] iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (24 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 25/50] iio:light:tcs3414: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 27/50] iio:light:tsl2563: " Jonathan Cameron
                   ` (25 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/tcs3472.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c
index 371c6a39a165..823435f59bb6 100644
--- a/drivers/iio/light/tcs3472.c
+++ b/drivers/iio/light/tcs3472.c
@@ -572,7 +572,6 @@ static int tcs3472_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tcs3472_suspend(struct device *dev)
 {
 	struct tcs3472_data *data = iio_priv(i2c_get_clientdata(
@@ -598,9 +597,9 @@ static int tcs3472_resume(struct device *dev)
 
 	return ret;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(tcs3472_pm_ops, tcs3472_suspend, tcs3472_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tcs3472_pm_ops, tcs3472_suspend,
+				tcs3472_resume);
 
 static const struct i2c_device_id tcs3472_id[] = {
 	{ "tcs3472", 0 },
@@ -611,7 +610,7 @@ MODULE_DEVICE_TABLE(i2c, tcs3472_id);
 static struct i2c_driver tcs3472_driver = {
 	.driver = {
 		.name	= TCS3472_DRV_NAME,
-		.pm	= &tcs3472_pm_ops,
+		.pm	= pm_sleep_ptr(&tcs3472_pm_ops),
 	},
 	.probe		= tcs3472_probe,
 	.remove		= tcs3472_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 27/50] iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (25 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 26/50] iio:light:tcs3472: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 28/50] iio:light:tsl4531: " Jonathan Cameron
                   ` (24 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Vaishnav M A

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Vaishnav M A <vaishnav@beagleboard.org>
---
 drivers/iio/light/tsl2563.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index 5bf2bfbc5379..0a278eea36ca 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -814,7 +814,6 @@ static int tsl2563_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tsl2563_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -857,11 +856,8 @@ static int tsl2563_resume(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(tsl2563_pm_ops, tsl2563_suspend, tsl2563_resume);
-#define TSL2563_PM_OPS (&tsl2563_pm_ops)
-#else
-#define TSL2563_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(tsl2563_pm_ops, tsl2563_suspend,
+				tsl2563_resume);
 
 static const struct i2c_device_id tsl2563_id[] = {
 	{ "tsl2560", 0 },
@@ -885,7 +881,7 @@ static struct i2c_driver tsl2563_i2c_driver = {
 	.driver = {
 		.name	 = "tsl2563",
 		.of_match_table = tsl2563_of_match,
-		.pm	= TSL2563_PM_OPS,
+		.pm	= pm_sleep_ptr(&tsl2563_pm_ops),
 	},
 	.probe		= tsl2563_probe,
 	.remove		= tsl2563_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 28/50] iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (26 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 27/50] iio:light:tsl2563: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 29/50] iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
                   ` (23 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/tsl4531.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/tsl4531.c b/drivers/iio/light/tsl4531.c
index 70505ba6d858..6ae1b27e50b6 100644
--- a/drivers/iio/light/tsl4531.c
+++ b/drivers/iio/light/tsl4531.c
@@ -215,7 +215,6 @@ static int tsl4531_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tsl4531_suspend(struct device *dev)
 {
 	return tsl4531_powerdown(to_i2c_client(dev));
@@ -227,11 +226,8 @@ static int tsl4531_resume(struct device *dev)
 		TSL4531_MODE_NORMAL);
 }
 
-static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume);
-#define TSL4531_PM_OPS (&tsl4531_pm_ops)
-#else
-#define TSL4531_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend,
+				tsl4531_resume);
 
 static const struct i2c_device_id tsl4531_id[] = {
 	{ "tsl4531", 0 },
@@ -242,7 +238,7 @@ MODULE_DEVICE_TABLE(i2c, tsl4531_id);
 static struct i2c_driver tsl4531_driver = {
 	.driver = {
 		.name   = TSL4531_DRV_NAME,
-		.pm	= TSL4531_PM_OPS,
+		.pm	= pm_sleep_ptr(&tsl4531_pm_ops),
 	},
 	.probe  = tsl4531_probe,
 	.remove = tsl4531_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 29/50] iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (27 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 28/50] iio:light:tsl4531: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 30/50] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
                   ` (22 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Matt Ranostay, Jonathan Albrieux,
	Linus Walleij

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM support is simpler and less error prone than the
use of #ifdef based config guards.

Use the new DEFINE_RUNTIME_DEV_PM_OPS() macro to reduce boilerplate.

Removing instances of this approach from IIO also stops them being
copied into new drivers.

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/magnetometer/ak8975.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index 55879a20ae52..088f748b683e 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -1033,7 +1033,6 @@ static int ak8975_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM
 static int ak8975_runtime_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -1074,14 +1073,9 @@ static int ak8975_runtime_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM */
 
-static const struct dev_pm_ops ak8975_dev_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(ak8975_runtime_suspend,
-			   ak8975_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(ak8975_dev_pm_ops, ak8975_runtime_suspend,
+				 ak8975_runtime_resume, NULL);
 
 static const struct i2c_device_id ak8975_id[] = {
 	{"ak8975", AK8975},
@@ -1113,7 +1107,7 @@ MODULE_DEVICE_TABLE(of, ak8975_of_match);
 static struct i2c_driver ak8975_driver = {
 	.driver = {
 		.name	= "ak8975",
-		.pm = &ak8975_dev_pm_ops,
+		.pm = pm_ptr(&ak8975_dev_pm_ops),
 		.of_match_table = ak8975_of_match,
 		.acpi_match_table = ak_acpi_match,
 	},
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 30/50] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (28 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 29/50] iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 31/50] iio:magn:mmc35240: " Jonathan Cameron
                   ` (21 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/magnetometer/mag3110.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
index 17c62d806218..226439d0bfb5 100644
--- a/drivers/iio/magnetometer/mag3110.c
+++ b/drivers/iio/magnetometer/mag3110.c
@@ -573,7 +573,6 @@ static int mag3110_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mag3110_suspend(struct device *dev)
 {
 	struct mag3110_data *data = iio_priv(i2c_get_clientdata(
@@ -623,11 +622,8 @@ static int mag3110_resume(struct device *dev)
 		data->ctrl_reg1);
 }
 
-static SIMPLE_DEV_PM_OPS(mag3110_pm_ops, mag3110_suspend, mag3110_resume);
-#define MAG3110_PM_OPS (&mag3110_pm_ops)
-#else
-#define MAG3110_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mag3110_pm_ops, mag3110_suspend,
+				mag3110_resume);
 
 static const struct i2c_device_id mag3110_id[] = {
 	{ "mag3110", 0 },
@@ -645,7 +641,7 @@ static struct i2c_driver mag3110_driver = {
 	.driver = {
 		.name	= "mag3110",
 		.of_match_table = mag3110_of_match,
-		.pm	= MAG3110_PM_OPS,
+		.pm	= pm_sleep_ptr(&mag3110_pm_ops),
 	},
 	.probe = mag3110_probe,
 	.remove = mag3110_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 31/50] iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (29 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 30/50] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 32/50] iio:pressure:mpl3115: " Jonathan Cameron
                   ` (20 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/magnetometer/mmc35240.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
index 65f3d1ed0d59..186edfcda0b7 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -521,7 +521,6 @@ static int mmc35240_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mmc35240_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -548,11 +547,9 @@ static int mmc35240_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static const struct dev_pm_ops mmc35240_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(mmc35240_suspend, mmc35240_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(mmc35240_pm_ops, mmc35240_suspend,
+				mmc35240_resume);
 
 static const struct of_device_id mmc35240_of_match[] = {
 	{ .compatible = "memsic,mmc35240", },
@@ -576,7 +573,7 @@ static struct i2c_driver mmc35240_driver = {
 	.driver = {
 		.name = MMC35240_DRV_NAME,
 		.of_match_table = mmc35240_of_match,
-		.pm = &mmc35240_pm_ops,
+		.pm = pm_sleep_ptr(&mmc35240_pm_ops),
 		.acpi_match_table = ACPI_PTR(mmc35240_acpi_match),
 	},
 	.probe		= mmc35240_probe,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 32/50] iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (30 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 31/50] iio:magn:mmc35240: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 33/50] iio:proximity:as3935: " Jonathan Cameron
                   ` (19 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/pressure/mpl3115.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c
index e95b9a5475b4..d4f89e4babed 100644
--- a/drivers/iio/pressure/mpl3115.c
+++ b/drivers/iio/pressure/mpl3115.c
@@ -301,7 +301,6 @@ static int mpl3115_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mpl3115_suspend(struct device *dev)
 {
 	return mpl3115_standby(iio_priv(i2c_get_clientdata(
@@ -317,11 +316,8 @@ static int mpl3115_resume(struct device *dev)
 		data->ctrl_reg1);
 }
 
-static SIMPLE_DEV_PM_OPS(mpl3115_pm_ops, mpl3115_suspend, mpl3115_resume);
-#define MPL3115_PM_OPS (&mpl3115_pm_ops)
-#else
-#define MPL3115_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mpl3115_pm_ops, mpl3115_suspend,
+				mpl3115_resume);
 
 static const struct i2c_device_id mpl3115_id[] = {
 	{ "mpl3115", 0 },
@@ -339,7 +335,7 @@ static struct i2c_driver mpl3115_driver = {
 	.driver = {
 		.name	= "mpl3115",
 		.of_match_table = mpl3115_of_match,
-		.pm	= MPL3115_PM_OPS,
+		.pm	= pm_sleep_ptr(&mpl3115_pm_ops),
 	},
 	.probe = mpl3115_probe,
 	.remove = mpl3115_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 33/50] iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (31 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 32/50] iio:pressure:mpl3115: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 34/50] iio:proximity:rfd77492: " Jonathan Cameron
                   ` (18 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Gwendal Grignou, Matt Ranostay

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/proximity/as3935.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index bd7595db31d4..420592a4956f 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -295,7 +295,6 @@ static void calibrate_as3935(struct as3935_state *st)
 	as3935_write(st, AS3935_NFLWDTH, st->nflwdth_reg);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int as3935_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -337,12 +336,7 @@ static int as3935_resume(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume);
-#define AS3935_PM_OPS (&as3935_pm_ops)
-
-#else
-#define AS3935_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume);
 
 static void as3935_stop_work(void *data)
 {
@@ -472,7 +466,7 @@ static struct spi_driver as3935_driver = {
 	.driver = {
 		.name	= "as3935",
 		.of_match_table = as3935_of_match,
-		.pm	= AS3935_PM_OPS,
+		.pm	= pm_sleep_ptr(&as3935_pm_ops),
 	},
 	.probe		= as3935_probe,
 	.id_table	= as3935_id,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 34/50] iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (32 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 33/50] iio:proximity:as3935: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 35/50] iio:proximity:sx9500: " Jonathan Cameron
                   ` (17 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/proximity/rfd77402.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/proximity/rfd77402.c b/drivers/iio/proximity/rfd77402.c
index 0ae91963b570..cb80b3c9d073 100644
--- a/drivers/iio/proximity/rfd77402.c
+++ b/drivers/iio/proximity/rfd77402.c
@@ -295,7 +295,6 @@ static int rfd77402_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int rfd77402_suspend(struct device *dev)
 {
 	return rfd77402_powerdown(to_i2c_client(dev));
@@ -305,9 +304,9 @@ static int rfd77402_resume(struct device *dev)
 {
 	return rfd77402_init(to_i2c_client(dev));
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend, rfd77402_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend,
+				rfd77402_resume);
 
 static const struct i2c_device_id rfd77402_id[] = {
 	{ "rfd77402", 0 },
@@ -318,7 +317,7 @@ MODULE_DEVICE_TABLE(i2c, rfd77402_id);
 static struct i2c_driver rfd77402_driver = {
 	.driver = {
 		.name   = RFD77402_DRV_NAME,
-		.pm     = &rfd77402_pm_ops,
+		.pm     = pm_sleep_ptr(&rfd77402_pm_ops),
 	},
 	.probe  = rfd77402_probe,
 	.id_table = rfd77402_id,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 35/50] iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (33 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 34/50] iio:proximity:rfd77492: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 36/50] iio:temperature:tmp006: " Jonathan Cameron
                   ` (16 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Gwendal Grignou

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/proximity/sx9500.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index 3e4ddb2e8c2b..42589d6200ad 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -993,7 +993,6 @@ static int sx9500_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sx9500_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -1030,11 +1029,8 @@ static int sx9500_resume(struct device *dev)
 
 	return ret;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static const struct dev_pm_ops sx9500_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(sx9500_suspend, sx9500_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(sx9500_pm_ops, sx9500_suspend, sx9500_resume);
 
 static const struct acpi_device_id sx9500_acpi_match[] = {
 	{"SSX9500", 0},
@@ -1060,7 +1056,7 @@ static struct i2c_driver sx9500_driver = {
 		.name	= SX9500_DRIVER_NAME,
 		.acpi_match_table = ACPI_PTR(sx9500_acpi_match),
 		.of_match_table = of_match_ptr(sx9500_of_match),
-		.pm = &sx9500_pm_ops,
+		.pm = pm_sleep_ptr(&sx9500_pm_ops),
 	},
 	.probe		= sx9500_probe,
 	.remove		= sx9500_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 36/50] iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (34 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 35/50] iio:proximity:sx9500: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 37/50] iio:temperature:tmp007: " Jonathan Cameron
                   ` (15 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/temperature/tmp006.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
index e4943a0bc9aa..706a760f30b4 100644
--- a/drivers/iio/temperature/tmp006.c
+++ b/drivers/iio/temperature/tmp006.c
@@ -261,7 +261,6 @@ static int tmp006_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tmp006_suspend(struct device *dev)
 {
 	return tmp006_power(dev, false);
@@ -271,9 +270,8 @@ static int tmp006_resume(struct device *dev)
 {
 	return tmp006_power(dev, true);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume);
 
 static const struct i2c_device_id tmp006_id[] = {
 	{ "tmp006", 0 },
@@ -284,7 +282,7 @@ MODULE_DEVICE_TABLE(i2c, tmp006_id);
 static struct i2c_driver tmp006_driver = {
 	.driver = {
 		.name	= "tmp006",
-		.pm	= &tmp006_pm_ops,
+		.pm	= pm_sleep_ptr(&tmp006_pm_ops),
 	},
 	.probe = tmp006_probe,
 	.id_table = tmp006_id,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 37/50] iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (35 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 36/50] iio:temperature:tmp006: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 38/50] iio:accel:stk8312: " Jonathan Cameron
                   ` (14 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Manivannan Sadhasivam

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/temperature/tmp007.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/temperature/tmp007.c b/drivers/iio/temperature/tmp007.c
index b422371a4674..f3420d8a0e35 100644
--- a/drivers/iio/temperature/tmp007.c
+++ b/drivers/iio/temperature/tmp007.c
@@ -537,7 +537,6 @@ static int tmp007_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tmp007_suspend(struct device *dev)
 {
 	struct tmp007_data *data = iio_priv(i2c_get_clientdata(
@@ -554,9 +553,8 @@ static int tmp007_resume(struct device *dev)
 	return i2c_smbus_write_word_swapped(data->client, TMP007_CONFIG,
 			data->config | TMP007_CONFIG_CONV_EN);
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume);
 
 static const struct of_device_id tmp007_of_match[] = {
 	{ .compatible = "ti,tmp007", },
@@ -574,7 +572,7 @@ static struct i2c_driver tmp007_driver = {
 	.driver = {
 		.name	= "tmp007",
 		.of_match_table = tmp007_of_match,
-		.pm	= &tmp007_pm_ops,
+		.pm	= pm_sleep_ptr(&tmp007_pm_ops),
 	},
 	.probe		= tmp007_probe,
 	.id_table	= tmp007_id,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 38/50] iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (36 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 37/50] iio:temperature:tmp007: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 39/50] iio:accel:bma180: " Jonathan Cameron
                   ` (13 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/stk8312.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c
index de0cdf8c1f94..a71dfff3ca4a 100644
--- a/drivers/iio/accel/stk8312.c
+++ b/drivers/iio/accel/stk8312.c
@@ -611,7 +611,6 @@ static int stk8312_remove(struct i2c_client *client)
 	return stk8312_set_mode(data, STK8312_MODE_STANDBY);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stk8312_suspend(struct device *dev)
 {
 	struct stk8312_data *data;
@@ -630,12 +629,8 @@ static int stk8312_resume(struct device *dev)
 	return stk8312_set_mode(data, data->mode | STK8312_MODE_ACTIVE);
 }
 
-static SIMPLE_DEV_PM_OPS(stk8312_pm_ops, stk8312_suspend, stk8312_resume);
-
-#define STK8312_PM_OPS (&stk8312_pm_ops)
-#else
-#define STK8312_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(stk8312_pm_ops, stk8312_suspend,
+				stk8312_resume);
 
 static const struct i2c_device_id stk8312_i2c_id[] = {
 	/* Deprecated in favour of lowercase form */
@@ -648,7 +643,7 @@ MODULE_DEVICE_TABLE(i2c, stk8312_i2c_id);
 static struct i2c_driver stk8312_driver = {
 	.driver = {
 		.name = STK8312_DRIVER_NAME,
-		.pm = STK8312_PM_OPS,
+		.pm = pm_sleep_ptr(&stk8312_pm_ops),
 	},
 	.probe =            stk8312_probe,
 	.remove =           stk8312_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 39/50] iio:accel:bma180: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (37 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 38/50] iio:accel:stk8312: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 40/50] iio:dac:m62332: " Jonathan Cameron
                   ` (12 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/bma180.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index d8a454c266d5..4f73bc827eec 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -1065,7 +1065,6 @@ static int bma180_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int bma180_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -1092,11 +1091,7 @@ static int bma180_resume(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume);
-#define BMA180_PM_OPS (&bma180_pm_ops)
-#else
-#define BMA180_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume);
 
 static const struct i2c_device_id bma180_ids[] = {
 	{ "bma023", BMA023 },
@@ -1137,7 +1132,7 @@ MODULE_DEVICE_TABLE(of, bma180_of_match);
 static struct i2c_driver bma180_driver = {
 	.driver = {
 		.name	= "bma180",
-		.pm	= BMA180_PM_OPS,
+		.pm	= pm_sleep_ptr(&bma180_pm_ops),
 		.of_match_table = bma180_of_match,
 	},
 	.probe		= bma180_probe,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 40/50] iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (38 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 39/50] iio:accel:bma180: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 41/50] iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc Jonathan Cameron
                   ` (11 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based config guards.

Note that in this case the storage for saving state was protected
by CONFIG_PM guards. The storage is very small and unlikely to make
any real difference to the space allocated for state so just drop
those guards.

Removing instances of this approach from IIO also stops them being
copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/dac/m62332.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/dac/m62332.c b/drivers/iio/dac/m62332.c
index 225b1a374dc1..22b02f50fe41 100644
--- a/drivers/iio/dac/m62332.c
+++ b/drivers/iio/dac/m62332.c
@@ -25,9 +25,7 @@ struct m62332_data {
 	struct regulator	*vcc;
 	struct mutex		mutex;
 	u8			raw[M62332_CHANNELS];
-#ifdef CONFIG_PM_SLEEP
 	u8			save[M62332_CHANNELS];
-#endif
 };
 
 static int m62332_set_value(struct iio_dev *indio_dev, u8 val, int channel)
@@ -124,7 +122,6 @@ static int m62332_write_raw(struct iio_dev *indio_dev,
 	return -EINVAL;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int m62332_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -156,11 +153,7 @@ static int m62332_resume(struct device *dev)
 	return m62332_set_value(indio_dev, data->save[1], 1);
 }
 
-static SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume);
-#define M62332_PM_OPS (&m62332_pm_ops)
-#else
-#define M62332_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume);
 
 static const struct iio_info m62332_info = {
 	.read_raw = m62332_read_raw,
@@ -246,7 +239,7 @@ MODULE_DEVICE_TABLE(i2c, m62332_id);
 static struct i2c_driver m62332_driver = {
 	.driver = {
 		.name	= "m62332",
-		.pm	= M62332_PM_OPS,
+		.pm	= pm_sleep_ptr(&m62332_pm_ops),
 	},
 	.probe		= m62332_probe,
 	.remove		= m62332_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 41/50] iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (39 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 40/50] iio:dac:m62332: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 42/50] iio:temperature:mlx90614: " Jonathan Cameron
                   ` (10 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Letting the compiler remove these functions when the kernel is built
without one or  more of CONFIG_PM/CONFIG_PM_SLEEP support is simpler and
less error prone than the use of #ifdef based config guards.

Removing instances of this approach from IIO also stops them being
copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/imu/kmx61.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
index 1dabfd615dab..20ac1b4c8923 100644
--- a/drivers/iio/imu/kmx61.c
+++ b/drivers/iio/imu/kmx61.c
@@ -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,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 42/50] iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (40 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 41/50] iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-31 13:16   ` Crt Mori
  2022-01-30 19:31 ` [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM " Jonathan Cameron
                   ` (9 subsequent siblings)
  51 siblings, 1 reply; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Crt Mori

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Letting the compiler remove these functions when the kernel is built
without one or  more of CONFIG_PM/CONFIG_PM_SLEEP support is simpler and
less error prone than the use of #ifdef based config guards.

Removing instances of this approach from IIO also stops them being
copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Crt Mori <cmo@melexis.com>
---
 drivers/iio/temperature/mlx90614.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c
index afcb10ea7c44..c253a5315988 100644
--- a/drivers/iio/temperature/mlx90614.c
+++ b/drivers/iio/temperature/mlx90614.c
@@ -600,7 +600,6 @@ static const struct of_device_id mlx90614_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, mlx90614_of_match);
 
-#ifdef CONFIG_PM_SLEEP
 static int mlx90614_pm_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -630,9 +629,7 @@ static int mlx90614_pm_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-#ifdef CONFIG_PM
 static int mlx90614_pm_runtime_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -648,19 +645,18 @@ static int mlx90614_pm_runtime_resume(struct device *dev)
 
 	return mlx90614_wakeup(data);
 }
-#endif
 
 static const struct dev_pm_ops mlx90614_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume)
-	SET_RUNTIME_PM_OPS(mlx90614_pm_runtime_suspend,
-			   mlx90614_pm_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume)
+	RUNTIME_PM_OPS(mlx90614_pm_runtime_suspend,
+		       mlx90614_pm_runtime_resume, NULL)
 };
 
 static struct i2c_driver mlx90614_driver = {
 	.driver = {
 		.name	= "mlx90614",
 		.of_match_table = mlx90614_of_match,
-		.pm	= &mlx90614_pm_ops,
+		.pm	= pm_ptr(&mlx90614_pm_ops),
 	},
 	.probe = mlx90614_probe,
 	.remove = mlx90614_remove,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (41 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 42/50] iio:temperature:mlx90614: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-02-21 19:36   ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 44/50] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() Jonathan Cameron
                   ` (8 subsequent siblings)
  51 siblings, 1 reply; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Linus Walleij

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM support is simpler and less error prone than the
use of #ifdef based config guards.

This case uses the new DEFINE_RUNTIME_DEV_PM_OPS() to reduce
boilerplate.

Removing instances of this approach from IIO also stops them being
copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/adc/ab8500-gpadc.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
index 4c46a201d4ef..78c2bd8bb91d 100644
--- a/drivers/iio/adc/ab8500-gpadc.c
+++ b/drivers/iio/adc/ab8500-gpadc.c
@@ -942,7 +942,6 @@ static const struct iio_info ab8500_gpadc_info = {
 	.read_raw = ab8500_gpadc_read_raw,
 };
 
-#ifdef CONFIG_PM
 static int ab8500_gpadc_runtime_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -965,7 +964,6 @@ static int ab8500_gpadc_runtime_resume(struct device *dev)
 
 	return ret;
 }
-#endif
 
 /**
  * ab8500_gpadc_parse_channel() - process devicetree channel configuration
@@ -1199,20 +1197,15 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct dev_pm_ops ab8500_gpadc_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend,
-			   ab8500_gpadc_runtime_resume,
-			   NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(ab8500_gpadc_runtime_suspend,
+				 ab8500_gpadc_runtime_resume, NULL);
 
 static struct platform_driver ab8500_gpadc_driver = {
 	.probe = ab8500_gpadc_probe,
 	.remove = ab8500_gpadc_remove,
 	.driver = {
 		.name = "ab8500-gpadc",
-		.pm = &ab8500_gpadc_pm_ops,
+		.pm = pm_ptr(&ab8500_gpadc_pm_ops),
 	},
 };
 builtin_platform_driver(ab8500_gpadc_driver);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 44/50] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr()
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (42 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 45/50] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
                   ` (7 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Fabrice Gasnier, Olivier Moysan

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM support is simpler and less error prone than the
use of #ifdef based config guards.

Removing instances of this approach from IIO also stops them being
copied into new drivers.

The new DEFINE_RUNTIME_DEV_PM_OPS() macro reduces boilerplate.

Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Olivier Moysan <olivier.moysan@foss.st.com>
---
 drivers/iio/adc/stm32-adc-core.c | 17 ++++++-----------
 drivers/iio/adc/stm32-adc.c      | 12 ++++--------
 2 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
index b6e18eb101f7..142656232157 100644
--- a/drivers/iio/adc/stm32-adc-core.c
+++ b/drivers/iio/adc/stm32-adc-core.c
@@ -763,7 +763,6 @@ static int stm32_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#if defined(CONFIG_PM)
 static int stm32_adc_core_runtime_suspend(struct device *dev)
 {
 	stm32_adc_core_hw_stop(dev);
@@ -782,15 +781,11 @@ static int stm32_adc_core_runtime_idle(struct device *dev)
 
 	return 0;
 }
-#endif
-
-static const struct dev_pm_ops stm32_adc_core_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(stm32_adc_core_runtime_suspend,
-			   stm32_adc_core_runtime_resume,
-			   stm32_adc_core_runtime_idle)
-};
+
+static DEFINE_RUNTIME_DEV_PM_OPS(stm32_adc_core_pm_ops,
+				stm32_adc_core_runtime_suspend,
+				stm32_adc_core_runtime_resume,
+				stm32_adc_core_runtime_idle);
 
 static const struct stm32_adc_priv_cfg stm32f4_adc_priv_cfg = {
 	.regs = &stm32f4_adc_common_regs,
@@ -836,7 +831,7 @@ static struct platform_driver stm32_adc_driver = {
 	.driver = {
 		.name = "stm32-adc-core",
 		.of_match_table = stm32_adc_of_match,
-		.pm = &stm32_adc_core_pm_ops,
+		.pm = pm_ptr(&stm32_adc_core_pm_ops),
 	},
 };
 module_platform_driver(stm32_adc_driver);
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index 897166d9e45c..a68ecbda6480 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -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);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 45/50] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (43 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 44/50] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 46/50] iio:light:bh1780: " Jonathan Cameron
                   ` (6 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/rcar-gyroadc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
index 727ea6c68049..27d9e147b4b7 100644
--- a/drivers/iio/adc/rcar-gyroadc.c
+++ b/drivers/iio/adc/rcar-gyroadc.c
@@ -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),
 	},
 };
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 46/50] iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (44 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 45/50] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 47/50] iio:proximity:pulsedlight: " Jonathan Cameron
                   ` (5 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Linus Walleij

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM support is simpler and less error prone than the
use of #ifdef based config guards.

Use the new DEFINE_RUNTIME_DEV_PM_OPS to reduce boilerplate.

Removing instances of this approach from IIO also stops them being
copied into new drivers.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/light/bh1780.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c
index abbf2e662e7d..790d3d613979 100644
--- a/drivers/iio/light/bh1780.c
+++ b/drivers/iio/light/bh1780.c
@@ -221,7 +221,6 @@ static int bh1780_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM
 static int bh1780_runtime_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -256,14 +255,9 @@ static int bh1780_runtime_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM */
 
-static const struct dev_pm_ops bh1780_dev_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(bh1780_runtime_suspend,
-			   bh1780_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(bh1780_dev_pm_ops, bh1780_runtime_suspend,
+				bh1780_runtime_resume, NULL);
 
 static const struct i2c_device_id bh1780_id[] = {
 	{ "bh1780", 0 },
@@ -284,7 +278,7 @@ static struct i2c_driver bh1780_driver = {
 	.id_table	= bh1780_id,
 	.driver = {
 		.name = "bh1780",
-		.pm = &bh1780_dev_pm_ops,
+		.pm = pm_ptr(&bh1780_dev_pm_ops),
 		.of_match_table = of_bh1780_match,
 	},
 };
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 47/50] iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (45 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 46/50] iio:light:bh1780: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 48/50] iio:chemical:atlas: " Jonathan Cameron
                   ` (4 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Matt Ranostay

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
index 27026c060ab9..648ae576d6fa 100644
--- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
+++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
@@ -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,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 48/50] iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (46 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 47/50] iio:proximity:pulsedlight: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 49/50] iio:light:rpr0521: " Jonathan Cameron
                   ` (3 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Matt Ranostay

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/chemical/atlas-sensor.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
index a8211dd20b35..56dea9734c8d 100644
--- a/drivers/iio/chemical/atlas-sensor.c
+++ b/drivers/iio/chemical/atlas-sensor.c
@@ -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,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 49/50] iio:light:rpr0521: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (47 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 48/50] iio:chemical:atlas: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-01-30 19:31 ` [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused Jonathan Cameron
                   ` (2 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Mikko Koivunen

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
---
 drivers/iio/light/rpr0521.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c
index c2dd8a3d4217..dabdd05f0e2c 100644
--- a/drivers/iio/light/rpr0521.c
+++ b/drivers/iio/light/rpr0521.c
@@ -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,
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (48 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 49/50] iio:light:rpr0521: " Jonathan Cameron
@ 2022-01-30 19:31 ` Jonathan Cameron
  2022-02-09 14:04   ` Fabrice Gasnier
  2022-01-31 13:33 ` [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Arnd Bergmann
  2022-02-09 11:41 ` Paul Cercueil
  51 siblings, 1 reply; 57+ messages in thread
From: Jonathan Cameron @ 2022-01-30 19:31 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Olivier Moysan, Fabrice Gasnier

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

The combinations of either
* pm_sleep_ptr() and DEFINE_SIMPLE_DEV_PM_OPS()
* pm_ptr() and RUNTIME_PM_OPS()/SYSTEM_SLEEP_PM_OPS
Make sure the functions are always visible to the compiler and removed by
it rather than requring #ifdef magic.

This removes the need to mark the functions as __maybe_unused and saves
additional space with some build options as the dev_pm_ops structure
itself can be dropped automatically if CONFIG_PM is not enabled.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Olivier Moysan <olivier.moysan@st.com>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
---
 drivers/iio/adc/stm32-dfsdm-adc.c         | 11 ++++++-----
 drivers/iio/adc/stm32-dfsdm-core.c        | 19 +++++++++----------
 drivers/iio/dac/stm32-dac-core.c          | 16 ++++++++--------
 drivers/iio/dac/stm32-dac.c               |  9 ++++-----
 drivers/iio/trigger/stm32-timer-trigger.c | 12 ++++++------
 5 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
index 1cfefb3b5e56..9704cf0b9753 100644
--- a/drivers/iio/adc/stm32-dfsdm-adc.c
+++ b/drivers/iio/adc/stm32-dfsdm-adc.c
@@ -1632,7 +1632,7 @@ static int stm32_dfsdm_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused stm32_dfsdm_adc_suspend(struct device *dev)
+static int stm32_dfsdm_adc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
@@ -1642,7 +1642,7 @@ static int __maybe_unused stm32_dfsdm_adc_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused stm32_dfsdm_adc_resume(struct device *dev)
+static int stm32_dfsdm_adc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
@@ -1665,14 +1665,15 @@ static int __maybe_unused stm32_dfsdm_adc_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(stm32_dfsdm_adc_pm_ops,
-			 stm32_dfsdm_adc_suspend, stm32_dfsdm_adc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stm32_dfsdm_adc_pm_ops,
+				stm32_dfsdm_adc_suspend,
+				stm32_dfsdm_adc_resume);
 
 static struct platform_driver stm32_dfsdm_adc_driver = {
 	.driver = {
 		.name = "stm32-dfsdm-adc",
 		.of_match_table = stm32_dfsdm_adc_match,
-		.pm = &stm32_dfsdm_adc_pm_ops,
+		.pm = pm_sleep_ptr(&stm32_dfsdm_adc_pm_ops),
 	},
 	.probe = stm32_dfsdm_adc_probe,
 	.remove = stm32_dfsdm_adc_remove,
diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c
index a627af9a825e..a3d4de6ba4c2 100644
--- a/drivers/iio/adc/stm32-dfsdm-core.c
+++ b/drivers/iio/adc/stm32-dfsdm-core.c
@@ -381,7 +381,7 @@ static int stm32_dfsdm_core_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused stm32_dfsdm_core_suspend(struct device *dev)
+static int stm32_dfsdm_core_suspend(struct device *dev)
 {
 	struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev);
 	struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm);
@@ -397,7 +397,7 @@ static int __maybe_unused stm32_dfsdm_core_suspend(struct device *dev)
 	return pinctrl_pm_select_sleep_state(dev);
 }
 
-static int __maybe_unused stm32_dfsdm_core_resume(struct device *dev)
+static int stm32_dfsdm_core_resume(struct device *dev)
 {
 	struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev);
 	struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm);
@@ -414,7 +414,7 @@ static int __maybe_unused stm32_dfsdm_core_resume(struct device *dev)
 	return pm_runtime_force_resume(dev);
 }
 
-static int __maybe_unused stm32_dfsdm_core_runtime_suspend(struct device *dev)
+static int stm32_dfsdm_core_runtime_suspend(struct device *dev)
 {
 	struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev);
 
@@ -423,7 +423,7 @@ static int __maybe_unused stm32_dfsdm_core_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused stm32_dfsdm_core_runtime_resume(struct device *dev)
+static int stm32_dfsdm_core_runtime_resume(struct device *dev)
 {
 	struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev);
 
@@ -431,11 +431,10 @@ static int __maybe_unused stm32_dfsdm_core_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops stm32_dfsdm_core_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(stm32_dfsdm_core_suspend,
-				stm32_dfsdm_core_resume)
-	SET_RUNTIME_PM_OPS(stm32_dfsdm_core_runtime_suspend,
-			   stm32_dfsdm_core_runtime_resume,
-			   NULL)
+	SYSTEM_SLEEP_PM_OPS(stm32_dfsdm_core_suspend, stm32_dfsdm_core_resume)
+	RUNTIME_PM_OPS(stm32_dfsdm_core_runtime_suspend,
+		       stm32_dfsdm_core_runtime_resume,
+		       NULL)
 };
 
 static struct platform_driver stm32_dfsdm_driver = {
@@ -444,7 +443,7 @@ static struct platform_driver stm32_dfsdm_driver = {
 	.driver = {
 		.name = "stm32-dfsdm",
 		.of_match_table = stm32_dfsdm_of_match,
-		.pm = &stm32_dfsdm_core_pm_ops,
+		.pm = pm_ptr(&stm32_dfsdm_core_pm_ops),
 	},
 };
 
diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
index bd7a3b20e645..83bf184e3adc 100644
--- a/drivers/iio/dac/stm32-dac-core.c
+++ b/drivers/iio/dac/stm32-dac-core.c
@@ -195,7 +195,7 @@ static int stm32_dac_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused stm32_dac_core_resume(struct device *dev)
+static int stm32_dac_core_resume(struct device *dev)
 {
 	struct stm32_dac_common *common = dev_get_drvdata(dev);
 	struct stm32_dac_priv *priv = to_stm32_dac_priv(common);
@@ -213,23 +213,23 @@ static int __maybe_unused stm32_dac_core_resume(struct device *dev)
 	return pm_runtime_force_resume(dev);
 }
 
-static int __maybe_unused stm32_dac_core_runtime_suspend(struct device *dev)
+static int stm32_dac_core_runtime_suspend(struct device *dev)
 {
 	stm32_dac_core_hw_stop(dev);
 
 	return 0;
 }
 
-static int __maybe_unused stm32_dac_core_runtime_resume(struct device *dev)
+static int stm32_dac_core_runtime_resume(struct device *dev)
 {
 	return stm32_dac_core_hw_start(dev);
 }
 
 static const struct dev_pm_ops stm32_dac_core_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, stm32_dac_core_resume)
-	SET_RUNTIME_PM_OPS(stm32_dac_core_runtime_suspend,
-			   stm32_dac_core_runtime_resume,
-			   NULL)
+	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, stm32_dac_core_resume)
+	RUNTIME_PM_OPS(stm32_dac_core_runtime_suspend,
+		       stm32_dac_core_runtime_resume,
+		       NULL)
 };
 
 static const struct stm32_dac_cfg stm32h7_dac_cfg = {
@@ -253,7 +253,7 @@ static struct platform_driver stm32_dac_driver = {
 	.driver = {
 		.name = "stm32-dac-core",
 		.of_match_table = stm32_dac_of_match,
-		.pm = &stm32_dac_core_pm_ops,
+		.pm = pm_ptr(&stm32_dac_core_pm_ops),
 	},
 };
 module_platform_driver(stm32_dac_driver);
diff --git a/drivers/iio/dac/stm32-dac.c b/drivers/iio/dac/stm32-dac.c
index cd71cc4553a7..b20192a071cb 100644
--- a/drivers/iio/dac/stm32-dac.c
+++ b/drivers/iio/dac/stm32-dac.c
@@ -372,7 +372,7 @@ static int stm32_dac_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused stm32_dac_suspend(struct device *dev)
+static int stm32_dac_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	int channel = indio_dev->channels[0].channel;
@@ -386,9 +386,8 @@ static int __maybe_unused stm32_dac_suspend(struct device *dev)
 	return pm_runtime_force_suspend(dev);
 }
 
-static const struct dev_pm_ops stm32_dac_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(stm32_dac_suspend, pm_runtime_force_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(stm32_dac_pm_ops, stm32_dac_suspend,
+				pm_runtime_force_resume);
 
 static const struct of_device_id stm32_dac_of_match[] = {
 	{ .compatible = "st,stm32-dac", },
@@ -402,7 +401,7 @@ static struct platform_driver stm32_dac_driver = {
 	.driver = {
 		.name = "stm32-dac",
 		.of_match_table = stm32_dac_of_match,
-		.pm = &stm32_dac_pm_ops,
+		.pm = pm_sleep_ptr(&stm32_dac_pm_ops),
 	},
 };
 module_platform_driver(stm32_dac_driver);
diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
index 4f9461e1412c..d72ac4c0bca4 100644
--- a/drivers/iio/trigger/stm32-timer-trigger.c
+++ b/drivers/iio/trigger/stm32-timer-trigger.c
@@ -827,7 +827,7 @@ static int stm32_timer_trigger_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused stm32_timer_trigger_suspend(struct device *dev)
+static int stm32_timer_trigger_suspend(struct device *dev)
 {
 	struct stm32_timer_trigger *priv = dev_get_drvdata(dev);
 
@@ -849,7 +849,7 @@ static int __maybe_unused stm32_timer_trigger_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused stm32_timer_trigger_resume(struct device *dev)
+static int stm32_timer_trigger_resume(struct device *dev)
 {
 	struct stm32_timer_trigger *priv = dev_get_drvdata(dev);
 	int ret;
@@ -875,9 +875,9 @@ static int __maybe_unused stm32_timer_trigger_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(stm32_timer_trigger_pm_ops,
-			 stm32_timer_trigger_suspend,
-			 stm32_timer_trigger_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stm32_timer_trigger_pm_ops,
+				stm32_timer_trigger_suspend,
+				stm32_timer_trigger_resume);
 
 static const struct stm32_timer_trigger_cfg stm32_timer_trg_cfg = {
 	.valids_table = valids_table,
@@ -907,7 +907,7 @@ static struct platform_driver stm32_timer_trigger_driver = {
 	.driver = {
 		.name = "stm32-timer-trigger",
 		.of_match_table = stm32_trig_of_match,
-		.pm = &stm32_timer_trigger_pm_ops,
+		.pm = pm_sleep_ptr(&stm32_timer_trigger_pm_ops),
 	},
 };
 module_platform_driver(stm32_timer_trigger_driver);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* Re: [PATCH v3 42/50] iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr() etc
  2022-01-30 19:31 ` [PATCH v3 42/50] iio:temperature:mlx90614: " Jonathan Cameron
@ 2022-01-31 13:16   ` Crt Mori
  0 siblings, 0 replies; 57+ messages in thread
From: Crt Mori @ 2022-01-31 13:16 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron

Reviewed-by: Crt Mori <cmo@melexis.com>

I don't have setup ready for a quick test of this, but it is
consistent with other changes.

Best regards,
Crt


On Sun, 30 Jan 2022 at 20:27, Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Letting the compiler remove these functions when the kernel is built
> without one or  more of CONFIG_PM/CONFIG_PM_SLEEP support is simpler and
> less error prone than the use of #ifdef based config guards.
>
> Removing instances of this approach from IIO also stops them being
> copied into new drivers.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Crt Mori <cmo@melexis.com>
> ---
>  drivers/iio/temperature/mlx90614.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c
> index afcb10ea7c44..c253a5315988 100644
> --- a/drivers/iio/temperature/mlx90614.c
> +++ b/drivers/iio/temperature/mlx90614.c
> @@ -600,7 +600,6 @@ static const struct of_device_id mlx90614_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, mlx90614_of_match);
>
> -#ifdef CONFIG_PM_SLEEP
>  static int mlx90614_pm_suspend(struct device *dev)
>  {
>         struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> @@ -630,9 +629,7 @@ static int mlx90614_pm_resume(struct device *dev)
>
>         return 0;
>  }
> -#endif
>
> -#ifdef CONFIG_PM
>  static int mlx90614_pm_runtime_suspend(struct device *dev)
>  {
>         struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> @@ -648,19 +645,18 @@ static int mlx90614_pm_runtime_resume(struct device *dev)
>
>         return mlx90614_wakeup(data);
>  }
> -#endif
>
>  static const struct dev_pm_ops mlx90614_pm_ops = {
> -       SET_SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume)
> -       SET_RUNTIME_PM_OPS(mlx90614_pm_runtime_suspend,
> -                          mlx90614_pm_runtime_resume, NULL)
> +       SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume)
> +       RUNTIME_PM_OPS(mlx90614_pm_runtime_suspend,
> +                      mlx90614_pm_runtime_resume, NULL)
>  };
>
>  static struct i2c_driver mlx90614_driver = {
>         .driver = {
>                 .name   = "mlx90614",
>                 .of_match_table = mlx90614_of_match,
> -               .pm     = &mlx90614_pm_ops,
> +               .pm     = pm_ptr(&mlx90614_pm_ops),
>         },
>         .probe = mlx90614_probe,
>         .remove = mlx90614_remove,
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc.
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (49 preceding siblings ...)
  2022-01-30 19:31 ` [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused Jonathan Cameron
@ 2022-01-31 13:33 ` Arnd Bergmann
  2022-02-09 11:41 ` Paul Cercueil
  51 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-01-31 13:33 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Alexandre Belloni, Anson Huang, Brian Masney,
	Crt Mori, Fabrice Gasnier, Hans de Goede, Heiko Stuebner,
	Icenowy Zheng, Jonathan Albrieux, Krzysztof Kozlowski,
	Linus Walleij, Luca Weiss, Ludovic Desroches,
	Manivannan Sadhasivam, Martijn Braam, Maslov Dmitry,
	Mikko Koivunen, Olivier Moysan, Stefan-Gabriel Mirea,
	Vaishnav M A

On Sun, Jan 30, 2022 at 8:30 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Note that I have cc'd no one for a number of drivers touched in this
> set because we don't have a known active maintainer, so if anyone
> has time to sanity check those it would be much appreciated.
>
> Now that Paul Cercueil's rework of the pm_ptr() and related macro magic
> to ensure we the compiler can remove unused struct dev_pm_ops and related
> functions when either CONFIG_PM_SLEEP is not set or both that and
> CONFIG_PM are not set is upstream [1], lets revisit this series of
> cleanup of CONFIG_PM* guards in IIO.

I have not done an in-depth review of any particular patch, but I have
glanced over all of them and I am perfectly happy with this version, and
I'd say you should just put them into linux-next once no more Acks
come in. If anything breaks, it can be fixed on top.

        Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH v3 00/50]  iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc.
  2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
                   ` (50 preceding siblings ...)
  2022-01-31 13:33 ` [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Arnd Bergmann
@ 2022-02-09 11:41 ` Paul Cercueil
  2022-02-18 11:47   ` Jonathan Cameron
  51 siblings, 1 reply; 57+ messages in thread
From: Paul Cercueil @ 2022-02-09 11:41 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron,
	Alexandre Belloni, Anson Huang, Brian Masney, Crt Mori,
	Fabrice Gasnier, Hans de Goede, Heiko Stuebner, Icenowy Zheng,
	Jonathan Albrieux, Krzysztof Kozlowski, Linus Walleij,
	Luca Weiss, Ludovic Desroches, Manivannan Sadhasivam,
	Martijn Braam, Maslov Dmitry, Mikko Koivunen, Olivier Moysan,
	Stefan-Gabriel Mirea, Vaishnav M A

Hi Jonathan,

Reviewed-by: Paul Cercueil <paul@crapouillou.net>

for the whole series.

Cheers,
-Paul


Le dim., janv. 30 2022 at 19:30:57 +0000, Jonathan Cameron 
<jic23@kernel.org> a écrit :
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Note that I have cc'd no one for a number of drivers touched in this
> set because we don't have a known active maintainer, so if anyone
> has time to sanity check those it would be much appreciated.
> 
> Now that Paul Cercueil's rework of the pm_ptr() and related macro 
> magic
> to ensure we the compiler can remove unused struct dev_pm_ops and 
> related
> functions when either CONFIG_PM_SLEEP is not set or both that and
> CONFIG_PM are not set is upstream [1], lets revisit this series of
> cleanup of CONFIG_PM* guards in IIO.
> 
> Changes since v2:
> 1) Move to new macros where relevant.
> 2) Add static as the macros no longer include it
>    DEFINE_SIMPLE_DEV_PM_OPS etc.
> 3) Drop complex cases (I've noted those in reply to v2 so won't
>    go into specifics here.  I'll revisit all these but after this 
> massive
>    set is in place. Some of these are due to interaction with
>    the ongoing namespace work in IIO.
> 4) Use the new DEFINE_RUNTIME_DEV_PM_OPS for cases where the
>    force runtime functions were used for sleep ops.
> 5) Add a few cases that I'd missed the first time around.
> 
> Note that there are some drivers that provide runtime callbacks
> but not sleep ones.  The chances are high that it would be
> sensible to use the force runtime pm calls for those, but
> I considered that a separate change which should potentially be
> part of a follow up patch set.
> 
> [1] 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9d8619190031af0a314bee865262d8975473e4dd
> 
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Anson Huang <anson.huang@nxp.com>
> Cc: Brian Masney <masneyb@onstation.org>
> Cc: Crt Mori <cmo@melexis.com>
> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> Cc: Icenowy Zheng <icenowy@aosc.io>
> Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Luca Weiss <luca@z3ntu.xyz>
> Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
> Cc: Manivannan Sadhasivam <mani@kernel.org>
> Cc: Martijn Braam <martijn@brixit.nl>
> Cc: Maslov Dmitry <maslovdmitry@seeed.cc>
> Cc: Matt Ranostay <matt.ranostay@konsulko.com
> Cc: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
> Cc: Olivier Moysan <olivier.moysan@foss.st.com>
> Cc: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
> Cc: Vaishnav M A <vaishnav@beagleboard.org>
> Jonathan Cameron (50):
>   iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:accel:dmard10: Switch from CONFIG_PM guards to pm_sleep_ptr() 
> etc
>   iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr()
>   iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr()
>   iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr()
>   iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
>     etc
>   iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
>     etc
>   iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
>     etc
>   iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr()
>   iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to
>     pm_sleep_ptr() etc
>   iio:accel:bma180: Switch from CONFIG_PM_SLEEP guards to 
> pm_sleep_ptr()
>     etc
>   iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
>     etc
>   iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc
>   iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr()
>     etc
>   iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr()
>   iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr()
>     etc
>   iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio:light:rpr0521: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm
>     __maybe_unused
> 
>  drivers/iio/accel/bma180.c                    |  9 ++-------
>  drivers/iio/accel/da280.c                     |  6 ++----
>  drivers/iio/accel/da311.c                     |  6 ++----
>  drivers/iio/accel/dmard06.c                   | 10 +++-------
>  drivers/iio/accel/dmard10.c                   |  7 +++----
>  drivers/iio/accel/mc3230.c                    |  6 ++----
>  drivers/iio/accel/mma7660.c                   | 11 +++--------
>  drivers/iio/accel/mma9551.c                   | 11 +++--------
>  drivers/iio/accel/mma9553.c                   | 11 +++--------
>  drivers/iio/accel/stk8312.c                   | 11 +++--------
>  drivers/iio/accel/stk8ba50.c                  | 11 +++--------
>  drivers/iio/adc/ab8500-gpadc.c                | 13 +++----------
>  drivers/iio/adc/at91_adc.c                    |  7 +++----
>  drivers/iio/adc/exynos_adc.c                  |  9 +++------
>  drivers/iio/adc/palmas_gpadc.c                | 10 +++-------
>  drivers/iio/adc/rcar-gyroadc.c                |  6 ++----
>  drivers/iio/adc/rockchip_saradc.c             |  9 ++++-----
>  drivers/iio/adc/stm32-adc-core.c              | 17 ++++++-----------
>  drivers/iio/adc/stm32-adc.c                   | 12 ++++--------
>  drivers/iio/adc/stm32-dfsdm-adc.c             | 11 ++++++-----
>  drivers/iio/adc/stm32-dfsdm-core.c            | 19 
> +++++++++----------
>  drivers/iio/adc/twl6030-gpadc.c               |  8 +++-----
>  drivers/iio/adc/vf610_adc.c                   |  7 +++----
>  drivers/iio/chemical/atlas-sensor.c           |  7 ++-----
>  drivers/iio/common/ssp_sensors/ssp_dev.c      |  8 ++------
>  drivers/iio/dac/m62332.c                      | 11 ++---------
>  drivers/iio/dac/stm32-dac-core.c              | 16 ++++++++--------
>  drivers/iio/dac/stm32-dac.c                   |  9 ++++-----
>  drivers/iio/dac/vf610_dac.c                   |  7 +++----
>  drivers/iio/imu/kmx61.c                       | 10 +++-------
>  drivers/iio/light/apds9300.c                  | 10 +++-------
>  drivers/iio/light/bh1780.c                    | 12 +++---------
>  drivers/iio/light/cm3232.c                    |  9 ++-------
>  drivers/iio/light/isl29018.c                  | 10 +++-------
>  drivers/iio/light/isl29125.c                  |  7 +++----
>  drivers/iio/light/jsa1212.c                   | 11 +++--------
>  drivers/iio/light/ltr501.c                    |  6 ++----
>  drivers/iio/light/rpr0521.c                   |  7 ++-----
>  drivers/iio/light/stk3310.c                   | 11 +++--------
>  drivers/iio/light/tcs3414.c                   |  7 +++----
>  drivers/iio/light/tcs3472.c                   |  7 +++----
>  drivers/iio/light/tsl2563.c                   | 10 +++-------
>  drivers/iio/light/tsl4531.c                   | 10 +++-------
>  drivers/iio/magnetometer/ak8975.c             | 12 +++---------
>  drivers/iio/magnetometer/mag3110.c            | 10 +++-------
>  drivers/iio/magnetometer/mmc35240.c           |  9 +++------
>  drivers/iio/pressure/mpl3115.c                | 10 +++-------
>  drivers/iio/proximity/as3935.c                | 10 ++--------
>  .../iio/proximity/pulsedlight-lidar-lite-v2.c |  7 ++-----
>  drivers/iio/proximity/rfd77402.c              |  7 +++----
>  drivers/iio/proximity/sx9500.c                |  8 ++------
>  drivers/iio/temperature/mlx90614.c            | 12 ++++--------
>  drivers/iio/temperature/tmp006.c              |  6 ++----
>  drivers/iio/temperature/tmp007.c              |  6 ++----
>  drivers/iio/trigger/stm32-timer-trigger.c     | 12 ++++++------
>  55 files changed, 173 insertions(+), 348 deletions(-)
> 
> --
> 2.35.1
> 



^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused
  2022-01-30 19:31 ` [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused Jonathan Cameron
@ 2022-02-09 14:04   ` Fabrice Gasnier
  0 siblings, 0 replies; 57+ messages in thread
From: Fabrice Gasnier @ 2022-02-09 14:04 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Olivier Moysan

On 1/30/22 8:31 PM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> The combinations of either
> * pm_sleep_ptr() and DEFINE_SIMPLE_DEV_PM_OPS()
> * pm_ptr() and RUNTIME_PM_OPS()/SYSTEM_SLEEP_PM_OPS
> Make sure the functions are always visible to the compiler and removed by
> it rather than requring #ifdef magic.
> 
> This removes the need to mark the functions as __maybe_unused and saves
> additional space with some build options as the dev_pm_ops structure
> itself can be dropped automatically if CONFIG_PM is not enabled.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Olivier Moysan <olivier.moysan@st.com>
> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> ---

Hi Jonathan,

You can add my:
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Thanks for the patch,
Best Regards,
Fabrice

>  drivers/iio/adc/stm32-dfsdm-adc.c         | 11 ++++++-----
>  drivers/iio/adc/stm32-dfsdm-core.c        | 19 +++++++++----------
>  drivers/iio/dac/stm32-dac-core.c          | 16 ++++++++--------
>  drivers/iio/dac/stm32-dac.c               |  9 ++++-----
>  drivers/iio/trigger/stm32-timer-trigger.c | 12 ++++++------
>  5 files changed, 33 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
> index 1cfefb3b5e56..9704cf0b9753 100644
> --- a/drivers/iio/adc/stm32-dfsdm-adc.c
> +++ b/drivers/iio/adc/stm32-dfsdm-adc.c
> @@ -1632,7 +1632,7 @@ static int stm32_dfsdm_adc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_dfsdm_adc_suspend(struct device *dev)
> +static int stm32_dfsdm_adc_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  
> @@ -1642,7 +1642,7 @@ static int __maybe_unused stm32_dfsdm_adc_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_dfsdm_adc_resume(struct device *dev)
> +static int stm32_dfsdm_adc_resume(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
> @@ -1665,14 +1665,15 @@ static int __maybe_unused stm32_dfsdm_adc_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(stm32_dfsdm_adc_pm_ops,
> -			 stm32_dfsdm_adc_suspend, stm32_dfsdm_adc_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_dfsdm_adc_pm_ops,
> +				stm32_dfsdm_adc_suspend,
> +				stm32_dfsdm_adc_resume);
>  
>  static struct platform_driver stm32_dfsdm_adc_driver = {
>  	.driver = {
>  		.name = "stm32-dfsdm-adc",
>  		.of_match_table = stm32_dfsdm_adc_match,
> -		.pm = &stm32_dfsdm_adc_pm_ops,
> +		.pm = pm_sleep_ptr(&stm32_dfsdm_adc_pm_ops),
>  	},
>  	.probe = stm32_dfsdm_adc_probe,
>  	.remove = stm32_dfsdm_adc_remove,
> diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c
> index a627af9a825e..a3d4de6ba4c2 100644
> --- a/drivers/iio/adc/stm32-dfsdm-core.c
> +++ b/drivers/iio/adc/stm32-dfsdm-core.c
> @@ -381,7 +381,7 @@ static int stm32_dfsdm_core_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_dfsdm_core_suspend(struct device *dev)
> +static int stm32_dfsdm_core_suspend(struct device *dev)
>  {
>  	struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev);
>  	struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm);
> @@ -397,7 +397,7 @@ static int __maybe_unused stm32_dfsdm_core_suspend(struct device *dev)
>  	return pinctrl_pm_select_sleep_state(dev);
>  }
>  
> -static int __maybe_unused stm32_dfsdm_core_resume(struct device *dev)
> +static int stm32_dfsdm_core_resume(struct device *dev)
>  {
>  	struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev);
>  	struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm);
> @@ -414,7 +414,7 @@ static int __maybe_unused stm32_dfsdm_core_resume(struct device *dev)
>  	return pm_runtime_force_resume(dev);
>  }
>  
> -static int __maybe_unused stm32_dfsdm_core_runtime_suspend(struct device *dev)
> +static int stm32_dfsdm_core_runtime_suspend(struct device *dev)
>  {
>  	struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev);
>  
> @@ -423,7 +423,7 @@ static int __maybe_unused stm32_dfsdm_core_runtime_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_dfsdm_core_runtime_resume(struct device *dev)
> +static int stm32_dfsdm_core_runtime_resume(struct device *dev)
>  {
>  	struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev);
>  
> @@ -431,11 +431,10 @@ static int __maybe_unused stm32_dfsdm_core_runtime_resume(struct device *dev)
>  }
>  
>  static const struct dev_pm_ops stm32_dfsdm_core_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(stm32_dfsdm_core_suspend,
> -				stm32_dfsdm_core_resume)
> -	SET_RUNTIME_PM_OPS(stm32_dfsdm_core_runtime_suspend,
> -			   stm32_dfsdm_core_runtime_resume,
> -			   NULL)
> +	SYSTEM_SLEEP_PM_OPS(stm32_dfsdm_core_suspend, stm32_dfsdm_core_resume)
> +	RUNTIME_PM_OPS(stm32_dfsdm_core_runtime_suspend,
> +		       stm32_dfsdm_core_runtime_resume,
> +		       NULL)
>  };
>  
>  static struct platform_driver stm32_dfsdm_driver = {
> @@ -444,7 +443,7 @@ static struct platform_driver stm32_dfsdm_driver = {
>  	.driver = {
>  		.name = "stm32-dfsdm",
>  		.of_match_table = stm32_dfsdm_of_match,
> -		.pm = &stm32_dfsdm_core_pm_ops,
> +		.pm = pm_ptr(&stm32_dfsdm_core_pm_ops),
>  	},
>  };
>  
> diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
> index bd7a3b20e645..83bf184e3adc 100644
> --- a/drivers/iio/dac/stm32-dac-core.c
> +++ b/drivers/iio/dac/stm32-dac-core.c
> @@ -195,7 +195,7 @@ static int stm32_dac_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_dac_core_resume(struct device *dev)
> +static int stm32_dac_core_resume(struct device *dev)
>  {
>  	struct stm32_dac_common *common = dev_get_drvdata(dev);
>  	struct stm32_dac_priv *priv = to_stm32_dac_priv(common);
> @@ -213,23 +213,23 @@ static int __maybe_unused stm32_dac_core_resume(struct device *dev)
>  	return pm_runtime_force_resume(dev);
>  }
>  
> -static int __maybe_unused stm32_dac_core_runtime_suspend(struct device *dev)
> +static int stm32_dac_core_runtime_suspend(struct device *dev)
>  {
>  	stm32_dac_core_hw_stop(dev);
>  
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_dac_core_runtime_resume(struct device *dev)
> +static int stm32_dac_core_runtime_resume(struct device *dev)
>  {
>  	return stm32_dac_core_hw_start(dev);
>  }
>  
>  static const struct dev_pm_ops stm32_dac_core_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, stm32_dac_core_resume)
> -	SET_RUNTIME_PM_OPS(stm32_dac_core_runtime_suspend,
> -			   stm32_dac_core_runtime_resume,
> -			   NULL)
> +	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, stm32_dac_core_resume)
> +	RUNTIME_PM_OPS(stm32_dac_core_runtime_suspend,
> +		       stm32_dac_core_runtime_resume,
> +		       NULL)
>  };
>  
>  static const struct stm32_dac_cfg stm32h7_dac_cfg = {
> @@ -253,7 +253,7 @@ static struct platform_driver stm32_dac_driver = {
>  	.driver = {
>  		.name = "stm32-dac-core",
>  		.of_match_table = stm32_dac_of_match,
> -		.pm = &stm32_dac_core_pm_ops,
> +		.pm = pm_ptr(&stm32_dac_core_pm_ops),
>  	},
>  };
>  module_platform_driver(stm32_dac_driver);
> diff --git a/drivers/iio/dac/stm32-dac.c b/drivers/iio/dac/stm32-dac.c
> index cd71cc4553a7..b20192a071cb 100644
> --- a/drivers/iio/dac/stm32-dac.c
> +++ b/drivers/iio/dac/stm32-dac.c
> @@ -372,7 +372,7 @@ static int stm32_dac_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_dac_suspend(struct device *dev)
> +static int stm32_dac_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	int channel = indio_dev->channels[0].channel;
> @@ -386,9 +386,8 @@ static int __maybe_unused stm32_dac_suspend(struct device *dev)
>  	return pm_runtime_force_suspend(dev);
>  }
>  
> -static const struct dev_pm_ops stm32_dac_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(stm32_dac_suspend, pm_runtime_force_resume)
> -};
> +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_dac_pm_ops, stm32_dac_suspend,
> +				pm_runtime_force_resume);
>  
>  static const struct of_device_id stm32_dac_of_match[] = {
>  	{ .compatible = "st,stm32-dac", },
> @@ -402,7 +401,7 @@ static struct platform_driver stm32_dac_driver = {
>  	.driver = {
>  		.name = "stm32-dac",
>  		.of_match_table = stm32_dac_of_match,
> -		.pm = &stm32_dac_pm_ops,
> +		.pm = pm_sleep_ptr(&stm32_dac_pm_ops),
>  	},
>  };
>  module_platform_driver(stm32_dac_driver);
> diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
> index 4f9461e1412c..d72ac4c0bca4 100644
> --- a/drivers/iio/trigger/stm32-timer-trigger.c
> +++ b/drivers/iio/trigger/stm32-timer-trigger.c
> @@ -827,7 +827,7 @@ static int stm32_timer_trigger_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_timer_trigger_suspend(struct device *dev)
> +static int stm32_timer_trigger_suspend(struct device *dev)
>  {
>  	struct stm32_timer_trigger *priv = dev_get_drvdata(dev);
>  
> @@ -849,7 +849,7 @@ static int __maybe_unused stm32_timer_trigger_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused stm32_timer_trigger_resume(struct device *dev)
> +static int stm32_timer_trigger_resume(struct device *dev)
>  {
>  	struct stm32_timer_trigger *priv = dev_get_drvdata(dev);
>  	int ret;
> @@ -875,9 +875,9 @@ static int __maybe_unused stm32_timer_trigger_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static SIMPLE_DEV_PM_OPS(stm32_timer_trigger_pm_ops,
> -			 stm32_timer_trigger_suspend,
> -			 stm32_timer_trigger_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(stm32_timer_trigger_pm_ops,
> +				stm32_timer_trigger_suspend,
> +				stm32_timer_trigger_resume);
>  
>  static const struct stm32_timer_trigger_cfg stm32_timer_trg_cfg = {
>  	.valids_table = valids_table,
> @@ -907,7 +907,7 @@ static struct platform_driver stm32_timer_trigger_driver = {
>  	.driver = {
>  		.name = "stm32-timer-trigger",
>  		.of_match_table = stm32_trig_of_match,
> -		.pm = &stm32_timer_trigger_pm_ops,
> +		.pm = pm_sleep_ptr(&stm32_timer_trigger_pm_ops),
>  	},
>  };
>  module_platform_driver(stm32_timer_trigger_driver);
> 

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH v3 00/50]  iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc.
  2022-02-09 11:41 ` Paul Cercueil
@ 2022-02-18 11:47   ` Jonathan Cameron
  0 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-02-18 11:47 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: linux-iio, Arnd Bergmann, Rafael J . Wysocki, Jonathan Cameron,
	Alexandre Belloni, Anson Huang, Brian Masney, Crt Mori,
	Fabrice Gasnier, Hans de Goede, Heiko Stuebner, Icenowy Zheng,
	Jonathan Albrieux, Krzysztof Kozlowski, Linus Walleij,
	Luca Weiss, Ludovic Desroches, Manivannan Sadhasivam,
	Martijn Braam, Maslov Dmitry, Mikko Koivunen, Olivier Moysan,
	Stefan-Gabriel Mirea, Vaishnav M A

On Wed, 09 Feb 2022 11:41:26 +0000
Paul Cercueil <paul@crapouillou.net> wrote:

> Hi Jonathan,
> 
> Reviewed-by: Paul Cercueil <paul@crapouillou.net>
> 
> for the whole series.

Thanks!

Series applied with a bit of fuzz to the togreg branch of iio.git and
pushed out as testing to let the autobuilders see if they can find
anything we missed

Thanks,

Jonathan

> 
> Cheers,
> -Paul
> 
> 
> Le dim., janv. 30 2022 at 19:30:57 +0000, Jonathan Cameron 
> <jic23@kernel.org> a écrit :
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Note that I have cc'd no one for a number of drivers touched in this
> > set because we don't have a known active maintainer, so if anyone
> > has time to sanity check those it would be much appreciated.
> > 
> > Now that Paul Cercueil's rework of the pm_ptr() and related macro 
> > magic
> > to ensure we the compiler can remove unused struct dev_pm_ops and 
> > related
> > functions when either CONFIG_PM_SLEEP is not set or both that and
> > CONFIG_PM are not set is upstream [1], lets revisit this series of
> > cleanup of CONFIG_PM* guards in IIO.
> > 
> > Changes since v2:
> > 1) Move to new macros where relevant.
> > 2) Add static as the macros no longer include it
> >    DEFINE_SIMPLE_DEV_PM_OPS etc.
> > 3) Drop complex cases (I've noted those in reply to v2 so won't
> >    go into specifics here.  I'll revisit all these but after this 
> > massive
> >    set is in place. Some of these are due to interaction with
> >    the ongoing namespace work in IIO.
> > 4) Use the new DEFINE_RUNTIME_DEV_PM_OPS for cases where the
> >    force runtime functions were used for sleep ops.
> > 5) Add a few cases that I'd missed the first time around.
> > 
> > Note that there are some drivers that provide runtime callbacks
> > but not sleep ones.  The chances are high that it would be
> > sensible to use the force runtime pm calls for those, but
> > I considered that a separate change which should potentially be
> > part of a follow up patch set.
> > 
> > [1] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9d8619190031af0a314bee865262d8975473e4dd
> > 
> > Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > Cc: Anson Huang <anson.huang@nxp.com>
> > Cc: Brian Masney <masneyb@onstation.org>
> > Cc: Crt Mori <cmo@melexis.com>
> > Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Cc: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> > Cc: Icenowy Zheng <icenowy@aosc.io>
> > Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>
> > Cc: Krzysztof Kozlowski <krzk@kernel.org>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Luca Weiss <luca@z3ntu.xyz>
> > Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
> > Cc: Manivannan Sadhasivam <mani@kernel.org>
> > Cc: Martijn Braam <martijn@brixit.nl>
> > Cc: Maslov Dmitry <maslovdmitry@seeed.cc>
> > Cc: Matt Ranostay <matt.ranostay@konsulko.com
> > Cc: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
> > Cc: Olivier Moysan <olivier.moysan@foss.st.com>
> > Cc: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
> > Cc: Vaishnav M A <vaishnav@beagleboard.org>
> > Jonathan Cameron (50):
> >   iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:accel:dmard10: Switch from CONFIG_PM guards to pm_sleep_ptr() 
> > etc
> >   iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr()
> >   iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr()
> >   iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr()
> >   iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
> >     etc
> >   iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
> >     etc
> >   iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
> >     etc
> >   iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr()
> >   iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to
> >     pm_sleep_ptr() etc
> >   iio:accel:bma180: Switch from CONFIG_PM_SLEEP guards to 
> > pm_sleep_ptr()
> >     etc
> >   iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
> >     etc
> >   iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc
> >   iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr()
> >     etc
> >   iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr()
> >   iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr()
> >     etc
> >   iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio:light:rpr0521: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm
> >     __maybe_unused
> > 
> >  drivers/iio/accel/bma180.c                    |  9 ++-------
> >  drivers/iio/accel/da280.c                     |  6 ++----
> >  drivers/iio/accel/da311.c                     |  6 ++----
> >  drivers/iio/accel/dmard06.c                   | 10 +++-------
> >  drivers/iio/accel/dmard10.c                   |  7 +++----
> >  drivers/iio/accel/mc3230.c                    |  6 ++----
> >  drivers/iio/accel/mma7660.c                   | 11 +++--------
> >  drivers/iio/accel/mma9551.c                   | 11 +++--------
> >  drivers/iio/accel/mma9553.c                   | 11 +++--------
> >  drivers/iio/accel/stk8312.c                   | 11 +++--------
> >  drivers/iio/accel/stk8ba50.c                  | 11 +++--------
> >  drivers/iio/adc/ab8500-gpadc.c                | 13 +++----------
> >  drivers/iio/adc/at91_adc.c                    |  7 +++----
> >  drivers/iio/adc/exynos_adc.c                  |  9 +++------
> >  drivers/iio/adc/palmas_gpadc.c                | 10 +++-------
> >  drivers/iio/adc/rcar-gyroadc.c                |  6 ++----
> >  drivers/iio/adc/rockchip_saradc.c             |  9 ++++-----
> >  drivers/iio/adc/stm32-adc-core.c              | 17 ++++++-----------
> >  drivers/iio/adc/stm32-adc.c                   | 12 ++++--------
> >  drivers/iio/adc/stm32-dfsdm-adc.c             | 11 ++++++-----
> >  drivers/iio/adc/stm32-dfsdm-core.c            | 19 
> > +++++++++----------
> >  drivers/iio/adc/twl6030-gpadc.c               |  8 +++-----
> >  drivers/iio/adc/vf610_adc.c                   |  7 +++----
> >  drivers/iio/chemical/atlas-sensor.c           |  7 ++-----
> >  drivers/iio/common/ssp_sensors/ssp_dev.c      |  8 ++------
> >  drivers/iio/dac/m62332.c                      | 11 ++---------
> >  drivers/iio/dac/stm32-dac-core.c              | 16 ++++++++--------
> >  drivers/iio/dac/stm32-dac.c                   |  9 ++++-----
> >  drivers/iio/dac/vf610_dac.c                   |  7 +++----
> >  drivers/iio/imu/kmx61.c                       | 10 +++-------
> >  drivers/iio/light/apds9300.c                  | 10 +++-------
> >  drivers/iio/light/bh1780.c                    | 12 +++---------
> >  drivers/iio/light/cm3232.c                    |  9 ++-------
> >  drivers/iio/light/isl29018.c                  | 10 +++-------
> >  drivers/iio/light/isl29125.c                  |  7 +++----
> >  drivers/iio/light/jsa1212.c                   | 11 +++--------
> >  drivers/iio/light/ltr501.c                    |  6 ++----
> >  drivers/iio/light/rpr0521.c                   |  7 ++-----
> >  drivers/iio/light/stk3310.c                   | 11 +++--------
> >  drivers/iio/light/tcs3414.c                   |  7 +++----
> >  drivers/iio/light/tcs3472.c                   |  7 +++----
> >  drivers/iio/light/tsl2563.c                   | 10 +++-------
> >  drivers/iio/light/tsl4531.c                   | 10 +++-------
> >  drivers/iio/magnetometer/ak8975.c             | 12 +++---------
> >  drivers/iio/magnetometer/mag3110.c            | 10 +++-------
> >  drivers/iio/magnetometer/mmc35240.c           |  9 +++------
> >  drivers/iio/pressure/mpl3115.c                | 10 +++-------
> >  drivers/iio/proximity/as3935.c                | 10 ++--------
> >  .../iio/proximity/pulsedlight-lidar-lite-v2.c |  7 ++-----
> >  drivers/iio/proximity/rfd77402.c              |  7 +++----
> >  drivers/iio/proximity/sx9500.c                |  8 ++------
> >  drivers/iio/temperature/mlx90614.c            | 12 ++++--------
> >  drivers/iio/temperature/tmp006.c              |  6 ++----
> >  drivers/iio/temperature/tmp007.c              |  6 ++----
> >  drivers/iio/trigger/stm32-timer-trigger.c     | 12 ++++++------
> >  55 files changed, 173 insertions(+), 348 deletions(-)
> > 
> > --
> > 2.35.1
> >   
> 
> 


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-01-30 19:31 ` [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM " Jonathan Cameron
@ 2022-02-21 19:36   ` Jonathan Cameron
  0 siblings, 0 replies; 57+ messages in thread
From: Jonathan Cameron @ 2022-02-21 19:36 UTC (permalink / raw)
  To: linux-iio
  Cc: Paul Cercueil, Arnd Bergmann, Rafael J . Wysocki,
	Jonathan Cameron, Linus Walleij

On Sun, 30 Jan 2022 19:31:40 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM support is simpler and less error prone than the
> use of #ifdef based config guards.
> 
> This case uses the new DEFINE_RUNTIME_DEV_PM_OPS() to reduce
> boilerplate.
> 
> Removing instances of this approach from IIO also stops them being
> copied into new drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/iio/adc/ab8500-gpadc.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
> index 4c46a201d4ef..78c2bd8bb91d 100644
> --- a/drivers/iio/adc/ab8500-gpadc.c
> +++ b/drivers/iio/adc/ab8500-gpadc.c
> @@ -942,7 +942,6 @@ static const struct iio_info ab8500_gpadc_info = {
>  	.read_raw = ab8500_gpadc_read_raw,
>  };
>  
> -#ifdef CONFIG_PM
>  static int ab8500_gpadc_runtime_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> @@ -965,7 +964,6 @@ static int ab8500_gpadc_runtime_resume(struct device *dev)
>  
>  	return ret;
>  }
> -#endif
>  
>  /**
>   * ab8500_gpadc_parse_channel() - process devicetree channel configuration
> @@ -1199,20 +1197,15 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static const struct dev_pm_ops ab8500_gpadc_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> -				pm_runtime_force_resume)
> -	SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend,
> -			   ab8500_gpadc_runtime_resume,
> -			   NULL)
> -};
> +static DEFINE_RUNTIME_DEV_PM_OPS(ab8500_gpadc_runtime_suspend,
0-day actually managed to build this driver unlike my test setups.
Anyhow, I managed to lose the name of the dev_pm_ops structure.

I've fixed that up and tested by hacking out the dependencies in Kconfig.
At somepoint I'll check if we can actually add a COMPILE_TEST option
for this one or if there are some actual requirements that my really
quick test didn't pick up on.

Fresh testing branch pushed out.

> +				 ab8500_gpadc_runtime_resume, NULL);
>  
>  static struct platform_driver ab8500_gpadc_driver = {
>  	.probe = ab8500_gpadc_probe,
>  	.remove = ab8500_gpadc_remove,
>  	.driver = {
>  		.name = "ab8500-gpadc",
> -		.pm = &ab8500_gpadc_pm_ops,
> +		.pm = pm_ptr(&ab8500_gpadc_pm_ops),
>  	},
>  };
>  builtin_platform_driver(ab8500_gpadc_driver);


^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2022-02-21 19:29 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-30 19:30 [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Jonathan Cameron
2022-01-30 19:30 ` [PATCH v3 01/50] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:30 ` [PATCH v3 02/50] iio:accel:da280: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 03/50] iio:accel:dmard06: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 04/50] iio:accel:dmard10: Switch from CONFIG_PM " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 05/50] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 06/50] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 07/50] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 08/50] iio:accel:mma9553: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 09/50] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 10/50] iio:adc:at91-adc: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 11/50] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 12/50] iio:adc:palmas_gpadc: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 13/50] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 14/50] iio:adc:twl6030: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 15/50] iio:adc:vf610: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 16/50] iio:common:ssp: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 17/50] iio:dac:vf610: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 18/50] iio:light:apds9300: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 19/50] iio:light:cm3232: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 20/50] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 21/50] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 22/50] iio:light:jsa1212: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 23/50] iio:light:ltr501: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 24/50] iio:light:stk3310: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 25/50] iio:light:tcs3414: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 26/50] iio:light:tcs3472: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 27/50] iio:light:tsl2563: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 28/50] iio:light:tsl4531: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 29/50] iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 30/50] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 31/50] iio:magn:mmc35240: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 32/50] iio:pressure:mpl3115: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 33/50] iio:proximity:as3935: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 34/50] iio:proximity:rfd77492: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 35/50] iio:proximity:sx9500: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 36/50] iio:temperature:tmp006: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 37/50] iio:temperature:tmp007: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 38/50] iio:accel:stk8312: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 39/50] iio:accel:bma180: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 40/50] iio:dac:m62332: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 41/50] iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 42/50] iio:temperature:mlx90614: " Jonathan Cameron
2022-01-31 13:16   ` Crt Mori
2022-01-30 19:31 ` [PATCH v3 43/50] iio:adc:ab8500: Switch from CONFIG_PM " Jonathan Cameron
2022-02-21 19:36   ` Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 44/50] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 45/50] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 46/50] iio:light:bh1780: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 47/50] iio:proximity:pulsedlight: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 48/50] iio:chemical:atlas: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 49/50] iio:light:rpr0521: " Jonathan Cameron
2022-01-30 19:31 ` [PATCH v3 50/50] iio:adc:stm32*: Use pm[_sleep]_ptr() etc to avoid need to make pm __maybe_unused Jonathan Cameron
2022-02-09 14:04   ` Fabrice Gasnier
2022-01-31 13:33 ` [PATCH v3 00/50] iio: Tree wide switch from CONFIG_PM* to pm_[sleep]_ptr etc Arnd Bergmann
2022-02-09 11:41 ` Paul Cercueil
2022-02-18 11:47   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.