All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros.
@ 2022-06-21 20:26 Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 01/36] iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
                   ` (36 more replies)
  0 siblings, 37 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

After Paul's work [1] to cleanup us the PM related macros allow
use of pm_ptr() and pm_sleep_ptr() making the compiler figure
out what structures and functions can be dropped without __maybe_unused
mess, I've been working through converting IIO.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/pm.h?id=c06ef740d401d0f4ab188882bf6f8d9cf0f75eaf

This particular set is the low hanging fruit. The majority of
the remainder in IIO require more thought because:

1) They only have runtime pm callbacks, but no sleep ones. Need to check
   there is no reason we can't use use the force_runtime_suspend approach.
2) Odd cases like using same functions for sleep and runtime pm but not
   via force runtime suspend.
3) Other weird corner cases where I want to take a closer look before
   sending them out (I think some of them are buggy).

Anyhow, whilst I've CC'd a lot of people I suspect some will no longer
be active on these addresses - hence if anyone has time to look at a few
patches rather than just the ones for drivers they maintain that would
be much appreciated. In some cases I haven't CC'd anyone on a particular
patch because I'm fairly sure the author is not longer at the same
address. Any review of those ones in particular would be great.

Thanks,

Jonathan

Jonathan Cameron (36):
  iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: adc: ad799x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: adc: at91-sam5d2:  Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: adc: meson_saradc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: adc: mt6577_auxadc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: adc: stmpe-adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: adc: ti-am335x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: adc: xilinx-ams: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: chemical: scd4x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: dac: ds4424: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: dac: ltc1660: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: dac: max517: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: dac: max5821: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: dac: mcp4725: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: gyro: itg3200: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: health: afe4403: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: health: afe4404: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: light: al3010: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: light: al3320a: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: light: as73211: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: light: bh1750: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: light: cm3605: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: proximity: cros_ec_mkbp: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
    pm_sleep_ptr()
  iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc
  iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
  iio: light: gp2ap002: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
  iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
  iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
  iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
  iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
    macros
  iio: light: vcnl4035: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
    macros
  iio: light: veml6030: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
    macros
  iio: magnetometer: ak8974: Use DEFINE_RUNTIME_DEV_PM_OPS() and
    pm_ptr() macros
  iio: magn: yas530: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros

 drivers/iio/accel/bma220_spi.c                 |  8 ++++----
 drivers/iio/adc/ad799x.c                       |  8 ++++----
 drivers/iio/adc/at91-sama5d2_adc.c             |  9 +++++----
 drivers/iio/adc/imx7d_adc.c                    |  5 +++--
 drivers/iio/adc/imx8qxp-adc.c                  | 13 ++++++-------
 drivers/iio/adc/meson_saradc.c                 | 10 +++++-----
 drivers/iio/adc/mt6577_auxadc.c                | 12 ++++++------
 drivers/iio/adc/stmpe-adc.c                    |  6 +++---
 drivers/iio/adc/ti_am335x_adc.c                |  8 ++++----
 drivers/iio/adc/xilinx-ams.c                   |  8 ++++----
 drivers/iio/chemical/scd4x.c                   |  8 ++++----
 drivers/iio/dac/ds4424.c                       |  8 ++++----
 drivers/iio/dac/ltc1660.c                      |  9 +++++----
 drivers/iio/dac/max517.c                       |  8 ++++----
 drivers/iio/dac/max5821.c                      |  9 +++++----
 drivers/iio/dac/mcp4725.c                      |  9 +++++----
 drivers/iio/gyro/itg3200_core.c                |  9 +++++----
 drivers/iio/health/afe4403.c                   |  9 +++++----
 drivers/iio/health/afe4404.c                   |  9 +++++----
 drivers/iio/light/al3010.c                     |  8 ++++----
 drivers/iio/light/al3320a.c                    |  9 +++++----
 drivers/iio/light/as73211.c                    |  9 +++++----
 drivers/iio/light/bh1750.c                     |  6 +++---
 drivers/iio/light/cm3605.c                     | 13 +++++--------
 drivers/iio/light/gp2ap002.c                   | 14 +++++---------
 drivers/iio/light/isl29028.c                   | 13 +++++--------
 drivers/iio/light/tsl2583.c                    | 13 +++++--------
 drivers/iio/light/tsl2591.c                    | 12 +++++-------
 drivers/iio/light/us5182d.c                    |  8 +++-----
 drivers/iio/light/vcnl4000.c                   | 14 +++++---------
 drivers/iio/light/vcnl4035.c                   | 14 +++++---------
 drivers/iio/light/veml6030.c                   | 14 +++++---------
 drivers/iio/magnetometer/ak8974.c              | 14 +++++---------
 drivers/iio/magnetometer/yamaha-yas530.c       | 14 +++++---------
 drivers/iio/proximity/cros_ec_mkbp_proximity.c |  8 ++++----
 drivers/iio/temperature/ltc2983.c              |  9 +++++----
 36 files changed, 165 insertions(+), 192 deletions(-)

-- 
2.36.1


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

* [PATCH 01/36] iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 02/36] iio: adc: ad799x: " Jonathan Cameron
                   ` (35 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

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

diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
index b6d9ab8e2054..fcbd695e4654 100644
--- a/drivers/iio/accel/bma220_spi.c
+++ b/drivers/iio/accel/bma220_spi.c
@@ -289,20 +289,20 @@ static int bma220_probe(struct spi_device *spi)
 	return devm_iio_device_register(&spi->dev, indio_dev);
 }
 
-static __maybe_unused int bma220_suspend(struct device *dev)
+static int bma220_suspend(struct device *dev)
 {
 	struct spi_device *spi = to_spi_device(dev);
 
 	return bma220_power(spi, false);
 }
 
-static __maybe_unused int bma220_resume(struct device *dev)
+static int bma220_resume(struct device *dev)
 {
 	struct spi_device *spi = to_spi_device(dev);
 
 	return bma220_power(spi, true);
 }
-static SIMPLE_DEV_PM_OPS(bma220_pm_ops, bma220_suspend, bma220_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(bma220_pm_ops, bma220_suspend, bma220_resume);
 
 static const struct spi_device_id bma220_spi_id[] = {
 	{"bma220", 0},
@@ -318,7 +318,7 @@ MODULE_DEVICE_TABLE(spi, bma220_spi_id);
 static struct spi_driver bma220_driver = {
 	.driver = {
 		.name = "bma220_spi",
-		.pm = &bma220_pm_ops,
+		.pm = pm_sleep_ptr(&bma220_pm_ops),
 		.acpi_match_table = bma220_acpi_id,
 	},
 	.probe =            bma220_probe,
-- 
2.36.1


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

* [PATCH 02/36] iio: adc: ad799x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 01/36] iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 03/36] iio: adc: at91-sam5d2: " Jonathan Cameron
                   ` (34 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/iio/adc/ad799x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 220228c375d3..262bd7665b33 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -896,7 +896,7 @@ static int ad799x_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused ad799x_suspend(struct device *dev)
+static int ad799x_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct ad799x_state *st = iio_priv(indio_dev);
@@ -908,7 +908,7 @@ static int __maybe_unused ad799x_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused ad799x_resume(struct device *dev)
+static int ad799x_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct ad799x_state *st = iio_priv(indio_dev);
@@ -941,7 +941,7 @@ static int __maybe_unused ad799x_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(ad799x_pm_ops, ad799x_suspend, ad799x_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ad799x_pm_ops, ad799x_suspend, ad799x_resume);
 
 static const struct i2c_device_id ad799x_id[] = {
 	{ "ad7991", ad7991 },
@@ -960,7 +960,7 @@ MODULE_DEVICE_TABLE(i2c, ad799x_id);
 static struct i2c_driver ad799x_driver = {
 	.driver = {
 		.name = "ad799x",
-		.pm = &ad799x_pm_ops,
+		.pm = pm_sleep_ptr(&ad799x_pm_ops),
 	},
 	.probe = ad799x_probe,
 	.remove = ad799x_remove,
-- 
2.36.1


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

* [PATCH 03/36] iio: adc: at91-sam5d2:  Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 01/36] iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 02/36] iio: adc: ad799x: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 04/36] iio: adc: imx7d_adc: " Jonathan Cameron
                   ` (33 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index fe3131c9593c..279430c1d88c 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -2103,7 +2103,7 @@ static int at91_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static __maybe_unused int at91_adc_suspend(struct device *dev)
+static int at91_adc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
@@ -2123,7 +2123,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
 	return pinctrl_pm_select_sleep_state(dev);
 }
 
-static __maybe_unused int at91_adc_resume(struct device *dev)
+static int at91_adc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct at91_adc_state *st = iio_priv(indio_dev);
@@ -2169,7 +2169,8 @@ static __maybe_unused int at91_adc_resume(struct device *dev)
 	return ret;
 }
 
-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 of_device_id at91_adc_dt_match[] = {
 	{
@@ -2190,7 +2191,7 @@ static struct platform_driver at91_adc_driver = {
 	.driver = {
 		.name = "at91-sama5d2_adc",
 		.of_match_table = at91_adc_dt_match,
-		.pm = &at91_adc_pm_ops,
+		.pm = pm_sleep_ptr(&at91_adc_pm_ops),
 	},
 };
 module_platform_driver(at91_adc_driver)
-- 
2.36.1


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

* [PATCH 04/36] iio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (2 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 03/36] iio: adc: at91-sam5d2: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-22  9:31   ` Bough Chen
  2022-06-21 20:26 ` [PATCH 05/36] iio: adc: meson_saradc: " Jonathan Cameron
                   ` (32 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

In this case we only gain the ability to have the compiler drop the
struct dev_pm_ops because the callbacks are called from paths other
than suspend and resume.  In general the purpose of this new macro
is to allow automated removal of the callbacks as well, but that doesn't
apply here.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/iio/adc/imx7d_adc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index 119217af2bde..86caff1d006b 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -540,14 +540,15 @@ static int imx7d_adc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable, imx7d_adc_enable);
+static DEFINE_SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable,
+				imx7d_adc_enable);
 
 static struct platform_driver imx7d_adc_driver = {
 	.probe		= imx7d_adc_probe,
 	.driver		= {
 		.name	= "imx7d_adc",
 		.of_match_table = imx7d_adc_match,
-		.pm	= &imx7d_adc_pm_ops,
+		.pm	= pm_sleep_ptr(&imx7d_adc_pm_ops),
 	},
 };
 
-- 
2.36.1


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

* [PATCH 05/36] iio: adc: meson_saradc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (3 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 04/36] iio: adc: imx7d_adc: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-26 22:04   ` Martin Blumenstingl
  2022-06-21 20:26 ` [PATCH 06/36] iio: adc: mt6577_auxadc: " Jonathan Cameron
                   ` (31 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/iio/adc/meson_saradc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index c18be3c519af..1a68b099d323 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1281,22 +1281,22 @@ static int meson_sar_adc_remove(struct platform_device *pdev)
 	return meson_sar_adc_hw_disable(indio_dev);
 }
 
-static int __maybe_unused meson_sar_adc_suspend(struct device *dev)
+static int meson_sar_adc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
 	return meson_sar_adc_hw_disable(indio_dev);
 }
 
-static int __maybe_unused meson_sar_adc_resume(struct device *dev)
+static int meson_sar_adc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
 	return meson_sar_adc_hw_enable(indio_dev);
 }
 
