diff mbox series

[25/36] iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Message ID 20220621202719.13644-26-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series IIO: switch easy cases to new simpler PM related macros. | expand

Commit Message

Jonathan Cameron June 21, 2022, 8:27 p.m. UTC
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(-)

Comments

Nuno Sa June 23, 2022, 6:14 a.m. UTC | #1
> 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>
diff mbox series

Patch

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,