iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Fri, 1 Apr 2022 14:06:03 +0000 (15:06 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 5 Apr 2022 18:16:34 +0000 (20:16 +0200)
Whilst here move to the new infrastructure using pm_sleep_ptr()
and EXPORT_DEV_PM_OPS() so as to let the compiler remove the unused
code if CONFIG_SLEEP is not defined.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/iio/chemical/scd30.h
drivers/iio/chemical/scd30_core.c
drivers/iio/chemical/scd30_i2c.c
drivers/iio/chemical/scd30_serial.c

index f60127b..1ac9f3f 100644 (file)
@@ -68,10 +68,7 @@ struct scd30_state {
        scd30_command_t command;
 };
 
-int scd30_suspend(struct device *dev);
-int scd30_resume(struct device *dev);
-
-static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
+extern const struct dev_pm_ops scd30_pm_ops;
 
 int scd30_probe(struct device *dev, int irq, const char *name, void *priv, scd30_command_t command);
 
index 9fe6bbe..6c6c11c 100644 (file)
@@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = {
        IIO_CHAN_SOFT_TIMESTAMP(3),
 };
 
-int __maybe_unused scd30_suspend(struct device *dev)
+static int scd30_suspend(struct device *dev)
 {
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct scd30_state *state  = iio_priv(indio_dev);
@@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev)
 
        return regulator_disable(state->vdd);
 }
-EXPORT_SYMBOL(scd30_suspend);
 
-int __maybe_unused scd30_resume(struct device *dev)
+static int scd30_resume(struct device *dev)
 {
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct scd30_state *state = iio_priv(indio_dev);
@@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev)
 
        return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
 }
-EXPORT_SYMBOL(scd30_resume);
+
+EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
 
 static void scd30_stop_meas(void *data)
 {
index 875892a..7c332e4 100644 (file)
@@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = {
        .driver = {
                .name = KBUILD_MODNAME,
                .of_match_table = scd30_i2c_of_match,
-               .pm = &scd30_pm_ops,
+               .pm = pm_sleep_ptr(&scd30_pm_ops),
        },
        .probe_new = scd30_i2c_probe,
 };
index 568b344..8664f3c 100644 (file)
@@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = {
        .driver = {
                .name = KBUILD_MODNAME,
                .of_match_table = scd30_serdev_of_match,
-               .pm = &scd30_pm_ops,
+               .pm = pm_sleep_ptr(&scd30_pm_ops),
        },
        .probe = scd30_serdev_probe,
 };