hwmon: (abitguru) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 25 Sep 2022 17:27:42 +0000 (18:27 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 25 Sep 2022 21:22:11 +0000 (14:22 -0700)
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP.  This allows the removal of messy #ifdef barriers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220925172759.3573439-2-jic23@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/abituguru.c

index 681f0623868f08fb575a2396292d695dd83f035c..a7cae6568155810c3b58b5ade099256763604394 100644 (file)
@@ -1504,7 +1504,6 @@ LEAVE_UPDATE:
                return NULL;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int abituguru_suspend(struct device *dev)
 {
        struct abituguru_data *data = dev_get_drvdata(dev);
@@ -1526,16 +1525,12 @@ static int abituguru_resume(struct device *dev)
        return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
-#define ABIT_UGURU_PM  (&abituguru_pm)
-#else
-#define ABIT_UGURU_PM  NULL
-#endif /* CONFIG_PM */
+static DEFINE_SIMPLE_DEV_PM_OPS(abituguru_pm, abituguru_suspend, abituguru_resume);
 
 static struct platform_driver abituguru_driver = {
        .driver = {
                .name   = ABIT_UGURU_NAME,
-               .pm     = ABIT_UGURU_PM,
+               .pm     = pm_sleep_ptr(&abituguru_pm),
        },
        .probe          = abituguru_probe,
        .remove         = abituguru_remove,