iio: chemical: scd4x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 21 Jun 2022 20:26:53 +0000 (21:26 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 18 Jul 2022 17:48:17 +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: Roan van Dijk <roan@protonic.nl>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-11-jic23@kernel.org
drivers/iio/chemical/scd4x.c

index 37143b5..5406653 100644 (file)
@@ -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,
 };