All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Paul Cercueil <paul@crapouillou.net>,
	Gwendal Grignou <gwendal@chromium.org>,
	Andreas Klinger <ak@it-klinger.de>,
	LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>,
	Mike Looijmans <mike.looijmans@topic.nl>,
	Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCH 6/6] iio: light: st_uvis25: Use EXPORT_NS_SIMPLE_DEV_PM_OPS()
Date: Sun,  7 Aug 2022 19:56:18 +0100	[thread overview]
Message-ID: <20220807185618.1038812-7-jic23@kernel.org> (raw)
In-Reply-To: <20220807185618.1038812-1-jic23@kernel.org>

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

Using this new macro removes the need to mark the callbacks
__maybe_unused.  One slightly complexity in this case is that
the export will exist if CONFIG_PM is set, but only be used
if CONFIG_PM_SLEEP is also set. This is harmless.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
---
 drivers/iio/light/st_uvis25_core.c | 9 +++------
 drivers/iio/light/st_uvis25_i2c.c  | 2 +-
 drivers/iio/light/st_uvis25_spi.c  | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/light/st_uvis25_core.c b/drivers/iio/light/st_uvis25_core.c
index 3d4cc1180b6a..c737d3e193ae 100644
--- a/drivers/iio/light/st_uvis25_core.c
+++ b/drivers/iio/light/st_uvis25_core.c
@@ -325,7 +325,7 @@ int st_uvis25_probe(struct device *dev, int irq, struct regmap *regmap)
 }
 EXPORT_SYMBOL_NS(st_uvis25_probe, IIO_UVIS25);
 
-static int __maybe_unused st_uvis25_suspend(struct device *dev)
+static int st_uvis25_suspend(struct device *dev)
 {
 	struct iio_dev *iio_dev = dev_get_drvdata(dev);
 	struct st_uvis25_hw *hw = iio_priv(iio_dev);
@@ -334,7 +334,7 @@ static int __maybe_unused st_uvis25_suspend(struct device *dev)
 				  ST_UVIS25_REG_ODR_MASK, 0);
 }
 
-static int __maybe_unused st_uvis25_resume(struct device *dev)
+static int st_uvis25_resume(struct device *dev)
 {
 	struct iio_dev *iio_dev = dev_get_drvdata(dev);
 	struct st_uvis25_hw *hw = iio_priv(iio_dev);
@@ -346,10 +346,7 @@ static int __maybe_unused st_uvis25_resume(struct device *dev)
 	return 0;
 }
 
-const struct dev_pm_ops st_uvis25_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(st_uvis25_suspend, st_uvis25_resume)
-};
-EXPORT_SYMBOL_NS(st_uvis25_pm_ops, IIO_UVIS25);
+EXPORT_NS_SIMPLE_DEV_PM_OPS(st_uvis25_pm_ops, st_uvis25_suspend, st_uvis25_resume, IIO_UVIS25);
 
 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>");
 MODULE_DESCRIPTION("STMicroelectronics uvis25 sensor driver");
diff --git a/drivers/iio/light/st_uvis25_i2c.c b/drivers/iio/light/st_uvis25_i2c.c
index b06d09af28a3..c982b0b255cf 100644
--- a/drivers/iio/light/st_uvis25_i2c.c
+++ b/drivers/iio/light/st_uvis25_i2c.c
@@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(i2c, st_uvis25_i2c_id_table);
 static struct i2c_driver st_uvis25_driver = {
 	.driver = {
 		.name = "st_uvis25_i2c",
-		.pm = &st_uvis25_pm_ops,
+		.pm = pm_sleep_ptr(&st_uvis25_pm_ops),
 		.of_match_table = st_uvis25_i2c_of_match,
 	},
 	.probe = st_uvis25_i2c_probe,
diff --git a/drivers/iio/light/st_uvis25_spi.c b/drivers/iio/light/st_uvis25_spi.c
index 3a4dc6d7180c..86a232320d7d 100644
--- a/drivers/iio/light/st_uvis25_spi.c
+++ b/drivers/iio/light/st_uvis25_spi.c
@@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(spi, st_uvis25_spi_id_table);
 static struct spi_driver st_uvis25_driver = {
 	.driver = {
 		.name = "st_uvis25_spi",
-		.pm = &st_uvis25_pm_ops,
+		.pm = pm_sleep_ptr(&st_uvis25_pm_ops),
 		.of_match_table = st_uvis25_spi_of_match,
 	},
 	.probe = st_uvis25_spi_probe,
-- 
2.37.1


  parent reply	other threads:[~2022-08-07 18:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 18:56 [PATCH 0/6] iio: PM macro rework continued Jonathan Cameron
2022-08-07 18:56 ` [PATCH 1/6] iio: proximity: sx9310: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
2022-09-18 17:33   ` Jonathan Cameron
2022-08-07 18:56 ` [PATCH 2/6] iio: proximity: sx9324: " Jonathan Cameron
2022-09-18 17:36   ` Jonathan Cameron
2022-08-07 18:56 ` [PATCH 3/6] iio: proximity: sx9360: " Jonathan Cameron
2022-09-18 17:36   ` Jonathan Cameron
2022-08-07 18:56 ` [PATCH 4/6] iio: proximity: srf04: Use pm_ptr() to remove unused struct dev_pm_ops Jonathan Cameron
2022-08-08  9:28   ` Andy Shevchenko
2022-08-08  9:34     ` Paul Cercueil
2022-08-08  9:39       ` Andy Shevchenko
2022-08-08  9:49         ` Paul Cercueil
2022-08-08 10:09           ` Andy Shevchenko
2022-08-08 10:17             ` Paul Cercueil
2022-08-08 10:26               ` Andy Shevchenko
2022-09-18 17:38   ` Jonathan Cameron
2022-08-07 18:56 ` [PATCH 5/6] iio: accel: bmi088: Use EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS() and pm_ptr() Jonathan Cameron
2022-09-18 17:41   ` Jonathan Cameron
2022-08-07 18:56 ` Jonathan Cameron [this message]
2022-09-18 17:42   ` [PATCH 6/6] iio: light: st_uvis25: Use EXPORT_NS_SIMPLE_DEV_PM_OPS() Jonathan Cameron
2022-08-08  9:29 ` [PATCH 0/6] iio: PM macro rework continued Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220807185618.1038812-7-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Qing-wu.Li@leica-geosystems.com.cn \
    --cc=ak@it-klinger.de \
    --cc=gwendal@chromium.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=mike.looijmans@topic.nl \
    --cc=paul@crapouillou.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.