-static SIMPLE_DEV_PM_OPS(meson_sar_adc_pm_ops,
-			 meson_sar_adc_suspend, meson_sar_adc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(meson_sar_adc_pm_ops,
+				meson_sar_adc_suspend, meson_sar_adc_resume);
 
 static struct platform_driver meson_sar_adc_driver = {
 	.probe		= meson_sar_adc_probe,
@@ -1304,7 +1304,7 @@ static struct platform_driver meson_sar_adc_driver = {
 	.driver		= {
 		.name	= "meson-saradc",
 		.of_match_table = meson_sar_adc_of_match,
-		.pm = &meson_sar_adc_pm_ops,
+		.pm = pm_sleep_ptr(&meson_sar_adc_pm_ops),
 	},
 };
 
-- 
2.36.1


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

* [PATCH 06/36] iio: adc: mt6577_auxadc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (4 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 05/36] iio: adc: meson_saradc: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 07/36] iio: adc: stmpe-adc: " Jonathan Cameron
                   ` (30 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Zhiyong Tao <zhiyong.tao@mediatek.com>
Cc: Hui Liu <hui.liu@mediatek.com>
---
 drivers/iio/adc/mt6577_auxadc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
index e78c96a185db..0e134777bdd2 100644
--- a/drivers/iio/adc/mt6577_auxadc.c
+++ b/drivers/iio/adc/mt6577_auxadc.c
@@ -215,7 +215,7 @@ static const struct iio_info mt6577_auxadc_info = {
 	.read_raw = &mt6577_auxadc_read_raw,
 };
 
-static int __maybe_unused mt6577_auxadc_resume(struct device *dev)
+static int mt6577_auxadc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev);
@@ -234,7 +234,7 @@ static int __maybe_unused mt6577_auxadc_resume(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused mt6577_auxadc_suspend(struct device *dev)
+static int mt6577_auxadc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev);
@@ -330,9 +330,9 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
-			 mt6577_auxadc_suspend,
-			 mt6577_auxadc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
+				mt6577_auxadc_suspend,
+				mt6577_auxadc_resume);
 
 static const struct of_device_id mt6577_auxadc_of_match[] = {
 	{ .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat },
@@ -349,7 +349,7 @@ static struct platform_driver mt6577_auxadc_driver = {
 	.driver = {
 		.name   = "mt6577-auxadc",
 		.of_match_table = mt6577_auxadc_of_match,
-		.pm = &mt6577_auxadc_pm_ops,
+		.pm = pm_sleep_ptr(&mt6577_auxadc_pm_ops),
 	},
 	.probe	= mt6577_auxadc_probe,
 	.remove	= mt6577_auxadc_remove,
-- 
2.36.1


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

* [PATCH 07/36] iio: adc: stmpe-adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (5 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 06/36] iio: adc: mt6577_auxadc: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 08/36] iio: adc: ti-am335x: " Jonathan Cameron
                   ` (29 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.  This one is a little unusual as
no suspend callback, but the cleanup is still worthwhile (and eventual
aim is to get rid of old macro).

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Philippe Schenker <philippe.schenker@toradex.com>
---
 drivers/iio/adc/stmpe-adc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
index 000e5cfecb43..67518e460e05 100644
--- a/drivers/iio/adc/stmpe-adc.c
+++ b/drivers/iio/adc/stmpe-adc.c
@@ -333,7 +333,7 @@ static int stmpe_adc_probe(struct platform_device *pdev)
 	return devm_iio_device_register(&pdev->dev, indio_dev);
 }
 
-static int __maybe_unused stmpe_adc_resume(struct device *dev)
+static int stmpe_adc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct stmpe_adc *info = iio_priv(indio_dev);
@@ -343,7 +343,7 @@ static int __maybe_unused stmpe_adc_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(stmpe_adc_pm_ops, NULL, stmpe_adc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stmpe_adc_pm_ops, NULL, stmpe_adc_resume);
 
 static const struct of_device_id stmpe_adc_ids[] = {
 	{ .compatible = "st,stmpe-adc", },
@@ -355,7 +355,7 @@ static struct platform_driver stmpe_adc_driver = {
 	.probe		= stmpe_adc_probe,
 	.driver		= {
 		.name	= "stmpe-adc",
-		.pm	= &stmpe_adc_pm_ops,
+		.pm	= pm_sleep_ptr(&stmpe_adc_pm_ops),
 		.of_match_table = stmpe_adc_ids,
 	},
 };
-- 
2.36.1


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

* [PATCH 08/36] iio: adc: ti-am335x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (6 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 07/36] iio: adc: stmpe-adc: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-22  6:29   ` Miquel Raynal
  2022-06-21 20:26 ` [PATCH 09/36] iio: adc: xilinx-ams: " Jonathan Cameron
                   ` (28 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/iio/adc/ti_am335x_adc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 567d43a30955..642c5c4895e3 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -702,7 +702,7 @@ static int tiadc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused tiadc_suspend(struct device *dev)
+static int tiadc_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
@@ -715,7 +715,7 @@ static int __maybe_unused tiadc_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused tiadc_resume(struct device *dev)
+static int tiadc_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
@@ -732,7 +732,7 @@ static int __maybe_unused tiadc_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
 
 static const struct of_device_id ti_adc_dt_ids[] = {
 	{ .compatible = "ti,am3359-adc", },
@@ -744,7 +744,7 @@ MODULE_DEVICE_TABLE(of, ti_adc_dt_ids);
 static struct platform_driver tiadc_driver = {
 	.driver = {
 		.name   = "TI-am335x-adc",
-		.pm	= &tiadc_pm_ops,
+		.pm	= pm_sleep_ptr(&tiadc_pm_ops),
 		.of_match_table = ti_adc_dt_ids,
 	},
 	.probe	= tiadc_probe,
-- 
2.36.1


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

* [PATCH 09/36] iio: adc: xilinx-ams: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (7 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 08/36] iio: adc: ti-am335x: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 10/36] iio: chemical: scd4x: " Jonathan Cameron
                   ` (27 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Michal Simek <michal.simek@xilinx.com>
---
 drivers/iio/adc/xilinx-ams.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
index a55396c1f8b2..8dad2b232ba7 100644
--- a/drivers/iio/adc/xilinx-ams.c
+++ b/drivers/iio/adc/xilinx-ams.c
@@ -1421,7 +1421,7 @@ static int ams_probe(struct platform_device *pdev)
 	return devm_iio_device_register(&pdev->dev, indio_dev);
 }
 
-static int __maybe_unused ams_suspend(struct device *dev)
+static int ams_suspend(struct device *dev)
 {
 	struct ams *ams = iio_priv(dev_get_drvdata(dev));
 
@@ -1430,20 +1430,20 @@ static int __maybe_unused ams_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused ams_resume(struct device *dev)
+static int ams_resume(struct device *dev)
 {
 	struct ams *ams = iio_priv(dev_get_drvdata(dev));
 
 	return clk_prepare_enable(ams->clk);
 }
 
-static SIMPLE_DEV_PM_OPS(ams_pm_ops, ams_suspend, ams_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ams_pm_ops, ams_suspend, ams_resume);
 
 static struct platform_driver ams_driver = {
 	.probe = ams_probe,
 	.driver = {
 		.name = "xilinx-ams",
-		.pm = &ams_pm_ops,
+		.pm = pm_sleep_ptr(&ams_pm_ops),
 		.of_match_table = ams_of_match_table,
 	},
 };
-- 
2.36.1


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

* [PATCH 10/36] iio: chemical: scd4x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (8 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 09/36] iio: adc: xilinx-ams: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 11/36] iio: dac: ds4424: " Jonathan Cameron
                   ` (26 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Roan van Dijk <roan@protonic.nl>
---
 drivers/iio/chemical/scd4x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/chemical/scd4x.c b/drivers/iio/chemical/scd4x.c
index 37143b5526ee..54066532ea45 100644
--- a/drivers/iio/chemical/scd4x.c
+++ b/drivers/iio/chemical/scd4x.c
@@ -551,7 +551,7 @@ static const struct iio_chan_spec scd4x_channels[] = {
 	},
 };
 
-static int __maybe_unused scd4x_suspend(struct device *dev)
+static int scd4x_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct scd4x_state *state  = iio_priv(indio_dev);
@@ -564,7 +564,7 @@ static int __maybe_unused scd4x_suspend(struct device *dev)
 	return regulator_disable(state->vdd);
 }
 
-static int __maybe_unused scd4x_resume(struct device *dev)
+static int scd4x_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct scd4x_state *state = iio_priv(indio_dev);
@@ -577,7 +577,7 @@ static int __maybe_unused scd4x_resume(struct device *dev)
 	return scd4x_send_command(state, CMD_START_MEAS);
 }
 
-static __maybe_unused SIMPLE_DEV_PM_OPS(scd4x_pm_ops, scd4x_suspend, scd4x_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(scd4x_pm_ops, scd4x_suspend, scd4x_resume);
 
 static void scd4x_stop_meas(void *state)
 {
@@ -688,7 +688,7 @@ static struct i2c_driver scd4x_i2c_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = scd4x_dt_ids,
-		.pm = &scd4x_pm_ops
+		.pm = pm_sleep_ptr(&scd4x_pm_ops),
 	},
 	.probe = scd4x_probe,
 };
-- 
2.36.1


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

* [PATCH 11/36] iio: dac: ds4424: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (9 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 10/36] iio: chemical: scd4x: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
       [not found]   ` <CABEhyf8EezacO8hSCDtz8kDnWeTWFJYBz0XJufjmyprv5u3rmw@mail.gmail.com>
  2022-06-21 20:26 ` [PATCH 12/36] iio: dac: ltc1660: " Jonathan Cameron
                   ` (25 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Ismail H. Kose <ihkose@gmail.com>
---
 drivers/iio/dac/ds4424.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c
index 5a5e967b0be4..509394690bcc 100644
--- a/drivers/iio/dac/ds4424.c
+++ b/drivers/iio/dac/ds4424.c
@@ -171,7 +171,7 @@ static int ds4424_verify_chip(struct iio_dev *indio_dev)
 	return ret;
 }
 
-static int __maybe_unused ds4424_suspend(struct device *dev)
+static int ds4424_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
@@ -189,7 +189,7 @@ static int __maybe_unused ds4424_suspend(struct device *dev)
 	return ret;
 }
 
-static int __maybe_unused ds4424_resume(struct device *dev)
+static int ds4424_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct iio_dev *indio_dev = i2c_get_clientdata(client);
@@ -206,7 +206,7 @@ static int __maybe_unused ds4424_resume(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend, ds4424_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend, ds4424_resume);
 
 static const struct iio_info ds4424_info = {
 	.read_raw = ds4424_read_raw,
@@ -312,7 +312,7 @@ static struct i2c_driver ds4424_driver = {
 	.driver = {
 		.name	= "ds4424",
 		.of_match_table = ds4424_of_match,
-		.pm     = &ds4424_pm_ops,
+		.pm     = pm_sleep_ptr(&ds4424_pm_ops),
 	},
 	.probe		= ds4424_probe,
 	.remove		= ds4424_remove,
-- 
2.36.1


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

* [PATCH 12/36] iio: dac: ltc1660: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (10 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 11/36] iio: dac: ds4424: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-22  6:25   ` Marcus Folkesson
  2022-06-21 20:26 ` [PATCH 13/36] iio: dac: max517: " Jonathan Cameron
                   ` (24 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/iio/dac/ltc1660.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/dac/ltc1660.c b/drivers/iio/dac/ltc1660.c
index c76233c9bb72..2758fc8a5ad5 100644
--- a/drivers/iio/dac/ltc1660.c
+++ b/drivers/iio/dac/ltc1660.c
@@ -137,20 +137,21 @@ static const struct iio_info ltc1660_info = {
 	.write_raw = &ltc1660_write_raw,
 };
 
-static int __maybe_unused ltc1660_suspend(struct device *dev)
+static int ltc1660_suspend(struct device *dev)
 {
 	struct ltc1660_priv *priv = iio_priv(spi_get_drvdata(
 						to_spi_device(dev)));
 	return regmap_write(priv->regmap, LTC1660_REG_SLEEP, 0x00);
 }
 
-static int __maybe_unused ltc1660_resume(struct device *dev)
+static int ltc1660_resume(struct device *dev)
 {
 	struct ltc1660_priv *priv = iio_priv(spi_get_drvdata(
 						to_spi_device(dev)));
 	return regmap_write(priv->regmap, LTC1660_REG_WAKE, 0x00);
 }
-static SIMPLE_DEV_PM_OPS(ltc1660_pm_ops, ltc1660_suspend, ltc1660_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ltc1660_pm_ops, ltc1660_suspend,
+				ltc1660_resume);
 
 static int ltc1660_probe(struct spi_device *spi)
 {
@@ -233,7 +234,7 @@ static struct spi_driver ltc1660_driver = {
 	.driver = {
 		.name = "ltc1660",
 		.of_match_table = ltc1660_dt_ids,
-		.pm = &ltc1660_pm_ops,
+		.pm = pm_sleep_ptr(&ltc1660_pm_ops),
 	},
 	.probe	= ltc1660_probe,
 	.remove = ltc1660_remove,
-- 
2.36.1


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

* [PATCH 13/36] iio: dac: max517: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (11 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 12/36] iio: dac: ltc1660: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 14/36] iio: dac: max5821: " Jonathan Cameron
                   ` (23 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/iio/dac/max517.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
index a6ef555153f4..373ce6ff83b7 100644
--- a/drivers/iio/dac/max517.c
+++ b/drivers/iio/dac/max517.c
@@ -100,21 +100,21 @@ static int max517_write_raw(struct iio_dev *indio_dev,
 	return ret;
 }
 
-static int __maybe_unused max517_suspend(struct device *dev)
+static int max517_suspend(struct device *dev)
 {
 	u8 outbuf = COMMAND_PD;
 
 	return i2c_master_send(to_i2c_client(dev), &outbuf, 1);
 }
 
-static int __maybe_unused max517_resume(struct device *dev)
+static int max517_resume(struct device *dev)
 {
 	u8 outbuf = 0;
 
 	return i2c_master_send(to_i2c_client(dev), &outbuf, 1);
 }
 
-static SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume);
 
 static const struct iio_info max517_info = {
 	.read_raw = max517_read_raw,
@@ -201,7 +201,7 @@ MODULE_DEVICE_TABLE(i2c, max517_id);
 static struct i2c_driver max517_driver = {
 	.driver = {
 		.name	= MAX517_DRV_NAME,
-		.pm	= &max517_pm_ops,
+		.pm	= pm_sleep_ptr(&max517_pm_ops),
 	},
 	.probe		= max517_probe,
 	.id_table	= max517_id,
-- 
2.36.1


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

* [PATCH 14/36] iio: dac: max5821: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (12 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 13/36] iio: dac: max517: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
       [not found]   ` <CABEhyf-N-hi7z3SQK4FRWyztwJ=3t17NZT-gGCEugQhUkpcZQA@mail.gmail.com>
  2022-06-21 20:26 ` [PATCH 15/36] iio: dac: mcp4725: " Jonathan Cameron
                   ` (22 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Philippe Reynes <tremyfr@yahoo.fr>
---
 drivers/iio/dac/max5821.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c
index 540f9ea7cada..e001b594d5b1 100644
--- a/drivers/iio/dac/max5821.c
+++ b/drivers/iio/dac/max5821.c
@@ -267,7 +267,7 @@ static int max5821_write_raw(struct iio_dev *indio_dev,
 	}
 }
 
-static int __maybe_unused max5821_suspend(struct device *dev)
+static int max5821_suspend(struct device *dev)
 {
 	u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
 			 MAX5821_EXTENDED_DAC_A |
@@ -277,7 +277,7 @@ static int __maybe_unused max5821_suspend(struct device *dev)
 	return i2c_master_send(to_i2c_client(dev), outbuf, 2);
 }
 
-static int __maybe_unused max5821_resume(struct device *dev)
+static int max5821_resume(struct device *dev)
 {
 	u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
 			 MAX5821_EXTENDED_DAC_A |
@@ -287,7 +287,8 @@ static int __maybe_unused max5821_resume(struct device *dev)
 	return i2c_master_send(to_i2c_client(dev), outbuf, 2);
 }
 
-static SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, max5821_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend,
+				max5821_resume);
 
 static const struct iio_info max5821_info = {
 	.read_raw = max5821_read_raw,
@@ -374,7 +375,7 @@ static struct i2c_driver max5821_driver = {
 	.driver = {
 		.name	= "max5821",
 		.of_match_table = max5821_of_match,
-		.pm     = &max5821_pm_ops,
+		.pm     = pm_sleep_ptr(&max5821_pm_ops),
 	},
 	.probe		= max5821_probe,
 	.id_table	= max5821_id,
-- 
2.36.1


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

* [PATCH 15/36] iio: dac: mcp4725: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (13 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 14/36] iio: dac: max5821: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:26 ` [PATCH 16/36] iio: gyro: itg3200: " Jonathan Cameron
                   ` (21 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Philippe Reynes <tremyfr@yahoo.fr>
---
 drivers/iio/dac/mcp4725.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
index 7fcb86288823..bb4b85a7b95b 100644
--- a/drivers/iio/dac/mcp4725.c
+++ b/drivers/iio/dac/mcp4725.c
@@ -42,7 +42,7 @@ struct mcp4725_data {
 	struct regulator *vref_reg;
 };
 
-static int __maybe_unused mcp4725_suspend(struct device *dev)
+static int mcp4725_suspend(struct device *dev)
 {
 	struct mcp4725_data *data = iio_priv(i2c_get_clientdata(
 		to_i2c_client(dev)));
@@ -55,7 +55,7 @@ static int __maybe_unused mcp4725_suspend(struct device *dev)
 	return i2c_master_send(data->client, outbuf, 2);
 }
 
-static int __maybe_unused mcp4725_resume(struct device *dev)
+static int mcp4725_resume(struct device *dev)
 {
 	struct mcp4725_data *data = iio_priv(i2c_get_clientdata(
 		to_i2c_client(dev)));
@@ -68,7 +68,8 @@ static int __maybe_unused mcp4725_resume(struct device *dev)
 
 	return i2c_master_send(data->client, outbuf, 2);
 }
-static SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend, mcp4725_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend,
+				mcp4725_resume);
 
 static ssize_t mcp4725_store_eeprom(struct device *dev,
 	struct device_attribute *attr, const char *buf, size_t len)
@@ -523,7 +524,7 @@ static struct i2c_driver mcp4725_driver = {
 	.driver = {
 		.name	= MCP4725_DRV_NAME,
 		.of_match_table = mcp4725_of_match,
-		.pm	= &mcp4725_pm_ops,
+		.pm	= pm_sleep_ptr(&mcp4725_pm_ops),
 	},
 	.probe		= mcp4725_probe,
 	.remove		= mcp4725_remove,
-- 
2.36.1


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

* [PATCH 16/36] iio: gyro: itg3200: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (14 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 15/36] iio: dac: mcp4725: " Jonathan Cameron
@ 2022-06-21 20:26 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 17/36] iio: health: afe4403: " Jonathan Cameron
                   ` (20 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:26 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/gyro/itg3200_core.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/gyro/itg3200_core.c b/drivers/iio/gyro/itg3200_core.c
index a7f1bbb5f289..0491c64e1b32 100644
--- a/drivers/iio/gyro/itg3200_core.c
+++ b/drivers/iio/gyro/itg3200_core.c
@@ -364,7 +364,7 @@ static int itg3200_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused itg3200_suspend(struct device *dev)
+static int itg3200_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct itg3200 *st = iio_priv(indio_dev);
@@ -375,14 +375,15 @@ static int __maybe_unused itg3200_suspend(struct device *dev)
 				   ITG3200_SLEEP);
 }
 
-static int __maybe_unused itg3200_resume(struct device *dev)
+static int itg3200_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
 	return itg3200_initial_setup(indio_dev);
 }
 
-static SIMPLE_DEV_PM_OPS(itg3200_pm_ops, itg3200_suspend, itg3200_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(itg3200_pm_ops, itg3200_suspend,
+				itg3200_resume);
 
 static const struct i2c_device_id itg3200_id[] = {
 	{ "itg3200", 0 },
@@ -400,7 +401,7 @@ static struct i2c_driver itg3200_driver = {
 	.driver = {
 		.name	= "itg3200",
 		.of_match_table = itg3200_of_match,
-		.pm	= &itg3200_pm_ops,
+		.pm	= pm_sleep_ptr(&itg3200_pm_ops),
 	},
 	.id_table	= itg3200_id,
 	.probe		= itg3200_probe,
-- 
2.36.1


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

* [PATCH 17/36] iio: health: afe4403: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (15 preceding siblings ...)
  2022-06-21 20:26 ` [PATCH 16/36] iio: gyro: itg3200: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 18/36] iio: health: afe4404: " Jonathan Cameron
                   ` (19 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/health/afe4403.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
index 856ec901b091..3bb4028c5d74 100644
--- a/drivers/iio/health/afe4403.c
+++ b/drivers/iio/health/afe4403.c
@@ -408,7 +408,7 @@ static const struct of_device_id afe4403_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, afe4403_of_match);
 
-static int __maybe_unused afe4403_suspend(struct device *dev)
+static int afe4403_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
 	struct afe4403_data *afe = iio_priv(indio_dev);
@@ -429,7 +429,7 @@ static int __maybe_unused afe4403_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused afe4403_resume(struct device *dev)
+static int afe4403_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
 	struct afe4403_data *afe = iio_priv(indio_dev);
@@ -449,7 +449,8 @@ static int __maybe_unused afe4403_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(afe4403_pm_ops, afe4403_suspend, afe4403_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(afe4403_pm_ops, afe4403_suspend,
+				afe4403_resume);
 
 static int afe4403_probe(struct spi_device *spi)
 {
@@ -598,7 +599,7 @@ static struct spi_driver afe4403_spi_driver = {
 	.driver = {
 		.name = AFE4403_DRIVER_NAME,
 		.of_match_table = afe4403_of_match,
-		.pm = &afe4403_pm_ops,
+		.pm = pm_sleep_ptr(&afe4403_pm_ops),
 	},
 	.probe = afe4403_probe,
 	.remove = afe4403_remove,
-- 
2.36.1


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

* [PATCH 18/36] iio: health: afe4404: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (16 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 17/36] iio: health: afe4403: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 19/36] iio: light: al3010: " Jonathan Cameron
                   ` (18 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/health/afe4404.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
index 1bb7de60f8ca..dd7800159051 100644
--- a/drivers/iio/health/afe4404.c
+++ b/drivers/iio/health/afe4404.c
@@ -415,7 +415,7 @@ static const struct of_device_id afe4404_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, afe4404_of_match);
 
-static int __maybe_unused afe4404_suspend(struct device *dev)
+static int afe4404_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct afe4404_data *afe = iio_priv(indio_dev);
@@ -436,7 +436,7 @@ static int __maybe_unused afe4404_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused afe4404_resume(struct device *dev)
+static int afe4404_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct afe4404_data *afe = iio_priv(indio_dev);
@@ -456,7 +456,8 @@ static int __maybe_unused afe4404_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(afe4404_pm_ops, afe4404_suspend, afe4404_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(afe4404_pm_ops, afe4404_suspend,
+				afe4404_resume);
 
 static int afe4404_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
@@ -607,7 +608,7 @@ static struct i2c_driver afe4404_i2c_driver = {
 	.driver = {
 		.name = AFE4404_DRIVER_NAME,
 		.of_match_table = afe4404_of_match,
-		.pm = &afe4404_pm_ops,
+		.pm = pm_sleep_ptr(&afe4404_pm_ops),
 	},
 	.probe = afe4404_probe,
 	.remove = afe4404_remove,
-- 
2.36.1


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

* [PATCH 19/36] iio: light: al3010: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (17 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 18/36] iio: health: afe4404: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-22  9:36   ` David Heidelberg
  2022-06-21 20:27 ` [PATCH 20/36] iio: light: al3320a: " Jonathan Cameron
                   ` (17 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: David Heidelberg <david@ixit.cz>
---
 drivers/iio/light/al3010.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/al3010.c b/drivers/iio/light/al3010.c
index b4e9924094cd..ce5363845b22 100644
--- a/drivers/iio/light/al3010.c
+++ b/drivers/iio/light/al3010.c
@@ -200,17 +200,17 @@ static int al3010_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-static int __maybe_unused al3010_suspend(struct device *dev)
+static int al3010_suspend(struct device *dev)
 {
 	return al3010_set_pwr(to_i2c_client(dev), false);
 }
 
-static int __maybe_unused al3010_resume(struct device *dev)
+static int al3010_resume(struct device *dev)
 {
 	return al3010_set_pwr(to_i2c_client(dev), true);
 }
 
-static SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
 
 static const struct i2c_device_id al3010_id[] = {
 	{"al3010", },
@@ -228,7 +228,7 @@ static struct i2c_driver al3010_driver = {
 	.driver = {
 		.name = AL3010_DRV_NAME,
 		.of_match_table = al3010_of_match,
-		.pm = &al3010_pm_ops,
+		.pm = pm_sleep_ptr(&al3010_pm_ops),
 	},
 	.probe		= al3010_probe,
 	.id_table	= al3010_id,
-- 
2.36.1


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

* [PATCH 20/36] iio: light: al3320a: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (18 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 19/36] iio: light: al3010: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-25 13:06   ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 21/36] iio: light: as73211: " Jonathan Cameron
                   ` (16 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: David Heidelberg <david@ixit.cz>
---
 drivers/iio/light/al3320a.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c
index cc1407ccc10a..bc99179728ed 100644
--- a/drivers/iio/light/al3320a.c
+++ b/drivers/iio/light/al3320a.c
@@ -223,17 +223,18 @@ static int al3320a_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-static int __maybe_unused al3320a_suspend(struct device *dev)
+static int al3320a_suspend(struct device *dev)
 {
 	return al3320a_set_pwr(to_i2c_client(dev), false);
 }
 
-static int __maybe_unused al3320a_resume(struct device *dev)
+static int al3320a_resume(struct device *dev)
 {
 	return al3320a_set_pwr(to_i2c_client(dev), true);
 }
 
-static SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend, al3320a_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend,
+				al3320a_resume);
 
 static const struct i2c_device_id al3320a_id[] = {
 	{"al3320a", 0},
@@ -251,7 +252,7 @@ static struct i2c_driver al3320a_driver = {
 	.driver = {
 		.name = AL3320A_DRV_NAME,
 		.of_match_table = al3320a_of_match,
-		.pm = &al3320a_pm_ops,
+		.pm = pm_sleep_ptr(&al3320a_pm_ops),
 	},
 	.probe		= al3320a_probe,
 	.id_table	= al3320a_id,
-- 
2.36.1


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

* [PATCH 21/36] iio: light: as73211: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (19 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 20/36] iio: light: al3320a: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-23  8:46   ` Christian Eggers
  2022-06-21 20:27 ` [PATCH 22/36] iio: light: bh1750: " Jonathan Cameron
                   ` (15 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Christian Eggers <ceggers@arri.de>
---
 drivers/iio/light/as73211.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/light/as73211.c b/drivers/iio/light/as73211.c
index 3ba2378df3dd..2307fc531752 100644
--- a/drivers/iio/light/as73211.c
+++ b/drivers/iio/light/as73211.c
@@ -755,21 +755,22 @@ static int as73211_probe(struct i2c_client *client)
 	return devm_iio_device_register(dev, indio_dev);
 }
 
-static int __maybe_unused as73211_suspend(struct device *dev)
+static int as73211_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 
 	return as73211_power(indio_dev, false);
 }
 
-static int __maybe_unused as73211_resume(struct device *dev)
+static int as73211_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 
 	return as73211_power(indio_dev, true);
 }
 
-static SIMPLE_DEV_PM_OPS(as73211_pm_ops, as73211_suspend, as73211_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(as73211_pm_ops, as73211_suspend,
+				as73211_resume);
 
 static const struct of_device_id as73211_of_match[] = {
 	{ .compatible = "ams,as73211" },
@@ -787,7 +788,7 @@ static struct i2c_driver as73211_driver = {
 	.driver = {
 		.name           = AS73211_DRV_NAME,
 		.of_match_table = as73211_of_match,
-		.pm             = &as73211_pm_ops,
+		.pm             = pm_sleep_ptr(&as73211_pm_ops),
 	},
 	.probe_new  = as73211_probe,
 	.id_table   = as73211_id,
-- 
2.36.1


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

* [PATCH 22/36] iio: light: bh1750: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (20 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 21/36] iio: light: as73211: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 23/36] iio: light: cm3605: " Jonathan Cameron
                   ` (14 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tduszyns@gmail.com>
---
 drivers/iio/light/bh1750.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c
index 48484b9401b9..471985c220bb 100644
--- a/drivers/iio/light/bh1750.c
+++ b/drivers/iio/light/bh1750.c
@@ -277,7 +277,7 @@ static int bh1750_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused bh1750_suspend(struct device *dev)
+static int bh1750_suspend(struct device *dev)
 {
 	int ret;
 	struct bh1750_data *data =
@@ -294,7 +294,7 @@ static int __maybe_unused bh1750_suspend(struct device *dev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(bh1750_pm_ops, bh1750_suspend, NULL);
+static DEFINE_SIMPLE_DEV_PM_OPS(bh1750_pm_ops, bh1750_suspend, NULL);
 
 static const struct i2c_device_id bh1750_id[] = {
 	{ "bh1710", BH1710 },
@@ -320,7 +320,7 @@ static struct i2c_driver bh1750_driver = {
 	.driver = {
 		.name = "bh1750",
 		.of_match_table = bh1750_of_match,
-		.pm = &bh1750_pm_ops,
+		.pm = pm_sleep_ptr(&bh1750_pm_ops),
 	},
 	.probe = bh1750_probe,
 	.remove = bh1750_remove,
-- 
2.36.1


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

* [PATCH 23/36] iio: light: cm3605: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (21 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 22/36] iio: light: bh1750: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 24/36] iio: proximity: cros_ec_mkbp: " Jonathan Cameron
                   ` (13 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

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

diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c
index 50d34a98839c..c721b69d5095 100644
--- a/drivers/iio/light/cm3605.c
+++ b/drivers/iio/light/cm3605.c
@@ -278,7 +278,7 @@ static int cm3605_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused cm3605_pm_suspend(struct device *dev)
+static int cm3605_pm_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct cm3605 *cm3605 = iio_priv(indio_dev);
@@ -289,7 +289,7 @@ static int __maybe_unused cm3605_pm_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused cm3605_pm_resume(struct device *dev)
+static int cm3605_pm_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct cm3605 *cm3605 = iio_priv(indio_dev);
@@ -302,11 +302,8 @@ static int __maybe_unused cm3605_pm_resume(struct device *dev)
 
 	return 0;
 }
-
-static const struct dev_pm_ops cm3605_dev_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(cm3605_pm_suspend,
-				cm3605_pm_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(cm3605_dev_pm_ops, cm3605_pm_suspend,
+				cm3605_pm_resume);
 
 static const struct of_device_id cm3605_of_match[] = {
 	{.compatible = "capella,cm3605"},
@@ -318,7 +315,7 @@ static struct platform_driver cm3605_driver = {
 	.driver = {
 		.name = "cm3605",
 		.of_match_table = cm3605_of_match,
-		.pm = &cm3605_dev_pm_ops,
+		.pm = pm_sleep_ptr(&cm3605_dev_pm_ops),
 	},
 	.probe = cm3605_probe,
 	.remove = cm3605_remove,
-- 
2.36.1


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

* [PATCH 24/36] iio: proximity: cros_ec_mkbp: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (22 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 23/36] iio: light: cm3605: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 21:06   ` Gwendal Grignou
  2022-06-21 20:27 ` [PATCH 25/36] iio: temperature: ltc2983: " Jonathan Cameron
                   ` (12 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Stephen Boyd <swboyd@chromium.org>
---
 drivers/iio/proximity/cros_ec_mkbp_proximity.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/proximity/cros_ec_mkbp_proximity.c b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
index 8213b0081713..571ea1812246 100644
--- a/drivers/iio/proximity/cros_ec_mkbp_proximity.c
+++ b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
@@ -184,7 +184,7 @@ static const struct iio_info cros_ec_mkbp_proximity_info = {
 	.write_event_config = cros_ec_mkbp_proximity_write_event_config,
 };
 
-static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
+static int cros_ec_mkbp_proximity_resume(struct device *dev)
 {
 	struct cros_ec_mkbp_proximity_data *data = dev_get_drvdata(dev);
 	struct cros_ec_device *ec = data->ec;
@@ -201,8 +201,8 @@ static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
 	return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
-			 cros_ec_mkbp_proximity_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
+				cros_ec_mkbp_proximity_resume);
 
 static int cros_ec_mkbp_proximity_probe(struct platform_device *pdev)
 {
@@ -260,7 +260,7 @@ static struct platform_driver cros_ec_mkbp_proximity_driver = {
 	.driver = {
 		.name = "cros-ec-mkbp-proximity",
 		.of_match_table = cros_ec_mkbp_proximity_of_match,
-		.pm = &cros_ec_mkbp_proximity_pm_ops,
+		.pm = pm_sleep_ptr(&cros_ec_mkbp_proximity_pm_ops),
 	},
 	.probe = cros_ec_mkbp_proximity_probe,
 	.remove = cros_ec_mkbp_proximity_remove,
-- 
2.36.1


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

* [PATCH 25/36] iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (23 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 24/36] iio: proximity: cros_ec_mkbp: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-23  6:14   ` Sa, Nuno
  2022-06-21 20:27 ` [PATCH 26/36] iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
                   ` (11 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Nuno Sá <nuno.sa@analog.com>
---
 drivers/iio/temperature/ltc2983.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c
index 4b7f2b8a9758..b652d2b39bcf 100644
--- a/drivers/iio/temperature/ltc2983.c
+++ b/drivers/iio/temperature/ltc2983.c
@@ -1534,7 +1534,7 @@ static int ltc2983_probe(struct spi_device *spi)
 	return devm_iio_device_register(&spi->dev, indio_dev);
 }
 
-static int __maybe_unused ltc2983_resume(struct device *dev)
+static int ltc2983_resume(struct device *dev)
 {
 	struct ltc2983_data *st = spi_get_drvdata(to_spi_device(dev));
 	int dummy;
@@ -1545,14 +1545,15 @@ static int __maybe_unused ltc2983_resume(struct device *dev)
 	return ltc2983_setup(st, false);
 }
 
-static int __maybe_unused ltc2983_suspend(struct device *dev)
+static int ltc2983_suspend(struct device *dev)
 {
 	struct ltc2983_data *st = spi_get_drvdata(to_spi_device(dev));
 
 	return regmap_write(st->regmap, LTC2983_STATUS_REG, LTC2983_SLEEP);
 }
 
-static SIMPLE_DEV_PM_OPS(ltc2983_pm_ops, ltc2983_suspend, ltc2983_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ltc2983_pm_ops, ltc2983_suspend,
+				ltc2983_resume);
 
 static const struct spi_device_id ltc2983_id_table[] = {
 	{ "ltc2983" },
@@ -1570,7 +1571,7 @@ static struct spi_driver ltc2983_driver = {
 	.driver = {
 		.name = "ltc2983",
 		.of_match_table = ltc2983_of_match,
-		.pm = &ltc2983_pm_ops,
+		.pm = pm_sleep_ptr(&ltc2983_pm_ops),
 	},
 	.probe = ltc2983_probe,
 	.id_table = ltc2983_id_table,
-- 
2.36.1


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

* [PATCH 26/36] iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (24 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 25/36] iio: temperature: ltc2983: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 27/36] iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() Jonathan Cameron
                   ` (10 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, 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.

Very likely it would be safe to use DEFINE_RUNTIME_DEV_PM_OPS() here,
but that would be a functional change.

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

diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c
index cbd9978540fa..80d2299da561 100644
--- a/drivers/iio/light/us5182d.c
+++ b/drivers/iio/light/us5182d.c
@@ -922,7 +922,6 @@ static int us5182d_remove(struct i2c_client *client)
 	return 0;
 }
 
-#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM)
 static int us5182d_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -945,11 +944,10 @@ static int us5182d_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct dev_pm_ops us5182d_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume)
-	SET_RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume)
+	RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL)
 };
 
 static const struct acpi_device_id us5182d_acpi_match[] = {
@@ -975,7 +973,7 @@ MODULE_DEVICE_TABLE(of, us5182d_of_match);
 static struct i2c_driver us5182d_driver = {
 	.driver = {
 		.name = US5182D_DRV_NAME,
-		.pm = &us5182d_pm_ops,
+		.pm = pm_ptr(&us5182d_pm_ops),
 		.of_match_table = us5182d_of_match,
 		.acpi_match_table = ACPI_PTR(us5182d_acpi_match),
 	},
-- 
2.36.1


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

* [PATCH 27/36] iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (25 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 26/36] iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-22  9:32   ` Bough Chen
  2022-06-21 20:27 ` [PATCH 28/36] iio: light: gp2ap002: " Jonathan Cameron
                   ` (9 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Switching to these newer macros allows the compiler to remove
the unused functions and struct dev_pm_ops if !CONFIG_PM without
the need to mark anything __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Cai Huoqing <cai.huoqing@linux.dev>
---
 drivers/iio/adc/imx8qxp-adc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/adc/imx8qxp-adc.c b/drivers/iio/adc/imx8qxp-adc.c
index e8c9a69e10eb..e48446784a0a 100644
--- a/drivers/iio/adc/imx8qxp-adc.c
+++ b/drivers/iio/adc/imx8qxp-adc.c
@@ -417,7 +417,7 @@ static int imx8qxp_adc_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev)
+static int imx8qxp_adc_runtime_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct imx8qxp_adc *adc = iio_priv(indio_dev);
@@ -431,7 +431,7 @@ static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev)
+static int imx8qxp_adc_runtime_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct imx8qxp_adc *adc = iio_priv(indio_dev);
@@ -468,10 +468,9 @@ static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev)
 	return ret;
 }
 
-static const struct dev_pm_ops imx8qxp_adc_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(imx8qxp_adc_runtime_suspend, imx8qxp_adc_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(imx8qxp_adc_pm_ops,
+				 imx8qxp_adc_runtime_suspend,
+				 imx8qxp_adc_runtime_resume, NULL);
 
 static const struct of_device_id imx8qxp_adc_match[] = {
 	{ .compatible = "nxp,imx8qxp-adc", },
@@ -485,7 +484,7 @@ static struct platform_driver imx8qxp_adc_driver = {
 	.driver		= {
 		.name	= ADC_DRIVER_NAME,
 		.of_match_table = imx8qxp_adc_match,
-		.pm	= &imx8qxp_adc_pm_ops,
+		.pm	= pm_ptr(&imx8qxp_adc_pm_ops),
 	},
 };
 
-- 
2.36.1


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

* [PATCH 28/36] iio: light: gp2ap002: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (26 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 27/36] iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 29/36] iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() " Jonathan Cameron
                   ` (8 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Switching to these newer macros allows use of pm_ptr() to remove
the unused functions and structure if !CONFIG_PM without the need to
mark anything __maybe_unused.

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

diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c
index c6d1d88d3775..e2707416f9a8 100644
--- a/drivers/iio/light/gp2ap002.c
+++ b/drivers/iio/light/gp2ap002.c
@@ -635,7 +635,7 @@ static int gp2ap002_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused gp2ap002_runtime_suspend(struct device *dev)
+static int gp2ap002_runtime_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct gp2ap002 *gp2ap002 = iio_priv(indio_dev);
@@ -660,7 +660,7 @@ static int __maybe_unused gp2ap002_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused gp2ap002_runtime_resume(struct device *dev)
+static int gp2ap002_runtime_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct gp2ap002 *gp2ap002 = iio_priv(indio_dev);
@@ -691,12 +691,8 @@ static int __maybe_unused gp2ap002_runtime_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops gp2ap002_dev_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(gp2ap002_runtime_suspend,
-			   gp2ap002_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(gp2ap002_dev_pm_ops, gp2ap002_runtime_suspend,
+				 gp2ap002_runtime_resume, NULL);
 
 static const struct i2c_device_id gp2ap002_id_table[] = {
 	{ "gp2ap002", 0 },
@@ -715,7 +711,7 @@ static struct i2c_driver gp2ap002_driver = {
 	.driver = {
 		.name = "gp2ap002",
 		.of_match_table = gp2ap002_of_match,
-		.pm = &gp2ap002_dev_pm_ops,
+		.pm = pm_ptr(&gp2ap002_dev_pm_ops),
 	},
 	.probe = gp2ap002_probe,
 	.remove = gp2ap002_remove,
-- 
2.36.1


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

* [PATCH 29/36] iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (27 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 28/36] iio: light: gp2ap002: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-22 11:09   ` Brian Masney
  2022-06-21 20:27 ` [PATCH 30/36] iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS " Jonathan Cameron
                   ` (7 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these new macros allows removal of unused pm_ops structure
and functions if !CONFIG_PM without the need to mark the functions
__maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Brian Masney <masneyb@onstation.org>
---
 drivers/iio/light/isl29028.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c
index 720fa83d44e0..4dde9707a52d 100644
--- a/drivers/iio/light/isl29028.c
+++ b/drivers/iio/light/isl29028.c
@@ -651,7 +651,7 @@ static int isl29028_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused isl29028_suspend(struct device *dev)
+static int isl29028_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct isl29028_chip *chip = iio_priv(indio_dev);
@@ -666,7 +666,7 @@ static int __maybe_unused isl29028_suspend(struct device *dev)
 	return ret;
 }
 
-static int __maybe_unused isl29028_resume(struct device *dev)
+static int isl29028_resume(struct device *dev)
 {
 	/**
 	 * The specific component (ALS/IR or proximity) will enable itself as
@@ -676,11 +676,8 @@ static int __maybe_unused isl29028_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops isl29028_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(isl29028_suspend, isl29028_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(isl29028_pm_ops, isl29028_suspend,
+				 isl29028_resume, NULL);
 
 static const struct i2c_device_id isl29028_id[] = {
 	{"isl29028", 0},
@@ -700,7 +697,7 @@ MODULE_DEVICE_TABLE(of, isl29028_of_match);
 static struct i2c_driver isl29028_driver = {
 	.driver  = {
 		.name = "isl29028",
-		.pm = &isl29028_pm_ops,
+		.pm = pm_ptr(&isl29028_pm_ops),
 		.of_match_table = isl29028_of_match,
 	},
 	.probe	 = isl29028_probe,
-- 
2.36.1


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

* [PATCH 30/36] iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (28 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 29/36] iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-22 11:10   ` Brian Masney
  2022-06-21 20:27 ` [PATCH 31/36] iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() " Jonathan Cameron
                   ` (6 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these new macros allows removal of unused pm_ops structure
and functions if !CONFIG_PM without the need to mark the function
__maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Brian Masney <masneyb@onstation.org>
---
 drivers/iio/light/tsl2583.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c
index efb3c13cfc87..82662dab87c0 100644
--- a/drivers/iio/light/tsl2583.c
+++ b/drivers/iio/light/tsl2583.c
@@ -888,7 +888,7 @@ static int tsl2583_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused tsl2583_suspend(struct device *dev)
+static int tsl2583_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct tsl2583_chip *chip = iio_priv(indio_dev);
@@ -903,7 +903,7 @@ static int __maybe_unused tsl2583_suspend(struct device *dev)
 	return ret;
 }
 
-static int __maybe_unused tsl2583_resume(struct device *dev)
+static int tsl2583_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct tsl2583_chip *chip = iio_priv(indio_dev);
@@ -918,11 +918,8 @@ static int __maybe_unused tsl2583_resume(struct device *dev)
 	return ret;
 }
 
-static const struct dev_pm_ops tsl2583_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(tsl2583_suspend, tsl2583_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(tsl2583_pm_ops, tsl2583_suspend,
+				 tsl2583_resume, NULL);
 
 static const struct i2c_device_id tsl2583_idtable[] = {
 	{ "tsl2580", 0 },
@@ -944,7 +941,7 @@ MODULE_DEVICE_TABLE(of, tsl2583_of_match);
 static struct i2c_driver tsl2583_driver = {
 	.driver = {
 		.name = "tsl2583",
-		.pm = &tsl2583_pm_ops,
+		.pm = pm_ptr(&tsl2583_pm_ops),
 		.of_match_table = tsl2583_of_match,
 	},
 	.id_table = tsl2583_idtable,
-- 
2.36.1


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

* [PATCH 31/36] iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (29 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 30/36] iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 32/36] iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Jonathan Cameron
                   ` (5 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these new macros allows removal of unused pm_ops structure and
functions if !CONFIG_PM without the need to mark the functions
__maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Joe Sandom <joe.g.sandom@gmail.com>
---
 drivers/iio/light/tsl2591.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/tsl2591.c b/drivers/iio/light/tsl2591.c
index 39e68d0c9d6a..e485a556e6da 100644
--- a/drivers/iio/light/tsl2591.c
+++ b/drivers/iio/light/tsl2591.c
@@ -1019,7 +1019,7 @@ static const struct iio_info tsl2591_info_no_irq = {
 	.read_avail = tsl2591_read_available,
 };
 
-static int __maybe_unused tsl2591_suspend(struct device *dev)
+static int tsl2591_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct tsl2591_chip *chip = iio_priv(indio_dev);
@@ -1032,7 +1032,7 @@ static int __maybe_unused tsl2591_suspend(struct device *dev)
 	return ret;
 }
 
-static int __maybe_unused tsl2591_resume(struct device *dev)
+static int tsl2591_resume(struct device *dev)
 {
 	int power_state = TSL2591_PWR_ON | TSL2591_ENABLE_ALS;
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -1049,10 +1049,8 @@ static int __maybe_unused tsl2591_resume(struct device *dev)
 	return ret;
 }
 
-static const struct dev_pm_ops tsl2591_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(tsl2591_suspend, tsl2591_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(tsl2591_pm_ops, tsl2591_suspend,
+				 tsl2591_resume, NULL);
 
 static irqreturn_t tsl2591_event_handler(int irq, void *private)
 {
@@ -1213,7 +1211,7 @@ MODULE_DEVICE_TABLE(of, tsl2591_of_match);
 static struct i2c_driver tsl2591_driver = {
 	.driver = {
 		.name = "tsl2591",
-		.pm = &tsl2591_pm_ops,
+		.pm = pm_ptr(&tsl2591_pm_ops),
 		.of_match_table = tsl2591_of_match,
 	},
 	.probe_new = tsl2591_probe
-- 
2.36.1


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

* [PATCH 32/36] iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (30 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 31/36] iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 33/36] iio: light: vcnl4035: " Jonathan Cameron
                   ` (4 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these new macros allows the compiler to remove the unused dev_pm_ops
structure and related functions if !CONFIG_PM without the need to mark
the functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Mathieu Othacehe <m.othacehe@gmail.com>
---
 drivers/iio/light/vcnl4000.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 947a41b86173..3db4e26731bb 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -1130,7 +1130,7 @@ static int vcnl4000_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev)
+static int vcnl4000_runtime_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct vcnl4000_data *data = iio_priv(indio_dev);
@@ -1138,7 +1138,7 @@ static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev)
 	return data->chip_spec->set_power_state(data, false);
 }
 
-static int __maybe_unused vcnl4000_runtime_resume(struct device *dev)
+static int vcnl4000_runtime_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct vcnl4000_data *data = iio_priv(indio_dev);
@@ -1146,17 +1146,13 @@ static int __maybe_unused vcnl4000_runtime_resume(struct device *dev)
 	return data->chip_spec->set_power_state(data, true);
 }
 
-static const struct dev_pm_ops vcnl4000_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(vcnl4000_runtime_suspend,
-			   vcnl4000_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4000_pm_ops, vcnl4000_runtime_suspend,
+				 vcnl4000_runtime_resume, NULL);
 
 static struct i2c_driver vcnl4000_driver = {
 	.driver = {
 		.name   = VCNL4000_DRV_NAME,
-		.pm	= &vcnl4000_pm_ops,
+		.pm	= pm_ptr(&vcnl4000_pm_ops),
 		.of_match_table = vcnl_4000_of_match,
 	},
 	.probe  = vcnl4000_probe,
-- 
2.36.1


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

* [PATCH 33/36] iio: light: vcnl4035: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (31 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 32/36] iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 34/36] iio: light: veml6030: " Jonathan Cameron
                   ` (3 subsequent siblings)
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these new macros allows the compiler to remove the unused dev_pm_ops
structure and related functions if !CONFIG_PM without the need to mark
the functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Parthiban Nallathambi <pn@denx.de>
---
 drivers/iio/light/vcnl4035.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c
index 2aaec6bef64c..6a196cf2270b 100644
--- a/drivers/iio/light/vcnl4035.c
+++ b/drivers/iio/light/vcnl4035.c
@@ -620,7 +620,7 @@ static int vcnl4035_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev)
+static int vcnl4035_runtime_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct vcnl4035_data *data = iio_priv(indio_dev);
@@ -632,7 +632,7 @@ static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev)
 	return ret;
 }
 
-static int __maybe_unused vcnl4035_runtime_resume(struct device *dev)
+static int vcnl4035_runtime_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
 	struct vcnl4035_data *data = iio_priv(indio_dev);
@@ -649,12 +649,8 @@ static int __maybe_unused vcnl4035_runtime_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops vcnl4035_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(vcnl4035_runtime_suspend,
-			   vcnl4035_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4035_pm_ops, vcnl4035_runtime_suspend,
+				 vcnl4035_runtime_resume, NULL);
 
 static const struct i2c_device_id vcnl4035_id[] = {
 	{ "vcnl4035", 0 },
@@ -671,7 +667,7 @@ MODULE_DEVICE_TABLE(of, vcnl4035_of_match);
 static struct i2c_driver vcnl4035_driver = {
 	.driver = {
 		.name   = VCNL4035_DRV_NAME,
-		.pm	= &vcnl4035_pm_ops,
+		.pm	= pm_ptr(&vcnl4035_pm_ops),
 		.of_match_table = vcnl4035_of_match,
 	},
 	.probe  = vcnl4035_probe,
-- 
2.36.1


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

* [PATCH 34/36] iio: light: veml6030: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (32 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 33/36] iio: light: vcnl4035: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-26 18:00   ` Rishi Gupta
  2022-06-21 20:27 ` [PATCH 35/36] iio: magnetometer: ak8974: " Jonathan Cameron
                   ` (2 subsequent siblings)
  36 siblings, 1 reply; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these new macros allows the compiler to remove the unused dev_pm_ops
structure and related functions if !CONFIG_PM without the need to mark
the functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Rishi Gupta <gupt21@gmail.com>
---
 drivers/iio/light/veml6030.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
index 3c937c55a10d..9a7800cdfee2 100644
--- a/drivers/iio/light/veml6030.c
+++ b/drivers/iio/light/veml6030.c
@@ -846,7 +846,7 @@ static int veml6030_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-static int __maybe_unused veml6030_runtime_suspend(struct device *dev)
+static int veml6030_runtime_suspend(struct device *dev)
 {
 	int ret;
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -859,7 +859,7 @@ static int __maybe_unused veml6030_runtime_suspend(struct device *dev)
 	return ret;
 }
 
-static int __maybe_unused veml6030_runtime_resume(struct device *dev)
+static int veml6030_runtime_resume(struct device *dev)
 {
 	int ret;
 	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -872,12 +872,8 @@ static int __maybe_unused veml6030_runtime_resume(struct device *dev)
 	return ret;
 }
 
-static const struct dev_pm_ops veml6030_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(veml6030_runtime_suspend,
-				veml6030_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(veml6030_pm_ops, veml6030_runtime_suspend,
+				 veml6030_runtime_resume, NULL);
 
 static const struct of_device_id veml6030_of_match[] = {
 	{ .compatible = "vishay,veml6030" },
@@ -895,7 +891,7 @@ static struct i2c_driver veml6030_driver = {
 	.driver = {
 		.name = "veml6030",
 		.of_match_table = veml6030_of_match,
-		.pm = &veml6030_pm_ops,
+		.pm = pm_ptr(&veml6030_pm_ops),
 	},
 	.probe = veml6030_probe,
 	.id_table = veml6030_id,
-- 
2.36.1


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

* [PATCH 35/36] iio: magnetometer: ak8974: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (33 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 34/36] iio: light: veml6030: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-21 20:27 ` [PATCH 36/36] iio: magn: yas530: " Jonathan Cameron
  2022-06-27 23:13 ` [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Paul Cercueil
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these new macros allows the compiler to remove the unused dev_pm_ops
structure and related functions if !CONFIG_PM without the need to mark
the functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/magnetometer/ak8974.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index e54feacfb980..c89a91db0690 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -985,7 +985,7 @@ static int ak8974_remove(struct i2c_client *i2c)
 	return 0;
 }
 
-static int __maybe_unused ak8974_runtime_suspend(struct device *dev)
+static int ak8974_runtime_suspend(struct device *dev)
 {
 	struct ak8974 *ak8974 =
 		iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
@@ -996,7 +996,7 @@ static int __maybe_unused ak8974_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused ak8974_runtime_resume(struct device *dev)
+static int ak8974_runtime_resume(struct device *dev)
 {
 	struct ak8974 *ak8974 =
 		iio_priv(i2c_get_clientdata(to_i2c_client(dev)));
@@ -1024,12 +1024,8 @@ static int __maybe_unused ak8974_runtime_resume(struct device *dev)
 	return ret;
 }
 
-static const struct dev_pm_ops ak8974_dev_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(ak8974_runtime_suspend,
-			   ak8974_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(ak8974_dev_pm_ops, ak8974_runtime_suspend,
+				 ak8974_runtime_resume, NULL);
 
 static const struct i2c_device_id ak8974_id[] = {
 	{"ami305", 0 },
@@ -1050,7 +1046,7 @@ MODULE_DEVICE_TABLE(of, ak8974_of_match);
 static struct i2c_driver ak8974_driver = {
 	.driver	 = {
 		.name	= "ak8974",
-		.pm = &ak8974_dev_pm_ops,
+		.pm = pm_ptr(&ak8974_dev_pm_ops),
 		.of_match_table = ak8974_of_match,
 	},
 	.probe	  = ak8974_probe,
-- 
2.36.1


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

* [PATCH 36/36] iio: magn: yas530: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (34 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 35/36] iio: magnetometer: ak8974: " Jonathan Cameron
@ 2022-06-21 20:27 ` Jonathan Cameron
  2022-06-27 23:13 ` [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Paul Cercueil
  36 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-21 20:27 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

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

Using these new macros allows the compiler to remove the unused dev_pm_ops
structure and related functions if !CONFIG_PM without the need to mark
the functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/magnetometer/yamaha-yas530.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
index 9ff7b0e56cf6..e1f88e9bac38 100644
--- a/drivers/iio/magnetometer/yamaha-yas530.c
+++ b/drivers/iio/magnetometer/yamaha-yas530.c
@@ -965,7 +965,7 @@ static int yas5xx_remove(struct i2c_client *i2c)
 	return 0;
 }
 
-static int __maybe_unused yas5xx_runtime_suspend(struct device *dev)
+static int yas5xx_runtime_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct yas5xx *yas5xx = iio_priv(indio_dev);
@@ -976,7 +976,7 @@ static int __maybe_unused yas5xx_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused yas5xx_runtime_resume(struct device *dev)
+static int yas5xx_runtime_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct yas5xx *yas5xx = iio_priv(indio_dev);
@@ -1011,12 +1011,8 @@ static int __maybe_unused yas5xx_runtime_resume(struct device *dev)
 	return ret;
 }
 
-static const struct dev_pm_ops yas5xx_dev_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(yas5xx_runtime_suspend,
-			   yas5xx_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(yas5xx_dev_pm_ops, yas5xx_runtime_suspend,
+				 yas5xx_runtime_resume, NULL);
 
 static const struct i2c_device_id yas5xx_id[] = {
 	{"yas530", },
@@ -1038,7 +1034,7 @@ static struct i2c_driver yas5xx_driver = {
 	.driver	 = {
 		.name	= "yas5xx",
 		.of_match_table = yas5xx_of_match,
-		.pm = &yas5xx_dev_pm_ops,
+		.pm = pm_ptr(&yas5xx_dev_pm_ops),
 	},
 	.probe	  = yas5xx_probe,
 	.remove	  = yas5xx_remove,
-- 
2.36.1


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

* Re: [PATCH 24/36] iio: proximity: cros_ec_mkbp: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:27 ` [PATCH 24/36] iio: proximity: cros_ec_mkbp: " Jonathan Cameron
@ 2022-06-21 21:06   ` Gwendal Grignou
  0 siblings, 0 replies; 54+ messages in thread
From: Gwendal Grignou @ 2022-06-21 21:06 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, Brian Masney,
	David Heidelberg, Cai Huoqing, Christian Eggers,
	Enric Balletbo i Serra, Eugen Hristev, Haibo Chen, Hui Liu,
	Joe Sandom, Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Tue, Jun 21, 2022 at 1:21 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Cc: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
> ---
>  drivers/iio/proximity/cros_ec_mkbp_proximity.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/proximity/cros_ec_mkbp_proximity.c b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
> index 8213b0081713..571ea1812246 100644
> --- a/drivers/iio/proximity/cros_ec_mkbp_proximity.c
> +++ b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
> @@ -184,7 +184,7 @@ static const struct iio_info cros_ec_mkbp_proximity_info = {
>         .write_event_config = cros_ec_mkbp_proximity_write_event_config,
>  };
>
> -static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
> +static int cros_ec_mkbp_proximity_resume(struct device *dev)
>  {
>         struct cros_ec_mkbp_proximity_data *data = dev_get_drvdata(dev);
>         struct cros_ec_device *ec = data->ec;
> @@ -201,8 +201,8 @@ static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev)
>         return 0;
>  }
>
> -static SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
> -                        cros_ec_mkbp_proximity_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL,
> +                               cros_ec_mkbp_proximity_resume);
>
>  static int cros_ec_mkbp_proximity_probe(struct platform_device *pdev)
>  {
> @@ -260,7 +260,7 @@ static struct platform_driver cros_ec_mkbp_proximity_driver = {
>         .driver = {
>                 .name = "cros-ec-mkbp-proximity",
>                 .of_match_table = cros_ec_mkbp_proximity_of_match,
> -               .pm = &cros_ec_mkbp_proximity_pm_ops,
> +               .pm = pm_sleep_ptr(&cros_ec_mkbp_proximity_pm_ops),
>         },
>         .probe = cros_ec_mkbp_proximity_probe,
>         .remove = cros_ec_mkbp_proximity_remove,
> --
> 2.36.1
>

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

* Re: [PATCH 12/36] iio: dac: ltc1660: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 ` [PATCH 12/36] iio: dac: ltc1660: " Jonathan Cameron
@ 2022-06-22  6:25   ` Marcus Folkesson
  0 siblings, 0 replies; 54+ messages in thread
From: Marcus Folkesson @ 2022-06-22  6:25 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, Brian Masney,
	David Heidelberg, Cai Huoqing, Christian Eggers,
	Enric Balletbo i Serra, Eugen Hristev, Gwendal Grignou,
	Haibo Chen, Hui Liu, Joe Sandom, Ismail H . Kose,
	Lars-Peter Clausen, Linus Walleij, Ludovic Desroches,
	Nicolas Ferre, Martin Blumenstingl, Mathieu Othacehe,
	Michal Simek, Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

On Tue, Jun 21, 2022 at 09:26:55PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---

Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 08/36] iio: adc: ti-am335x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 ` [PATCH 08/36] iio: adc: ti-am335x: " Jonathan Cameron
@ 2022-06-22  6:29   ` Miquel Raynal
  0 siblings, 0 replies; 54+ messages in thread
From: Miquel Raynal @ 2022-06-22  6:29 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, Brian Masney,
	David Heidelberg, Cai Huoqing, Christian Eggers,
	Enric Balletbo i Serra, Eugen Hristev, Gwendal Grignou,
	Haibo Chen, Hui Liu, Joe Sandom, Ismail H . Kose,
	Lars-Peter Clausen, Linus Walleij, Ludovic Desroches,
	Nicolas Ferre, Marcus Folkesson, Martin Blumenstingl,
	Mathieu Othacehe, Michal Simek, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

Hi Jonathan,

(second try, with a reply all...)

jic23@kernel.org wrote on Tue, 21 Jun 2022 21:26:51 +0100:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

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

* RE: [PATCH 04/36] iio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 ` [PATCH 04/36] iio: adc: imx7d_adc: " Jonathan Cameron
@ 2022-06-22  9:31   ` Bough Chen
  0 siblings, 0 replies; 54+ messages in thread
From: Bough Chen @ 2022-06-22  9:31 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Hui Liu, Joe Sandom, Ismail H . Kose,
	Lars-Peter Clausen, Linus Walleij, Ludovic Desroches,
	Nicolas Ferre, Marcus Folkesson, Martin Blumenstingl,
	Mathieu Othacehe, Michal Simek, Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: 2022年6月22日 4:27
> To: linux-iio@vger.kernel.org; Paul Cercueil <paul@crapouillou.net>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>; Brian Masney
> <masneyb@onstation.org>; David Heidelberg <david@ixit.cz>; Cai Huoqing
> <cai.huoqing@linux.dev>; Christian Eggers <ceggers@arri.de>; Enric Balletbo i
> Serra <enric.balletbo@collabora.com>; Eugen Hristev
> <eugen.hristev@microchip.com>; Gwendal Grignou <gwendal@chromium.org>;
> Bough Chen <haibo.chen@nxp.com>; Hui Liu <hui.liu@mediatek.com>; Joe
> Sandom <joe.g.sandom@gmail.com>; Ismail H . Kose <ihkose@gmail.com>;
> Lars-Peter Clausen <lars@metafoo.de>; Linus Walleij <linus.walleij@linaro.org>;
> Ludovic Desroches <ludovic.desroches@microchip.com>; Nicolas Ferre
> <nicolas.ferre@microchip.com>; Marcus Folkesson
> <marcus.folkesson@gmail.com>; Martin Blumenstingl
> <martin.blumenstingl@googlemail.com>; Mathieu Othacehe
> <m.othacehe@gmail.com>; Michal Simek <michal.simek@xilinx.com>; Miquel
> Raynal <miquel.raynal@bootlin.com>; Nuno Sá <nuno.sa@analog.com>;
> Parthiban Nallathambi <pn@denx.de>; Philippe Reynes <tremyfr@yahoo.fr>;
> Philippe Schenker <philippe.schenker@toradex.com>; Rishi Gupta
> <gupt21@gmail.com>; Roan van Dijk <roan@protonic.nl>; Stephen Boyd
> <swboyd@chromium.org>; Tomasz Duszynski <tduszyns@gmail.com>; Zhiyong
> Tao <zhiyong.tao@mediatek.com>; Jonathan Cameron
> <Jonathan.Cameron@huawei.com>
> Subject: [PATCH 04/36] iio: adc: imx7d_adc: Switch to
> DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> In this case we only gain the ability to have the compiler drop the struct
> dev_pm_ops because the callbacks are called from paths other than suspend
> and resume.  In general the purpose of this new macro is to allow automated
> removal of the callbacks as well, but that doesn't apply here.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Haibo Chen <haibo.chen@nxp.com>

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>

> ---
>  drivers/iio/adc/imx7d_adc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c index
> 119217af2bde..86caff1d006b 100644
> --- a/drivers/iio/adc/imx7d_adc.c
> +++ b/drivers/iio/adc/imx7d_adc.c
> @@ -540,14 +540,15 @@ static int imx7d_adc_probe(struct platform_device
> *pdev)
>  	return 0;
>  }
> 
> -static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable,
> imx7d_adc_enable);
> +static DEFINE_SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops,
> imx7d_adc_disable,
> +				imx7d_adc_enable);
> 
>  static struct platform_driver imx7d_adc_driver = {
>  	.probe		= imx7d_adc_probe,
>  	.driver		= {
>  		.name	= "imx7d_adc",
>  		.of_match_table = imx7d_adc_match,
> -		.pm	= &imx7d_adc_pm_ops,
> +		.pm	= pm_sleep_ptr(&imx7d_adc_pm_ops),
>  	},
>  };
> 
> --
> 2.36.1


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

* RE: [PATCH 27/36] iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
  2022-06-21 20:27 ` [PATCH 27/36] iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() Jonathan Cameron
@ 2022-06-22  9:32   ` Bough Chen
  0 siblings, 0 replies; 54+ messages in thread
From: Bough Chen @ 2022-06-22  9:32 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Hui Liu, Joe Sandom, Ismail H . Kose,
	Lars-Peter Clausen, Linus Walleij, Ludovic Desroches,
	Nicolas Ferre, Marcus Folkesson, Martin Blumenstingl,
	Mathieu Othacehe, Michal Simek, Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: 2022年6月22日 4:27
> To: linux-iio@vger.kernel.org; Paul Cercueil <paul@crapouillou.net>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>; Brian Masney
> <masneyb@onstation.org>; David Heidelberg <david@ixit.cz>; Cai Huoqing
> <cai.huoqing@linux.dev>; Christian Eggers <ceggers@arri.de>; Enric Balletbo i
> Serra <enric.balletbo@collabora.com>; Eugen Hristev
> <eugen.hristev@microchip.com>; Gwendal Grignou <gwendal@chromium.org>;
> Bough Chen <haibo.chen@nxp.com>; Hui Liu <hui.liu@mediatek.com>; Joe
> Sandom <joe.g.sandom@gmail.com>; Ismail H . Kose <ihkose@gmail.com>;
> Lars-Peter Clausen <lars@metafoo.de>; Linus Walleij <linus.walleij@linaro.org>;
> Ludovic Desroches <ludovic.desroches@microchip.com>; Nicolas Ferre
> <nicolas.ferre@microchip.com>; Marcus Folkesson
> <marcus.folkesson@gmail.com>; Martin Blumenstingl
> <martin.blumenstingl@googlemail.com>; Mathieu Othacehe
> <m.othacehe@gmail.com>; Michal Simek <michal.simek@xilinx.com>; Miquel
> Raynal <miquel.raynal@bootlin.com>; Nuno Sá <nuno.sa@analog.com>;
> Parthiban Nallathambi <pn@denx.de>; Philippe Reynes <tremyfr@yahoo.fr>;
> Philippe Schenker <philippe.schenker@toradex.com>; Rishi Gupta
> <gupt21@gmail.com>; Roan van Dijk <roan@protonic.nl>; Stephen Boyd
> <swboyd@chromium.org>; Tomasz Duszynski <tduszyns@gmail.com>; Zhiyong
> Tao <zhiyong.tao@mediatek.com>; Jonathan Cameron
> <Jonathan.Cameron@huawei.com>
> Subject: [PATCH 27/36] iio: adc: imx8qxp: Switch to
> DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Switching to these newer macros allows the compiler to remove the unused
> functions and struct dev_pm_ops if !CONFIG_PM without the need to mark
> anything __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Cai Huoqing <cai.huoqing@linux.dev>

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>

> ---
>  drivers/iio/adc/imx8qxp-adc.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/adc/imx8qxp-adc.c b/drivers/iio/adc/imx8qxp-adc.c index
> e8c9a69e10eb..e48446784a0a 100644
> --- a/drivers/iio/adc/imx8qxp-adc.c
> +++ b/drivers/iio/adc/imx8qxp-adc.c
> @@ -417,7 +417,7 @@ static int imx8qxp_adc_remove(struct platform_device
> *pdev)
>  	return 0;
>  }
> 
> -static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev)
> +static int imx8qxp_adc_runtime_suspend(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct imx8qxp_adc *adc = iio_priv(indio_dev); @@ -431,7 +431,7 @@
> static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev)
>  	return 0;
>  }
> 
> -static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev)
> +static int imx8qxp_adc_runtime_resume(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>  	struct imx8qxp_adc *adc = iio_priv(indio_dev); @@ -468,10 +468,9 @@
> static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev)
>  	return ret;
>  }
> 
> -static const struct dev_pm_ops imx8qxp_adc_pm_ops = {
> -	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> pm_runtime_force_resume)
> -	SET_RUNTIME_PM_OPS(imx8qxp_adc_runtime_suspend,
> imx8qxp_adc_runtime_resume, NULL)
> -};
> +static DEFINE_RUNTIME_DEV_PM_OPS(imx8qxp_adc_pm_ops,
> +				 imx8qxp_adc_runtime_suspend,
> +				 imx8qxp_adc_runtime_resume, NULL);
> 
>  static const struct of_device_id imx8qxp_adc_match[] = {
>  	{ .compatible = "nxp,imx8qxp-adc", },
> @@ -485,7 +484,7 @@ static struct platform_driver imx8qxp_adc_driver = {
>  	.driver		= {
>  		.name	= ADC_DRIVER_NAME,
>  		.of_match_table = imx8qxp_adc_match,
> -		.pm	= &imx8qxp_adc_pm_ops,
> +		.pm	= pm_ptr(&imx8qxp_adc_pm_ops),
>  	},
>  };
> 
> --
> 2.36.1


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

* Re: [PATCH 19/36] iio: light: al3010: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:27 ` [PATCH 19/36] iio: light: al3010: " Jonathan Cameron
@ 2022-06-22  9:36   ` David Heidelberg
  0 siblings, 0 replies; 54+ messages in thread
From: David Heidelberg @ 2022-06-22  9:36 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, Cai Huoqing, Christian Eggers,
	Enric Balletbo i Serra, Eugen Hristev, Gwendal Grignou,
	Haibo Chen, Hui Liu, Joe Sandom, Ismail H . Kose,
	Lars-Peter Clausen, Linus Walleij, Ludovic Desroches,
	Nicolas Ferre, Marcus Folkesson, Martin Blumenstingl,
	Mathieu Othacehe, Michal Simek, Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

both patches 19 and 20:

Reviewed-by: David Heidelberg <david@ixit.cz>

On 21/06/2022 22:27, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: David Heidelberg <david@ixit.cz>
> ---
>   drivers/iio/light/al3010.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/light/al3010.c b/drivers/iio/light/al3010.c
> index b4e9924094cd..ce5363845b22 100644
> --- a/drivers/iio/light/al3010.c
> +++ b/drivers/iio/light/al3010.c
> @@ -200,17 +200,17 @@ static int al3010_probe(struct i2c_client *client,
>   	return devm_iio_device_register(&client->dev, indio_dev);
>   }
>   
> -static int __maybe_unused al3010_suspend(struct device *dev)
> +static int al3010_suspend(struct device *dev)
>   {
>   	return al3010_set_pwr(to_i2c_client(dev), false);
>   }
>   
> -static int __maybe_unused al3010_resume(struct device *dev)
> +static int al3010_resume(struct device *dev)
>   {
>   	return al3010_set_pwr(to_i2c_client(dev), true);
>   }
>   
> -static SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
>   
>   static const struct i2c_device_id al3010_id[] = {
>   	{"al3010", },
> @@ -228,7 +228,7 @@ static struct i2c_driver al3010_driver = {
>   	.driver = {
>   		.name = AL3010_DRV_NAME,
>   		.of_match_table = al3010_of_match,
> -		.pm = &al3010_pm_ops,
> +		.pm = pm_sleep_ptr(&al3010_pm_ops),
>   	},
>   	.probe		= al3010_probe,
>   	.id_table	= al3010_id,

-- 
David Heidelberg
Consultant Software Engineer

Matrix: @okias:matrix.org


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

* Re: [PATCH 29/36] iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
  2022-06-21 20:27 ` [PATCH 29/36] iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() " Jonathan Cameron
@ 2022-06-22 11:09   ` Brian Masney
  0 siblings, 0 replies; 54+ messages in thread
From: Brian Masney @ 2022-06-22 11:09 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, David Heidelberg,
	Cai Huoqing, Christian Eggers, Enric Balletbo i Serra,
	Eugen Hristev, Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Tue, Jun 21, 2022 at 09:27:12PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Using these new macros allows removal of unused pm_ops structure
> and functions if !CONFIG_PM without the need to mark the functions
> __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Brian Masney <masneyb@onstation.org>

Reviewed-by: Brian Masney <masneyb@onstation.org>


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

* Re: [PATCH 30/36] iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
  2022-06-21 20:27 ` [PATCH 30/36] iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS " Jonathan Cameron
@ 2022-06-22 11:10   ` Brian Masney
  0 siblings, 0 replies; 54+ messages in thread
From: Brian Masney @ 2022-06-22 11:10 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, David Heidelberg,
	Cai Huoqing, Christian Eggers, Enric Balletbo i Serra,
	Eugen Hristev, Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Tue, Jun 21, 2022 at 09:27:13PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Using these new macros allows removal of unused pm_ops structure
> and functions if !CONFIG_PM without the need to mark the function
> __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Brian Masney <masneyb@onstation.org>

Reviewed-by: Brian Masney <masneyb@onstation.org>


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

* RE: [PATCH 25/36] iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:27 ` [PATCH 25/36] iio: temperature: ltc2983: " Jonathan Cameron
@ 2022-06-23  6:14   ` Sa, Nuno
  0 siblings, 0 replies; 54+ messages in thread
From: Sa, Nuno @ 2022-06-23  6:14 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Parthiban Nallathambi, Philippe Reynes,
	Philippe Schenker, Rishi Gupta, Roan van Dijk, Stephen Boyd,
	Tomasz Duszynski, Zhiyong Tao, Jonathan Cameron

> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Tuesday, June 21, 2022 10:27 PM
> To: linux-iio@vger.kernel.org; Paul Cercueil <paul@crapouillou.net>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>; Brian Masney
> <masneyb@onstation.org>; David Heidelberg <david@ixit.cz>; Cai
> Huoqing <cai.huoqing@linux.dev>; Christian Eggers
> <ceggers@arri.de>; Enric Balletbo i Serra
> <enric.balletbo@collabora.com>; Eugen Hristev
> <eugen.hristev@microchip.com>; Gwendal Grignou
> <gwendal@chromium.org>; Haibo Chen <haibo.chen@nxp.com>; Hui
> Liu <hui.liu@mediatek.com>; Joe Sandom
> <joe.g.sandom@gmail.com>; Ismail H . Kose <ihkose@gmail.com>;
> Lars-Peter Clausen <lars@metafoo.de>; Linus Walleij
> <linus.walleij@linaro.org>; Ludovic Desroches
> <ludovic.desroches@microchip.com>; Nicolas Ferre
> <nicolas.ferre@microchip.com>; Marcus Folkesson
> <marcus.folkesson@gmail.com>; Martin Blumenstingl
> <martin.blumenstingl@googlemail.com>; Mathieu Othacehe
> <m.othacehe@gmail.com>; Michal Simek <michal.simek@xilinx.com>;
> Miquel Raynal <miquel.raynal@bootlin.com>; Sa, Nuno
> <Nuno.Sa@analog.com>; Parthiban Nallathambi <pn@denx.de>;
> Philippe Reynes <tremyfr@yahoo.fr>; Philippe Schenker
> <philippe.schenker@toradex.com>; Rishi Gupta <gupt21@gmail.com>;
> Roan van Dijk <roan@protonic.nl>; Stephen Boyd
> <swboyd@chromium.org>; Tomasz Duszynski <tduszyns@gmail.com>;
> Zhiyong Tao <zhiyong.tao@mediatek.com>; Jonathan Cameron
> <Jonathan.Cameron@huawei.com>
> Subject: [PATCH 25/36] iio: temperature: ltc2983: Switch to
> DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
> 
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the
> need to
> mark pm functions __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Nuno Sá <nuno.sa@analog.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

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

* Re: [PATCH 21/36] iio: light: as73211: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:27 ` [PATCH 21/36] iio: light: as73211: " Jonathan Cameron
@ 2022-06-23  8:46   ` Christian Eggers
  0 siblings, 0 replies; 54+ messages in thread
From: Christian Eggers @ 2022-06-23  8:46 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil, Jonathan Cameron
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Enric Balletbo i Serra, Eugen Hristev, Gwendal Grignou,
	Haibo Chen, Hui Liu, Joe Sandom, Ismail H . Kose,
	Lars-Peter Clausen, Linus Walleij, Ludovic Desroches,
	Nicolas Ferre, Marcus Folkesson, Martin Blumenstingl,
	Mathieu Othacehe, Michal Simek, Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Tuesday, 21 June 2022, 22:27:04 CEST, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Christian Eggers <ceggers@arri.de>
Reviewed-by: Christian Eggers <ceggers@arri.de>




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

* Re: [PATCH 20/36] iio: light: al3320a: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:27 ` [PATCH 20/36] iio: light: al3320a: " Jonathan Cameron
@ 2022-06-25 13:06   ` Jonathan Cameron
  0 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-25 13:06 UTC (permalink / raw)
  To: linux-iio, Paul Cercueil
  Cc: Alexandre Belloni, Brian Masney, David Heidelberg, Cai Huoqing,
	Christian Eggers, Enric Balletbo i Serra, Eugen Hristev,
	Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Tue, 21 Jun 2022 21:27:03 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: David Heidelberg <david@ixit.cz>
I'll just copy this here from reply to patch 19 so b4 will do
everything automatically for me. 

both patches 19 and 20:

Reviewed-by: David Heidelberg <david@ixit.cz>

> ---
>  drivers/iio/light/al3320a.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c
> index cc1407ccc10a..bc99179728ed 100644
> --- a/drivers/iio/light/al3320a.c
> +++ b/drivers/iio/light/al3320a.c
> @@ -223,17 +223,18 @@ static int al3320a_probe(struct i2c_client *client,
>  	return devm_iio_device_register(&client->dev, indio_dev);
>  }
>  
> -static int __maybe_unused al3320a_suspend(struct device *dev)
> +static int al3320a_suspend(struct device *dev)
>  {
>  	return al3320a_set_pwr(to_i2c_client(dev), false);
>  }
>  
> -static int __maybe_unused al3320a_resume(struct device *dev)
> +static int al3320a_resume(struct device *dev)
>  {
>  	return al3320a_set_pwr(to_i2c_client(dev), true);
>  }
>  
> -static SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend, al3320a_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend,
> +				al3320a_resume);
>  
>  static const struct i2c_device_id al3320a_id[] = {
>  	{"al3320a", 0},
> @@ -251,7 +252,7 @@ static struct i2c_driver al3320a_driver = {
>  	.driver = {
>  		.name = AL3320A_DRV_NAME,
>  		.of_match_table = al3320a_of_match,
> -		.pm = &al3320a_pm_ops,
> +		.pm = pm_sleep_ptr(&al3320a_pm_ops),
>  	},
>  	.probe		= al3320a_probe,
>  	.id_table	= al3320a_id,


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

* Re: [PATCH 14/36] iio: dac: max5821: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
       [not found]   ` <CABEhyf-N-hi7z3SQK4FRWyztwJ=3t17NZT-gGCEugQhUkpcZQA@mail.gmail.com>
@ 2022-06-25 13:07     ` Jonathan Cameron
  0 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-25 13:07 UTC (permalink / raw)
  To: Ismail Kose
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, Brian Masney,
	David Heidelberg, Cai Huoqing, Christian Eggers,
	Enric Balletbo i Serra, Eugen Hristev, Gwendal Grignou,
	Haibo Chen, Hui Liu, Joe Sandom, Lars-Peter Clausen,
	Linus Walleij, Ludovic Desroches, Nicolas Ferre,
	Marcus Folkesson, Martin Blumenstingl, Mathieu Othacehe,
	Michal Simek, Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Thu, 23 Jun 2022 10:58:30 -0700
Ismail Kose <ihkose@gmail.com> wrote:

> Signed-off
> ismail

Tag for this would be
Acked-by
as you aren't involved in the sign of chain for this one, rather you
are reviewing.

If you can confirm that it would be much appreciated.
> 
> 
> On Tue, Jun 21, 2022 at 1:19 PM Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Using these newer macros allows the compiler to remove the unused
> > structure and functions when !CONFIG_PM_SLEEP + removes the need to
> > mark pm functions __maybe_unused.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Philippe Reynes <tremyfr@yahoo.fr>
> > ---
> >  drivers/iio/dac/max5821.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c
> > index 540f9ea7cada..e001b594d5b1 100644
> > --- a/drivers/iio/dac/max5821.c
> > +++ b/drivers/iio/dac/max5821.c
> > @@ -267,7 +267,7 @@ static int max5821_write_raw(struct iio_dev *indio_dev,
> >         }
> >  }
> >
> > -static int __maybe_unused max5821_suspend(struct device *dev)
> > +static int max5821_suspend(struct device *dev)
> >  {
> >         u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
> >                          MAX5821_EXTENDED_DAC_A |
> > @@ -277,7 +277,7 @@ static int __maybe_unused max5821_suspend(struct
> > device *dev)
> >         return i2c_master_send(to_i2c_client(dev), outbuf, 2);
> >  }
> >
> > -static int __maybe_unused max5821_resume(struct device *dev)
> > +static int max5821_resume(struct device *dev)
> >  {
> >         u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
> >                          MAX5821_EXTENDED_DAC_A |
> > @@ -287,7 +287,8 @@ static int __maybe_unused max5821_resume(struct device
> > *dev)
> >         return i2c_master_send(to_i2c_client(dev), outbuf, 2);
> >  }
> >
> > -static SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, max5821_resume);
> > +static DEFINE_SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend,
> > +                               max5821_resume);
> >
> >  static const struct iio_info max5821_info = {
> >         .read_raw = max5821_read_raw,
> > @@ -374,7 +375,7 @@ static struct i2c_driver max5821_driver = {
> >         .driver = {
> >                 .name   = "max5821",
> >                 .of_match_table = max5821_of_match,
> > -               .pm     = &max5821_pm_ops,
> > +               .pm     = pm_sleep_ptr(&max5821_pm_ops),
> >         },
> >         .probe          = max5821_probe,
> >         .id_table       = max5821_id,
> > --
> > 2.36.1
> >
> >  


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

* Re: [PATCH 11/36] iio: dac: ds4424: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
       [not found]   ` <CABEhyf8EezacO8hSCDtz8kDnWeTWFJYBz0XJufjmyprv5u3rmw@mail.gmail.com>
@ 2022-06-25 13:08     ` Jonathan Cameron
  0 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-06-25 13:08 UTC (permalink / raw)
  To: Ismail Kose
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, Brian Masney,
	David Heidelberg, Cai Huoqing, Christian Eggers,
	Enric Balletbo i Serra, Eugen Hristev, Gwendal Grignou,
	Haibo Chen, Hui Liu, Joe Sandom, Lars-Peter Clausen,
	Linus Walleij, Ludovic Desroches, Nicolas Ferre,
	Marcus Folkesson, Martin Blumenstingl, Mathieu Othacehe,
	Michal Simek, Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Thu, 23 Jun 2022 11:04:12 -0700
Ismail Kose <ihkose@gmail.com> wrote:

> signed-off
> ismail.
Hi Ismail,

Thanks for taking a look.

As with the other one, please reply with an
Acked-by tag fully stated as that's what we need to apply it to the patch
(and what automated tooling like b4 will be looking for.

Thanks,

Jonathan

> 
> 
> On Tue, Jun 21, 2022 at 1:19 PM Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Using these newer macros allows the compiler to remove the unused
> > structure and functions when !CONFIG_PM_SLEEP + removes the need to
> > mark pm functions __maybe_unused.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Ismail H. Kose <ihkose@gmail.com>
> > ---
> >  drivers/iio/dac/ds4424.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c
> > index 5a5e967b0be4..509394690bcc 100644
> > --- a/drivers/iio/dac/ds4424.c
> > +++ b/drivers/iio/dac/ds4424.c
> > @@ -171,7 +171,7 @@ static int ds4424_verify_chip(struct iio_dev
> > *indio_dev)
> >         return ret;
> >  }
> >
> > -static int __maybe_unused ds4424_suspend(struct device *dev)
> > +static int ds4424_suspend(struct device *dev)
> >  {
> >         struct i2c_client *client = to_i2c_client(dev);
> >         struct iio_dev *indio_dev = i2c_get_clientdata(client);
> > @@ -189,7 +189,7 @@ static int __maybe_unused ds4424_suspend(struct device
> > *dev)
> >         return ret;
> >  }
> >
> > -static int __maybe_unused ds4424_resume(struct device *dev)
> > +static int ds4424_resume(struct device *dev)
> >  {
> >         struct i2c_client *client = to_i2c_client(dev);
> >         struct iio_dev *indio_dev = i2c_get_clientdata(client);
> > @@ -206,7 +206,7 @@ static int __maybe_unused ds4424_resume(struct device
> > *dev)
> >         return ret;
> >  }
> >
> > -static SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend, ds4424_resume);
> > +static DEFINE_SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend,
> > ds4424_resume);
> >
> >  static const struct iio_info ds4424_info = {
> >         .read_raw = ds4424_read_raw,
> > @@ -312,7 +312,7 @@ static struct i2c_driver ds4424_driver = {
> >         .driver = {
> >                 .name   = "ds4424",
> >                 .of_match_table = ds4424_of_match,
> > -               .pm     = &ds4424_pm_ops,
> > +               .pm     = pm_sleep_ptr(&ds4424_pm_ops),
> >         },
> >         .probe          = ds4424_probe,
> >         .remove         = ds4424_remove,
> > --
> > 2.36.1
> >
> >  


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

* Re: [PATCH 34/36] iio: light: veml6030: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros
  2022-06-21 20:27 ` [PATCH 34/36] iio: light: veml6030: " Jonathan Cameron
@ 2022-06-26 18:00   ` Rishi Gupta
  0 siblings, 0 replies; 54+ messages in thread
From: Rishi Gupta @ 2022-06-26 18:00 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, Brian Masney,
	David Heidelberg, Cai Huoqing, Christian Eggers,
	Enric Balletbo i Serra, Eugen Hristev, Gwendal Grignou,
	Haibo Chen, Hui Liu, Joe Sandom, Ismail H . Kose,
	Lars-Peter Clausen, Linus Walleij, Ludovic Desroches,
	Nicolas Ferre, Marcus Folkesson, Martin Blumenstingl,
	Mathieu Othacehe, Michal Simek, Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Roan van Dijk, Stephen Boyd, Tomasz Duszynski, Zhiyong Tao,
	Jonathan Cameron

On Tue, Jun 21, 2022 at 1:22 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Using these new macros allows the compiler to remove the unused dev_pm_ops
> structure and related functions if !CONFIG_PM without the need to mark
> the functions __maybe_unused.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Rishi Gupta <gupt21@gmail.com>
> ---
>  drivers/iio/light/veml6030.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
> index 3c937c55a10d..9a7800cdfee2 100644
> --- a/drivers/iio/light/veml6030.c
> +++ b/drivers/iio/light/veml6030.c
> @@ -846,7 +846,7 @@ static int veml6030_probe(struct i2c_client *client,
>         return devm_iio_device_register(&client->dev, indio_dev);
>  }
>
> -static int __maybe_unused veml6030_runtime_suspend(struct device *dev)
> +static int veml6030_runtime_suspend(struct device *dev)
>  {
>         int ret;
>         struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> @@ -859,7 +859,7 @@ static int __maybe_unused veml6030_runtime_suspend(struct device *dev)
>         return ret;
>  }
>
> -static int __maybe_unused veml6030_runtime_resume(struct device *dev)
> +static int veml6030_runtime_resume(struct device *dev)
>  {
>         int ret;
>         struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> @@ -872,12 +872,8 @@ static int __maybe_unused veml6030_runtime_resume(struct device *dev)
>         return ret;
>  }
>
> -static const struct dev_pm_ops veml6030_pm_ops = {
> -       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> -                               pm_runtime_force_resume)
> -       SET_RUNTIME_PM_OPS(veml6030_runtime_suspend,
> -                               veml6030_runtime_resume, NULL)
> -};
> +static DEFINE_RUNTIME_DEV_PM_OPS(veml6030_pm_ops, veml6030_runtime_suspend,
> +                                veml6030_runtime_resume, NULL);
>
>  static const struct of_device_id veml6030_of_match[] = {
>         { .compatible = "vishay,veml6030" },
> @@ -895,7 +891,7 @@ static struct i2c_driver veml6030_driver = {
>         .driver = {
>                 .name = "veml6030",
>                 .of_match_table = veml6030_of_match,
> -               .pm = &veml6030_pm_ops,
> +               .pm = pm_ptr(&veml6030_pm_ops),
>         },
>         .probe = veml6030_probe,
>         .id_table = veml6030_id,
> --
> 2.36.1
>
Reviewed-by: Rishi Gupta <gupt21@gmail.com>

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

* Re: [PATCH 05/36] iio: adc: meson_saradc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
  2022-06-21 20:26 ` [PATCH 05/36] iio: adc: meson_saradc: " Jonathan Cameron
@ 2022-06-26 22:04   ` Martin Blumenstingl
  0 siblings, 0 replies; 54+ messages in thread
From: Martin Blumenstingl @ 2022-06-26 22:04 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Paul Cercueil, Alexandre Belloni, Brian Masney,
	David Heidelberg, Cai Huoqing, Christian Eggers,
	Enric Balletbo i Serra, Eugen Hristev, Gwendal Grignou,
	Haibo Chen, Hui Liu, Joe Sandom, Ismail H . Kose,
	Lars-Peter Clausen, Linus Walleij, Ludovic Desroches,
	Nicolas Ferre, Marcus Folkesson, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Tue, Jun 21, 2022 at 10:18 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Using these newer macros allows the compiler to remove the unused
> structure and functions when !CONFIG_PM_SLEEP + removes the need to
> mark pm functions __maybe_unused.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

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

* Re: [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros.
  2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
                   ` (35 preceding siblings ...)
  2022-06-21 20:27 ` [PATCH 36/36] iio: magn: yas530: " Jonathan Cameron
@ 2022-06-27 23:13 ` Paul Cercueil
  2022-07-18 17:49   ` Jonathan Cameron
  36 siblings, 1 reply; 54+ messages in thread
From: Paul Cercueil @ 2022-06-27 23:13 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandre Belloni, Brian Masney, David Heidelberg,
	Cai Huoqing, Christian Eggers, Enric Balletbo i Serra,
	Eugen Hristev, Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

Hi Jonathan,

Every patch looks fine to me, so:

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

for the whole series.

Cheers,
-Paul


Le mar., juin 21 2022 at 21:26:43 +0100, Jonathan Cameron 
<jic23@kernel.org> a écrit :
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> After Paul's work [1] to cleanup us the PM related macros allow
> use of pm_ptr() and pm_sleep_ptr() making the compiler figure
> out what structures and functions can be dropped without 
> __maybe_unused
> mess, I've been working through converting IIO.
> [1] 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/pm.h?id=c06ef740d401d0f4ab188882bf6f8d9cf0f75eaf
> 
> This particular set is the low hanging fruit. The majority of
> the remainder in IIO require more thought because:
> 
> 1) They only have runtime pm callbacks, but no sleep ones. Need to 
> check
>    there is no reason we can't use use the force_runtime_suspend 
> approach.
> 2) Odd cases like using same functions for sleep and runtime pm but 
> not
>    via force runtime suspend.
> 3) Other weird corner cases where I want to take a closer look before
>    sending them out (I think some of them are buggy).
> 
> Anyhow, whilst I've CC'd a lot of people I suspect some will no longer
> be active on these addresses - hence if anyone has time to look at a 
> few
> patches rather than just the ones for drivers they maintain that would
> be much appreciated. In some cases I haven't CC'd anyone on a 
> particular
> patch because I'm fairly sure the author is not longer at the same
> address. Any review of those ones in particular would be great.
> 
> Thanks,
> 
> Jonathan
> 
> Jonathan Cameron (36):
>   iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: adc: ad799x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: adc: at91-sam5d2:  Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: adc: meson_saradc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: adc: mt6577_auxadc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: adc: stmpe-adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: adc: ti-am335x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: adc: xilinx-ams: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: chemical: scd4x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: dac: ds4424: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: dac: ltc1660: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: dac: max517: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: dac: max5821: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: dac: mcp4725: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: gyro: itg3200: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: health: afe4403: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: health: afe4404: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: light: al3010: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: light: al3320a: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: light: as73211: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: light: bh1750: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: light: cm3605: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: proximity: cros_ec_mkbp: Switch to DEFINE_SIMPLE_DEV_PM_OPS() 
> and
>     pm_sleep_ptr()
>   iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
>     pm_sleep_ptr()
>   iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc
>   iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
>   iio: light: gp2ap002: Switch to DEFINE_RUNTIME_DEV_PM_OPS and 
> pm_ptr()
>   iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
>   iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
>   iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
>   iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
>     macros
>   iio: light: vcnl4035: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
>     macros
>   iio: light: veml6030: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
>     macros
>   iio: magnetometer: ak8974: Use DEFINE_RUNTIME_DEV_PM_OPS() and
>     pm_ptr() macros
>   iio: magn: yas530: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() 
> macros
> 
>  drivers/iio/accel/bma220_spi.c                 |  8 ++++----
>  drivers/iio/adc/ad799x.c                       |  8 ++++----
>  drivers/iio/adc/at91-sama5d2_adc.c             |  9 +++++----
>  drivers/iio/adc/imx7d_adc.c                    |  5 +++--
>  drivers/iio/adc/imx8qxp-adc.c                  | 13 ++++++-------
>  drivers/iio/adc/meson_saradc.c                 | 10 +++++-----
>  drivers/iio/adc/mt6577_auxadc.c                | 12 ++++++------
>  drivers/iio/adc/stmpe-adc.c                    |  6 +++---
>  drivers/iio/adc/ti_am335x_adc.c                |  8 ++++----
>  drivers/iio/adc/xilinx-ams.c                   |  8 ++++----
>  drivers/iio/chemical/scd4x.c                   |  8 ++++----
>  drivers/iio/dac/ds4424.c                       |  8 ++++----
>  drivers/iio/dac/ltc1660.c                      |  9 +++++----
>  drivers/iio/dac/max517.c                       |  8 ++++----
>  drivers/iio/dac/max5821.c                      |  9 +++++----
>  drivers/iio/dac/mcp4725.c                      |  9 +++++----
>  drivers/iio/gyro/itg3200_core.c                |  9 +++++----
>  drivers/iio/health/afe4403.c                   |  9 +++++----
>  drivers/iio/health/afe4404.c                   |  9 +++++----
>  drivers/iio/light/al3010.c                     |  8 ++++----
>  drivers/iio/light/al3320a.c                    |  9 +++++----
>  drivers/iio/light/as73211.c                    |  9 +++++----
>  drivers/iio/light/bh1750.c                     |  6 +++---
>  drivers/iio/light/cm3605.c                     | 13 +++++--------
>  drivers/iio/light/gp2ap002.c                   | 14 +++++---------
>  drivers/iio/light/isl29028.c                   | 13 +++++--------
>  drivers/iio/light/tsl2583.c                    | 13 +++++--------
>  drivers/iio/light/tsl2591.c                    | 12 +++++-------
>  drivers/iio/light/us5182d.c                    |  8 +++-----
>  drivers/iio/light/vcnl4000.c                   | 14 +++++---------
>  drivers/iio/light/vcnl4035.c                   | 14 +++++---------
>  drivers/iio/light/veml6030.c                   | 14 +++++---------
>  drivers/iio/magnetometer/ak8974.c              | 14 +++++---------
>  drivers/iio/magnetometer/yamaha-yas530.c       | 14 +++++---------
>  drivers/iio/proximity/cros_ec_mkbp_proximity.c |  8 ++++----
>  drivers/iio/temperature/ltc2983.c              |  9 +++++----
>  36 files changed, 165 insertions(+), 192 deletions(-)
> 
> --
> 2.36.1
> 



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

* Re: [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros.
  2022-06-27 23:13 ` [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Paul Cercueil
@ 2022-07-18 17:49   ` Jonathan Cameron
  0 siblings, 0 replies; 54+ messages in thread
From: Jonathan Cameron @ 2022-07-18 17:49 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: linux-iio, Alexandre Belloni, Brian Masney, David Heidelberg,
	Cai Huoqing, Christian Eggers, Enric Balletbo i Serra,
	Eugen Hristev, Gwendal Grignou, Haibo Chen, Hui Liu, Joe Sandom,
	Ismail H . Kose, Lars-Peter Clausen, Linus Walleij,
	Ludovic Desroches, Nicolas Ferre, Marcus Folkesson,
	Martin Blumenstingl, Mathieu Othacehe, Michal Simek,
	Miquel Raynal, Nuno Sá,
	Parthiban Nallathambi, Philippe Reynes, Philippe Schenker,
	Rishi Gupta, Roan van Dijk, Stephen Boyd, Tomasz Duszynski,
	Zhiyong Tao, Jonathan Cameron

On Tue, 28 Jun 2022 00:13:45 +0100
Paul Cercueil <paul@crapouillou.net> wrote:

> Hi Jonathan,
> 
> Every patch looks fine to me, so:
> 
> Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Thanks!

Series applied to the togreg branch of iio.git and pushed out as
testing for a very brief exposure to 0-day before letting next see
them.

Thanks,

Jonathan

> 
> for the whole series.
> 
> Cheers,
> -Paul
> 
> 
> Le mar., juin 21 2022 at 21:26:43 +0100, Jonathan Cameron 
> <jic23@kernel.org> a écrit :
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > After Paul's work [1] to cleanup us the PM related macros allow
> > use of pm_ptr() and pm_sleep_ptr() making the compiler figure
> > out what structures and functions can be dropped without 
> > __maybe_unused
> > mess, I've been working through converting IIO.
> > [1] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/pm.h?id=c06ef740d401d0f4ab188882bf6f8d9cf0f75eaf
> > 
> > This particular set is the low hanging fruit. The majority of
> > the remainder in IIO require more thought because:
> > 
> > 1) They only have runtime pm callbacks, but no sleep ones. Need to 
> > check
> >    there is no reason we can't use use the force_runtime_suspend 
> > approach.
> > 2) Odd cases like using same functions for sleep and runtime pm but 
> > not
> >    via force runtime suspend.
> > 3) Other weird corner cases where I want to take a closer look before
> >    sending them out (I think some of them are buggy).
> > 
> > Anyhow, whilst I've CC'd a lot of people I suspect some will no longer
> > be active on these addresses - hence if anyone has time to look at a 
> > few
> > patches rather than just the ones for drivers they maintain that would
> > be much appreciated. In some cases I haven't CC'd anyone on a 
> > particular
> > patch because I'm fairly sure the author is not longer at the same
> > address. Any review of those ones in particular would be great.
> > 
> > Thanks,
> > 
> > Jonathan
> > 
> > Jonathan Cameron (36):
> >   iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: adc: ad799x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: adc: at91-sam5d2:  Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: adc: meson_saradc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: adc: mt6577_auxadc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: adc: stmpe-adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: adc: ti-am335x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: adc: xilinx-ams: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: chemical: scd4x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: dac: ds4424: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: dac: ltc1660: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: dac: max517: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: dac: max5821: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: dac: mcp4725: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: gyro: itg3200: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: health: afe4403: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: health: afe4404: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: light: al3010: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: light: al3320a: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: light: as73211: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: light: bh1750: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: light: cm3605: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: proximity: cros_ec_mkbp: Switch to DEFINE_SIMPLE_DEV_PM_OPS() 
> > and
> >     pm_sleep_ptr()
> >   iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
> >     pm_sleep_ptr()
> >   iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc
> >   iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
> >   iio: light: gp2ap002: Switch to DEFINE_RUNTIME_DEV_PM_OPS and 
> > pm_ptr()
> >   iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
> >   iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr()
> >   iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
> >   iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
> >     macros
> >   iio: light: vcnl4035: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
> >     macros
> >   iio: light: veml6030: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
> >     macros
> >   iio: magnetometer: ak8974: Use DEFINE_RUNTIME_DEV_PM_OPS() and
> >     pm_ptr() macros
> >   iio: magn: yas530: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() 
> > macros
> > 
> >  drivers/iio/accel/bma220_spi.c                 |  8 ++++----
> >  drivers/iio/adc/ad799x.c                       |  8 ++++----
> >  drivers/iio/adc/at91-sama5d2_adc.c             |  9 +++++----
> >  drivers/iio/adc/imx7d_adc.c                    |  5 +++--
> >  drivers/iio/adc/imx8qxp-adc.c                  | 13 ++++++-------
> >  drivers/iio/adc/meson_saradc.c                 | 10 +++++-----
> >  drivers/iio/adc/mt6577_auxadc.c                | 12 ++++++------
> >  drivers/iio/adc/stmpe-adc.c                    |  6 +++---
> >  drivers/iio/adc/ti_am335x_adc.c                |  8 ++++----
> >  drivers/iio/adc/xilinx-ams.c                   |  8 ++++----
> >  drivers/iio/chemical/scd4x.c                   |  8 ++++----
> >  drivers/iio/dac/ds4424.c                       |  8 ++++----
> >  drivers/iio/dac/ltc1660.c                      |  9 +++++----
> >  drivers/iio/dac/max517.c                       |  8 ++++----
> >  drivers/iio/dac/max5821.c                      |  9 +++++----
> >  drivers/iio/dac/mcp4725.c                      |  9 +++++----
> >  drivers/iio/gyro/itg3200_core.c                |  9 +++++----
> >  drivers/iio/health/afe4403.c                   |  9 +++++----
> >  drivers/iio/health/afe4404.c                   |  9 +++++----
> >  drivers/iio/light/al3010.c                     |  8 ++++----
> >  drivers/iio/light/al3320a.c                    |  9 +++++----
> >  drivers/iio/light/as73211.c                    |  9 +++++----
> >  drivers/iio/light/bh1750.c                     |  6 +++---
> >  drivers/iio/light/cm3605.c                     | 13 +++++--------
> >  drivers/iio/light/gp2ap002.c                   | 14 +++++---------
> >  drivers/iio/light/isl29028.c                   | 13 +++++--------
> >  drivers/iio/light/tsl2583.c                    | 13 +++++--------
> >  drivers/iio/light/tsl2591.c                    | 12 +++++-------
> >  drivers/iio/light/us5182d.c                    |  8 +++-----
> >  drivers/iio/light/vcnl4000.c                   | 14 +++++---------
> >  drivers/iio/light/vcnl4035.c                   | 14 +++++---------
> >  drivers/iio/light/veml6030.c                   | 14 +++++---------
> >  drivers/iio/magnetometer/ak8974.c              | 14 +++++---------
> >  drivers/iio/magnetometer/yamaha-yas530.c       | 14 +++++---------
> >  drivers/iio/proximity/cros_ec_mkbp_proximity.c |  8 ++++----
> >  drivers/iio/temperature/ltc2983.c              |  9 +++++----
> >  36 files changed, 165 insertions(+), 192 deletions(-)
> > 
> > --
> > 2.36.1
> >   
> 
> 


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

end of thread, other threads:[~2022-07-18 17:39 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 20:26 [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Jonathan Cameron
2022-06-21 20:26 ` [PATCH 01/36] iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
2022-06-21 20:26 ` [PATCH 02/36] iio: adc: ad799x: " Jonathan Cameron
2022-06-21 20:26 ` [PATCH 03/36] iio: adc: at91-sam5d2: " Jonathan Cameron
2022-06-21 20:26 ` [PATCH 04/36] iio: adc: imx7d_adc: " Jonathan Cameron
2022-06-22  9:31   ` Bough Chen
2022-06-21 20:26 ` [PATCH 05/36] iio: adc: meson_saradc: " Jonathan Cameron
2022-06-26 22:04   ` Martin Blumenstingl
2022-06-21 20:26 ` [PATCH 06/36] iio: adc: mt6577_auxadc: " Jonathan Cameron
2022-06-21 20:26 ` [PATCH 07/36] iio: adc: stmpe-adc: " Jonathan Cameron
2022-06-21 20:26 ` [PATCH 08/36] iio: adc: ti-am335x: " Jonathan Cameron
2022-06-22  6:29   ` Miquel Raynal
2022-06-21 20:26 ` [PATCH 09/36] iio: adc: xilinx-ams: " Jonathan Cameron
2022-06-21 20:26 ` [PATCH 10/36] iio: chemical: scd4x: " Jonathan Cameron
2022-06-21 20:26 ` [PATCH 11/36] iio: dac: ds4424: " Jonathan Cameron
     [not found]   ` <CABEhyf8EezacO8hSCDtz8kDnWeTWFJYBz0XJufjmyprv5u3rmw@mail.gmail.com>
2022-06-25 13:08     ` Jonathan Cameron
2022-06-21 20:26 ` [PATCH 12/36] iio: dac: ltc1660: " Jonathan Cameron
2022-06-22  6:25   ` Marcus Folkesson
2022-06-21 20:26 ` [PATCH 13/36] iio: dac: max517: " Jonathan Cameron
2022-06-21 20:26 ` [PATCH 14/36] iio: dac: max5821: " Jonathan Cameron
     [not found]   ` <CABEhyf-N-hi7z3SQK4FRWyztwJ=3t17NZT-gGCEugQhUkpcZQA@mail.gmail.com>
2022-06-25 13:07     ` Jonathan Cameron
2022-06-21 20:26 ` [PATCH 15/36] iio: dac: mcp4725: " Jonathan Cameron
2022-06-21 20:26 ` [PATCH 16/36] iio: gyro: itg3200: " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 17/36] iio: health: afe4403: " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 18/36] iio: health: afe4404: " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 19/36] iio: light: al3010: " Jonathan Cameron
2022-06-22  9:36   ` David Heidelberg
2022-06-21 20:27 ` [PATCH 20/36] iio: light: al3320a: " Jonathan Cameron
2022-06-25 13:06   ` Jonathan Cameron
2022-06-21 20:27 ` [PATCH 21/36] iio: light: as73211: " Jonathan Cameron
2022-06-23  8:46   ` Christian Eggers
2022-06-21 20:27 ` [PATCH 22/36] iio: light: bh1750: " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 23/36] iio: light: cm3605: " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 24/36] iio: proximity: cros_ec_mkbp: " Jonathan Cameron
2022-06-21 21:06   ` Gwendal Grignou
2022-06-21 20:27 ` [PATCH 25/36] iio: temperature: ltc2983: " Jonathan Cameron
2022-06-23  6:14   ` Sa, Nuno
2022-06-21 20:27 ` [PATCH 26/36] iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc Jonathan Cameron
2022-06-21 20:27 ` [PATCH 27/36] iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() Jonathan Cameron
2022-06-22  9:32   ` Bough Chen
2022-06-21 20:27 ` [PATCH 28/36] iio: light: gp2ap002: " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 29/36] iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() " Jonathan Cameron
2022-06-22 11:09   ` Brian Masney
2022-06-21 20:27 ` [PATCH 30/36] iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS " Jonathan Cameron
2022-06-22 11:10   ` Brian Masney
2022-06-21 20:27 ` [PATCH 31/36] iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 32/36] iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Jonathan Cameron
2022-06-21 20:27 ` [PATCH 33/36] iio: light: vcnl4035: " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 34/36] iio: light: veml6030: " Jonathan Cameron
2022-06-26 18:00   ` Rishi Gupta
2022-06-21 20:27 ` [PATCH 35/36] iio: magnetometer: ak8974: " Jonathan Cameron
2022-06-21 20:27 ` [PATCH 36/36] iio: magn: yas530: " Jonathan Cameron
2022-06-27 23:13 ` [PATCH 00/36] IIO: switch easy cases to new simpler PM related macros Paul Cercueil
2022-07-18 17:49   ` 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.