]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iio: adc: at91-sam5d2: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 21 Jun 2022 20:26:46 +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: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-4-jic23@kernel.org
drivers/iio/adc/at91-sama5d2_adc.c

index fe3131c9593cc1de96ad023946cde17d87ba29df..279430c1d88c3c69223145d5fbd49b61483eb6c8 100644 (file)
@@ -2103,7 +2103,7 @@ static int at91_adc_remove(struct platform_device *pdev)
        return 0;
 }
 
-static __maybe_unused int at91_adc_suspend(struct device *dev)
+static int at91_adc_suspend(struct device *dev)
 {
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct at91_adc_state *st = iio_priv(indio_dev);
@@ -2123,7 +2123,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)
        return pinctrl_pm_select_sleep_state(dev);
 }
 
-static __maybe_unused int at91_adc_resume(struct device *dev)
+static int at91_adc_resume(struct device *dev)
 {
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct at91_adc_state *st = iio_priv(indio_dev);
@@ -2169,7 +2169,8 @@ resume_failed:
        return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend,
+                               at91_adc_resume);
 
 static const struct of_device_id at91_adc_dt_match[] = {
        {
@@ -2190,7 +2191,7 @@ static struct platform_driver at91_adc_driver = {
        .driver = {
                .name = "at91-sama5d2_adc",
                .of_match_table = at91_adc_dt_match,
-               .pm = &at91_adc_pm_ops,
+               .pm = pm_sleep_ptr(&at91_adc_pm_ops),
        },
 };
 module_platform_driver(at91_adc_driver)