]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 21 Jun 2022 20:27:08 +0000 (21:27 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 18 Jul 2022 17:48:18 +0000 (18:48 +0100)
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>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-26-jic23@kernel.org
drivers/iio/temperature/ltc2983.c

index 4b7f2b8a97586ee6fe9d2552c94291f8d61f9913..b652d2b39bcf216376bafc29f4b2daa3ce9f39f8 100644 (file)
@@ -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,