Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

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>

authored by

Jonathan Cameron and committed by
Guenter Roeck
29805956 00f4095c

+3 -13
+1 -1
drivers/hwmon/adt7310.c
··· 152 152 static struct spi_driver adt7310_driver = { 153 153 .driver = { 154 154 .name = "adt7310", 155 - .pm = ADT7X10_DEV_PM_OPS, 155 + .pm = pm_sleep_ptr(&adt7x10_dev_pm_ops), 156 156 }, 157 157 .probe = adt7310_spi_probe, 158 158 .id_table = adt7310_id,
+1 -1
drivers/hwmon/adt7410.c
··· 98 98 .class = I2C_CLASS_HWMON, 99 99 .driver = { 100 100 .name = "adt7410", 101 - .pm = ADT7X10_DEV_PM_OPS, 101 + .pm = pm_sleep_ptr(&adt7x10_dev_pm_ops), 102 102 }, 103 103 .probe_new = adt7410_i2c_probe, 104 104 .id_table = adt7410_ids,
+1 -6
drivers/hwmon/adt7x10.c
··· 397 397 } 398 398 EXPORT_SYMBOL_GPL(adt7x10_probe); 399 399 400 - #ifdef CONFIG_PM_SLEEP 401 - 402 400 static int adt7x10_suspend(struct device *dev) 403 401 { 404 402 struct adt7x10_data *data = dev_get_drvdata(dev); ··· 412 414 return regmap_write(data->regmap, ADT7X10_CONFIG, data->config); 413 415 } 414 416 415 - SIMPLE_DEV_PM_OPS(adt7x10_dev_pm_ops, adt7x10_suspend, adt7x10_resume); 416 - EXPORT_SYMBOL_GPL(adt7x10_dev_pm_ops); 417 - 418 - #endif /* CONFIG_PM_SLEEP */ 417 + EXPORT_SIMPLE_DEV_PM_OPS(adt7x10_dev_pm_ops, adt7x10_suspend, adt7x10_resume); 419 418 420 419 MODULE_AUTHOR("Hartmut Knaack"); 421 420 MODULE_DESCRIPTION("ADT7410/ADT7420, ADT7310/ADT7320 common code");
-5
drivers/hwmon/adt7x10.h
··· 20 20 int adt7x10_probe(struct device *dev, const char *name, int irq, 21 21 struct regmap *regmap); 22 22 23 - #ifdef CONFIG_PM_SLEEP 24 23 extern const struct dev_pm_ops adt7x10_dev_pm_ops; 25 - #define ADT7X10_DEV_PM_OPS (&adt7x10_dev_pm_ops) 26 - #else 27 - #define ADT7X10_DEV_PM_OPS NULL 28 - #endif 29 24 30 25 #endif