hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 25 Sep 2022 17:27:45 +0000 (18:27 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 25 Sep 2022 21:22:12 +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 whilst
achieving the same result.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20220925172759.3573439-5-jic23@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/adt7310.c
drivers/hwmon/adt7410.c
drivers/hwmon/adt7x10.c
drivers/hwmon/adt7x10.h

index 1efc0bdcceabdc1d2bffd28872420dfb1b821865..067865f4887a794cfb9199cd6c259e6b3bf2b8bb 100644 (file)
@@ -152,7 +152,7 @@ MODULE_DEVICE_TABLE(spi, adt7310_id);
 static struct spi_driver adt7310_driver = {
        .driver = {
                .name   = "adt7310",
-               .pm     = ADT7X10_DEV_PM_OPS,
+               .pm     = pm_sleep_ptr(&adt7x10_dev_pm_ops),
        },
        .probe          = adt7310_spi_probe,
        .id_table       = adt7310_id,
index aede5baca7b9f92ef5ce4f84bb50d0063ca36e09..0cebf6777239eb3e0c090f5b2c01e44032e16b87 100644 (file)
@@ -98,7 +98,7 @@ static struct i2c_driver adt7410_driver = {
        .class          = I2C_CLASS_HWMON,
        .driver = {
                .name   = "adt7410",
-               .pm     = ADT7X10_DEV_PM_OPS,
+               .pm     = pm_sleep_ptr(&adt7x10_dev_pm_ops),
        },
        .probe_new      = adt7410_i2c_probe,
        .id_table       = adt7410_ids,
index ce54bffab2ec2c8774f03f4832d414e7440cc83d..da67734edafd756b574d3be9a394849d37f20ffd 100644 (file)
@@ -397,8 +397,6 @@ int adt7x10_probe(struct device *dev, const char *name, int irq,
 }
 EXPORT_SYMBOL_GPL(adt7x10_probe);
 
-#ifdef CONFIG_PM_SLEEP
-
 static int adt7x10_suspend(struct device *dev)
 {
        struct adt7x10_data *data = dev_get_drvdata(dev);
@@ -414,10 +412,7 @@ static int adt7x10_resume(struct device *dev)
        return regmap_write(data->regmap, ADT7X10_CONFIG, data->config);
 }
 
-SIMPLE_DEV_PM_OPS(adt7x10_dev_pm_ops, adt7x10_suspend, adt7x10_resume);
-EXPORT_SYMBOL_GPL(adt7x10_dev_pm_ops);
-
-#endif /* CONFIG_PM_SLEEP */
+EXPORT_SIMPLE_DEV_PM_OPS(adt7x10_dev_pm_ops, adt7x10_suspend, adt7x10_resume);
 
 MODULE_AUTHOR("Hartmut Knaack");
 MODULE_DESCRIPTION("ADT7410/ADT7420, ADT7310/ADT7320 common code");
index ba22c32c83552bb16f62ea9ddee9dc91490bdbb6..46caf3e21978756d678580b9f96a52d6700c4804 100644 (file)
@@ -20,11 +20,6 @@ struct device;
 int adt7x10_probe(struct device *dev, const char *name, int irq,
                  struct regmap *regmap);
 
-#ifdef CONFIG_PM_SLEEP
 extern const struct dev_pm_ops adt7x10_dev_pm_ops;
-#define ADT7X10_DEV_PM_OPS (&adt7x10_dev_pm_ops)
-#else
-#define ADT7X10_DEV_PM_OPS NULL
-#endif
 
 #endif