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

index a7f1bbb5f289d23b1aa61df6842b3f0f8b8abea9..0491c64e1b3295fabf2929cf0cc9f8138dee2942 100644 (file)
@@ -364,7 +364,7 @@ static int itg3200_remove(struct i2c_client *client)
        return 0;
 }
 
-static int __maybe_unused itg3200_suspend(struct device *dev)
+static int itg3200_suspend(struct device *dev)
 {
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct itg3200 *st = iio_priv(indio_dev);
@@ -375,14 +375,15 @@ static int __maybe_unused itg3200_suspend(struct device *dev)
                                   ITG3200_SLEEP);
 }
 
-static int __maybe_unused itg3200_resume(struct device *dev)
+static int itg3200_resume(struct device *dev)
 {
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
 
        return itg3200_initial_setup(indio_dev);
 }
 
-static SIMPLE_DEV_PM_OPS(itg3200_pm_ops, itg3200_suspend, itg3200_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(itg3200_pm_ops, itg3200_suspend,
+                               itg3200_resume);
 
 static const struct i2c_device_id itg3200_id[] = {
        { "itg3200", 0 },
@@ -400,7 +401,7 @@ static struct i2c_driver itg3200_driver = {
        .driver = {
                .name   = "itg3200",
                .of_match_table = itg3200_of_match,
-               .pm     = &itg3200_pm_ops,
+               .pm     = pm_sleep_ptr(&itg3200_pm_ops),
        },
        .id_table       = itg3200_id,
        .probe          = itg3200_probe,