* [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity
@ 2022-09-25 17:27 Jonathan Cameron
2022-09-25 17:27 ` [PATCH 01/18] hwmon: (abitguru) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
` (18 more replies)
0 siblings, 19 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Recently a solution was added to avoiding the need to either guard
pm functions with #ifdef magic, or mark the __maybe_unused.
https://lore.kernel.org/all/20220107181723.54392-1-paul@crapouillou.net/
This series switches hwmon over to the new macros that are intended to replace
SIMPLE_DEV_PM_OPS and similar.
There are a few drivers in hwmon that might be able fine using
DEFINE_SIMPLE_PM_OPS() but currently do not define as many of the
callbacks as that macro does. As such I haven't touched them in this set.
This is part of general effort to get rid of examples of the older macros
that might get copied in new drivers.
Jonathan Cameron (18):
hwmon: (abitguru) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (abitguru3) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (acpi_power_meter) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (it87) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
hwmon: (lm90) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (max31730) witch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (max6639) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (nct6775) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (pwm-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (tmp102) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (tmp103) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (tmp108) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (w83627ehf) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and
pm_sleep_ptr()
hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
drivers/hwmon/abituguru.c | 9 ++-------
drivers/hwmon/abituguru3.c | 9 ++-------
drivers/hwmon/acpi_power_meter.c | 9 +++------
drivers/hwmon/adt7310.c | 2 +-
drivers/hwmon/adt7410.c | 2 +-
drivers/hwmon/adt7x10.c | 7 +------
drivers/hwmon/adt7x10.h | 5 -----
drivers/hwmon/gpio-fan.c | 9 ++-------
drivers/hwmon/ina3221.c | 13 +++++--------
drivers/hwmon/it87.c | 8 ++++----
drivers/hwmon/lm90.c | 8 ++++----
drivers/hwmon/ltc2947-core.c | 7 +++----
drivers/hwmon/ltc2947-i2c.c | 2 +-
drivers/hwmon/ltc2947-spi.c | 2 +-
drivers/hwmon/max31722.c | 8 ++++----
drivers/hwmon/max31730.c | 8 ++++----
drivers/hwmon/max6639.c | 6 ++----
drivers/hwmon/nct6775-platform.c | 8 ++++----
drivers/hwmon/pwm-fan.c | 6 ++----
drivers/hwmon/tmp102.c | 6 ++----
drivers/hwmon/tmp103.c | 8 ++++----
drivers/hwmon/tmp108.c | 8 ++++----
drivers/hwmon/w83627ehf.c | 8 ++++----
23 files changed, 60 insertions(+), 98 deletions(-)
--
2.37.2
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 01/18] hwmon: (abitguru) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 02/18] hwmon: (abitguru3) " Jonathan Cameron
` (17 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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>
---
drivers/hwmon/abituguru.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c
index 681f0623868f..a7cae6568155 100644
--- a/drivers/hwmon/abituguru.c
+++ b/drivers/hwmon/abituguru.c
@@ -1504,7 +1504,6 @@ static struct abituguru_data *abituguru_update_device(struct device *dev)
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,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 02/18] hwmon: (abitguru3) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
2022-09-25 17:27 ` [PATCH 01/18] hwmon: (abitguru) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 03/18] hwmon: (acpi_power_meter) " Jonathan Cameron
` (16 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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: Hans de Goede <hdegoede@redhat.com>
---
drivers/hwmon/abituguru3.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index 8229ad30c909..afb21f73032d 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -1127,7 +1127,6 @@ static struct abituguru3_data *abituguru3_update_device(struct device *dev)
return NULL;
}
-#ifdef CONFIG_PM_SLEEP
static int abituguru3_suspend(struct device *dev)
{
struct abituguru3_data *data = dev_get_drvdata(dev);
@@ -1146,16 +1145,12 @@ static int abituguru3_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume);
-#define ABIT_UGURU3_PM (&abituguru3_pm)
-#else
-#define ABIT_UGURU3_PM NULL
-#endif /* CONFIG_PM */
+static DEFINE_SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume);
static struct platform_driver abituguru3_driver = {
.driver = {
.name = ABIT_UGURU3_NAME,
- .pm = ABIT_UGURU3_PM
+ .pm = pm_sleep_ptr(&abituguru3_pm),
},
.probe = abituguru3_probe,
.remove = abituguru3_remove,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 03/18] hwmon: (acpi_power_meter) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
2022-09-25 17:27 ` [PATCH 01/18] hwmon: (abitguru) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
2022-09-25 17:27 ` [PATCH 02/18] hwmon: (abitguru3) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 04/18] hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
` (15 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/hwmon/acpi_power_meter.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index d2545a1be9fc..6d02947409d5 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -927,8 +927,6 @@ static int acpi_power_meter_remove(struct acpi_device *device)
return 0;
}
-#ifdef CONFIG_PM_SLEEP
-
static int acpi_power_meter_resume(struct device *dev)
{
struct acpi_power_meter_resource *resource;
@@ -946,9 +944,8 @@ static int acpi_power_meter_resume(struct device *dev)
return 0;
}
-#endif /* CONFIG_PM_SLEEP */
-
-static SIMPLE_DEV_PM_OPS(acpi_power_meter_pm, NULL, acpi_power_meter_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(acpi_power_meter_pm, NULL,
+ acpi_power_meter_resume);
static struct acpi_driver acpi_power_meter_driver = {
.name = "power_meter",
@@ -959,7 +956,7 @@ static struct acpi_driver acpi_power_meter_driver = {
.remove = acpi_power_meter_remove,
.notify = acpi_power_meter_notify,
},
- .drv.pm = &acpi_power_meter_pm,
+ .drv.pm = pm_sleep_ptr(&acpi_power_meter_pm),
};
/* Module init/exit routines */
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 04/18] hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (2 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 03/18] hwmon: (acpi_power_meter) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 05/18] hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
` (14 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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>
---
drivers/hwmon/adt7310.c | 2 +-
drivers/hwmon/adt7410.c | 2 +-
drivers/hwmon/adt7x10.c | 7 +------
drivers/hwmon/adt7x10.h | 5 -----
4 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/hwmon/adt7310.c b/drivers/hwmon/adt7310.c
index 1efc0bdcceab..067865f4887a 100644
--- a/drivers/hwmon/adt7310.c
+++ b/drivers/hwmon/adt7310.c
@@ -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,
diff --git a/drivers/hwmon/adt7410.c b/drivers/hwmon/adt7410.c
index aede5baca7b9..0cebf6777239 100644
--- a/drivers/hwmon/adt7410.c
+++ b/drivers/hwmon/adt7410.c
@@ -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,
diff --git a/drivers/hwmon/adt7x10.c b/drivers/hwmon/adt7x10.c
index ce54bffab2ec..da67734edafd 100644
--- a/drivers/hwmon/adt7x10.c
+++ b/drivers/hwmon/adt7x10.c
@@ -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");
diff --git a/drivers/hwmon/adt7x10.h b/drivers/hwmon/adt7x10.h
index ba22c32c8355..46caf3e21978 100644
--- a/drivers/hwmon/adt7x10.h
+++ b/drivers/hwmon/adt7x10.h
@@ -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
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 05/18] hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (3 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 04/18] hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 18:49 ` Guenter Roeck
2022-09-25 17:27 ` [PATCH 06/18] hwmon: (it87) " Jonathan Cameron
` (13 subsequent siblings)
18 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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: Linus Walleij <linus.walleij@linaro.org>
---
drivers/hwmon/gpio-fan.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index fbf3f5a4ecb6..b05aedd20b4f 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -557,7 +557,6 @@ static void gpio_fan_shutdown(struct platform_device *pdev)
set_fan_speed(fan_data, 0);
}
-#ifdef CONFIG_PM_SLEEP
static int gpio_fan_suspend(struct device *dev)
{
struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
@@ -580,18 +579,14 @@ static int gpio_fan_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
-#define GPIO_FAN_PM (&gpio_fan_pm)
-#else
-#define GPIO_FAN_PM NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
static struct platform_driver gpio_fan_driver = {
.probe = gpio_fan_probe,
.shutdown = gpio_fan_shutdown,
.driver = {
.name = "gpio-fan",
- .pm = GPIO_FAN_PM,
+ .pm = pm_sleep_ptr(&gpio_fan_pm),
.of_match_table = of_match_ptr(of_gpio_fan_match),
},
};
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 06/18] hwmon: (it87) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (4 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 05/18] hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 07/18] hwmon: (lm90) " Jonathan Cameron
` (12 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/hwmon/it87.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 0e543dbe0a6b..7bd154ba351b 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -3179,7 +3179,7 @@ static int it87_probe(struct platform_device *pdev)
return PTR_ERR_OR_ZERO(hwmon_dev);
}
-static void __maybe_unused it87_resume_sio(struct platform_device *pdev)
+static void it87_resume_sio(struct platform_device *pdev)
{
struct it87_data *data = dev_get_drvdata(&pdev->dev);
int err;
@@ -3211,7 +3211,7 @@ static void __maybe_unused it87_resume_sio(struct platform_device *pdev)
superio_exit(data->sioaddr);
}
-static int __maybe_unused it87_resume(struct device *dev)
+static int it87_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct it87_data *data = dev_get_drvdata(dev);
@@ -3238,12 +3238,12 @@ static int __maybe_unused it87_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(it87_dev_pm_ops, NULL, it87_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(it87_dev_pm_ops, NULL, it87_resume);
static struct platform_driver it87_driver = {
.driver = {
.name = DRVNAME,
- .pm = &it87_dev_pm_ops,
+ .pm = pm_sleep_ptr(&it87_dev_pm_ops),
},
.probe = it87_probe,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 07/18] hwmon: (lm90) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (5 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 06/18] hwmon: (it87) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 08/18] hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
` (11 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/lm90.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index c151c0bf43f2..db595f7d01f8 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -2956,7 +2956,7 @@ static void lm90_alert(struct i2c_client *client, enum i2c_alert_protocol type,
}
}
-static int __maybe_unused lm90_suspend(struct device *dev)
+static int lm90_suspend(struct device *dev)
{
struct lm90_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client;
@@ -2967,7 +2967,7 @@ static int __maybe_unused lm90_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused lm90_resume(struct device *dev)
+static int lm90_resume(struct device *dev)
{
struct lm90_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client;
@@ -2978,14 +2978,14 @@ static int __maybe_unused lm90_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(lm90_pm_ops, lm90_suspend, lm90_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(lm90_pm_ops, lm90_suspend, lm90_resume);
static struct i2c_driver lm90_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "lm90",
.of_match_table = of_match_ptr(lm90_of_match),
- .pm = &lm90_pm_ops,
+ .pm = pm_sleep_ptr(&lm90_pm_ops),
},
.probe_new = lm90_probe,
.alert = lm90_alert,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 08/18] hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (6 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 07/18] hwmon: (lm90) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 09/18] hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
` (10 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result. In this case it also lets the
structure itself be removed.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Nuno Sá <nuno.sa@analog.com>
---
drivers/hwmon/ltc2947-core.c | 7 +++----
drivers/hwmon/ltc2947-i2c.c | 2 +-
drivers/hwmon/ltc2947-spi.c | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/hwmon/ltc2947-core.c b/drivers/hwmon/ltc2947-core.c
index 626f5bf2c9c7..7404e974762f 100644
--- a/drivers/hwmon/ltc2947-core.c
+++ b/drivers/hwmon/ltc2947-core.c
@@ -1120,7 +1120,7 @@ int ltc2947_core_probe(struct regmap *map, const char *name)
}
EXPORT_SYMBOL_GPL(ltc2947_core_probe);
-static int __maybe_unused ltc2947_resume(struct device *dev)
+static int ltc2947_resume(struct device *dev)
{
struct ltc2947_data *st = dev_get_drvdata(dev);
u32 ctrl = 0;
@@ -1149,7 +1149,7 @@ static int __maybe_unused ltc2947_resume(struct device *dev)
LTC2947_CONT_MODE_MASK, LTC2947_CONT_MODE(1));
}
-static int __maybe_unused ltc2947_suspend(struct device *dev)
+static int ltc2947_suspend(struct device *dev)
{
struct ltc2947_data *st = dev_get_drvdata(dev);
@@ -1157,8 +1157,7 @@ static int __maybe_unused ltc2947_suspend(struct device *dev)
LTC2947_SHUTDOWN_MASK, 1);
}
-SIMPLE_DEV_PM_OPS(ltc2947_pm_ops, ltc2947_suspend, ltc2947_resume);
-EXPORT_SYMBOL_GPL(ltc2947_pm_ops);
+EXPORT_SIMPLE_DEV_PM_OPS(ltc2947_pm_ops, ltc2947_suspend, ltc2947_resume);
const struct of_device_id ltc2947_of_match[] = {
{ .compatible = "adi,ltc2947" },
diff --git a/drivers/hwmon/ltc2947-i2c.c b/drivers/hwmon/ltc2947-i2c.c
index ad0dfd3efbf8..96852bc8a964 100644
--- a/drivers/hwmon/ltc2947-i2c.c
+++ b/drivers/hwmon/ltc2947-i2c.c
@@ -36,7 +36,7 @@ static struct i2c_driver ltc2947_driver = {
.driver = {
.name = "ltc2947",
.of_match_table = ltc2947_of_match,
- .pm = <c2947_pm_ops,
+ .pm = pm_sleep_ptr(<c2947_pm_ops),
},
.probe_new = ltc2947_probe,
.id_table = ltc2947_id,
diff --git a/drivers/hwmon/ltc2947-spi.c b/drivers/hwmon/ltc2947-spi.c
index c24ca569db1b..a33be110098c 100644
--- a/drivers/hwmon/ltc2947-spi.c
+++ b/drivers/hwmon/ltc2947-spi.c
@@ -38,7 +38,7 @@ static struct spi_driver ltc2947_driver = {
.driver = {
.name = "ltc2947",
.of_match_table = ltc2947_of_match,
- .pm = <c2947_pm_ops,
+ .pm = pm_sleep_ptr(<c2947_pm_ops),
},
.probe = ltc2947_probe,
.id_table = ltc2947_id,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 09/18] hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (7 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 08/18] hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 10/18] hwmon: (max31730) witch " Jonathan Cameron
` (9 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/hwmon/max31722.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/max31722.c b/drivers/hwmon/max31722.c
index 93e048ee4955..9a31ef388396 100644
--- a/drivers/hwmon/max31722.c
+++ b/drivers/hwmon/max31722.c
@@ -113,7 +113,7 @@ static void max31722_remove(struct spi_device *spi)
dev_warn(&spi->dev, "Failed to put device in stand-by mode\n");
}
-static int __maybe_unused max31722_suspend(struct device *dev)
+static int max31722_suspend(struct device *dev)
{
struct spi_device *spi_device = to_spi_device(dev);
struct max31722_data *data = spi_get_drvdata(spi_device);
@@ -121,7 +121,7 @@ static int __maybe_unused max31722_suspend(struct device *dev)
return max31722_set_mode(data, MAX31722_MODE_STANDBY);
}
-static int __maybe_unused max31722_resume(struct device *dev)
+static int max31722_resume(struct device *dev)
{
struct spi_device *spi_device = to_spi_device(dev);
struct max31722_data *data = spi_get_drvdata(spi_device);
@@ -129,7 +129,7 @@ static int __maybe_unused max31722_resume(struct device *dev)
return max31722_set_mode(data, MAX31722_MODE_CONTINUOUS);
}
-static SIMPLE_DEV_PM_OPS(max31722_pm_ops, max31722_suspend, max31722_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max31722_pm_ops, max31722_suspend, max31722_resume);
static const struct spi_device_id max31722_spi_id[] = {
{"max31722", 0},
@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(spi, max31722_spi_id);
static struct spi_driver max31722_driver = {
.driver = {
.name = "max31722",
- .pm = &max31722_pm_ops,
+ .pm = pm_sleep_ptr(&max31722_pm_ops),
},
.probe = max31722_probe,
.remove = max31722_remove,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 10/18] hwmon: (max31730) witch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (8 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 09/18] hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 11/18] hwmon: (max6639) Switch " Jonathan Cameron
` (8 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/max31730.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/max31730.c b/drivers/hwmon/max31730.c
index 9bdff881f59c..746a767c9fc6 100644
--- a/drivers/hwmon/max31730.c
+++ b/drivers/hwmon/max31730.c
@@ -404,28 +404,28 @@ static int max31730_detect(struct i2c_client *client,
return 0;
}
-static int __maybe_unused max31730_suspend(struct device *dev)
+static int max31730_suspend(struct device *dev)
{
struct max31730_data *data = dev_get_drvdata(dev);
return max31730_write_config(data, MAX31730_STOP, 0);
}
-static int __maybe_unused max31730_resume(struct device *dev)
+static int max31730_resume(struct device *dev)
{
struct max31730_data *data = dev_get_drvdata(dev);
return max31730_write_config(data, 0, MAX31730_STOP);
}
-static SIMPLE_DEV_PM_OPS(max31730_pm_ops, max31730_suspend, max31730_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max31730_pm_ops, max31730_suspend, max31730_resume);
static struct i2c_driver max31730_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "max31730",
.of_match_table = of_match_ptr(max31730_of_match),
- .pm = &max31730_pm_ops,
+ .pm = pm_sleep_ptr(&max31730_pm_ops),
},
.probe_new = max31730_probe,
.id_table = max31730_ids,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 11/18] hwmon: (max6639) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (9 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 10/18] hwmon: (max31730) witch " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 12/18] hwmon: (nct6775) " Jonathan Cameron
` (7 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of #ifdef guards whilst
achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Roland Stigge <stigge@antcom.de>
---
drivers/hwmon/max6639.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
index 936861131d74..9b895402c80d 100644
--- a/drivers/hwmon/max6639.c
+++ b/drivers/hwmon/max6639.c
@@ -571,7 +571,6 @@ static int max6639_probe(struct i2c_client *client)
return PTR_ERR_OR_ZERO(hwmon_dev);
}
-#ifdef CONFIG_PM_SLEEP
static int max6639_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@@ -609,7 +608,6 @@ static int max6639_resume(struct device *dev)
return i2c_smbus_write_byte_data(client,
MAX6639_REG_GCONFIG, ret & ~MAX6639_GCONFIG_STANDBY);
}
-#endif /* CONFIG_PM_SLEEP */
static const struct i2c_device_id max6639_id[] = {
{"max6639", 0},
@@ -618,13 +616,13 @@ static const struct i2c_device_id max6639_id[] = {
MODULE_DEVICE_TABLE(i2c, max6639_id);
-static SIMPLE_DEV_PM_OPS(max6639_pm_ops, max6639_suspend, max6639_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max6639_pm_ops, max6639_suspend, max6639_resume);
static struct i2c_driver max6639_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "max6639",
- .pm = &max6639_pm_ops,
+ .pm = pm_sleep_ptr(&max6639_pm_ops),
},
.probe_new = max6639_probe,
.id_table = max6639_id,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 12/18] hwmon: (nct6775) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (10 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 11/18] hwmon: (max6639) Switch " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 13/18] hwmon: (pwm-fan) " Jonathan Cameron
` (6 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Zoltán Kővágó <dirty.ice.hu@gmail.com>
---
drivers/hwmon/nct6775-platform.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c
index 41c97cfacfb8..b34783784213 100644
--- a/drivers/hwmon/nct6775-platform.c
+++ b/drivers/hwmon/nct6775-platform.c
@@ -355,7 +355,7 @@ static void nct6791_enable_io_mapping(struct nct6775_sio_data *sio_data)
}
}
-static int __maybe_unused nct6775_suspend(struct device *dev)
+static int nct6775_suspend(struct device *dev)
{
int err;
u16 tmp;
@@ -386,7 +386,7 @@ static int __maybe_unused nct6775_suspend(struct device *dev)
return err;
}
-static int __maybe_unused nct6775_resume(struct device *dev)
+static int nct6775_resume(struct device *dev)
{
struct nct6775_data *data = dev_get_drvdata(dev);
struct nct6775_sio_data *sio_data = dev_get_platdata(dev);
@@ -467,7 +467,7 @@ static int __maybe_unused nct6775_resume(struct device *dev)
return err;
}
-static SIMPLE_DEV_PM_OPS(nct6775_dev_pm_ops, nct6775_suspend, nct6775_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(nct6775_dev_pm_ops, nct6775_suspend, nct6775_resume);
static void
nct6775_check_fan_inputs(struct nct6775_data *data, struct nct6775_sio_data *sio_data)
@@ -934,7 +934,7 @@ static int nct6775_platform_probe(struct platform_device *pdev)
static struct platform_driver nct6775_driver = {
.driver = {
.name = DRVNAME,
- .pm = &nct6775_dev_pm_ops,
+ .pm = pm_sleep_ptr(&nct6775_dev_pm_ops),
},
.probe = nct6775_platform_probe,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 13/18] hwmon: (pwm-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (11 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 12/18] hwmon: (nct6775) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 14/18] hwmon: (tmp102) " Jonathan Cameron
` (5 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of #ifdef guards whilst
achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/hwmon/pwm-fan.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 498128eb81f1..dc3d9a22d917 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -639,7 +639,6 @@ static void pwm_fan_shutdown(struct platform_device *pdev)
pwm_fan_cleanup(ctx);
}
-#ifdef CONFIG_PM_SLEEP
static int pwm_fan_suspend(struct device *dev)
{
struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
@@ -653,9 +652,8 @@ static int pwm_fan_resume(struct device *dev)
return set_pwm(ctx, ctx->pwm_value);
}
-#endif
-static SIMPLE_DEV_PM_OPS(pwm_fan_pm, pwm_fan_suspend, pwm_fan_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(pwm_fan_pm, pwm_fan_suspend, pwm_fan_resume);
static const struct of_device_id of_pwm_fan_match[] = {
{ .compatible = "pwm-fan", },
@@ -668,7 +666,7 @@ static struct platform_driver pwm_fan_driver = {
.shutdown = pwm_fan_shutdown,
.driver = {
.name = "pwm-fan",
- .pm = &pwm_fan_pm,
+ .pm = pm_sleep_ptr(&pwm_fan_pm),
.of_match_table = of_pwm_fan_match,
},
};
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 14/18] hwmon: (tmp102) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (12 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 13/18] hwmon: (pwm-fan) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 15/18] hwmon: (tmp103) " Jonathan Cameron
` (4 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of #ifdef guards whilst
achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/hwmon/tmp102.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index e867a0c2e539..2bf496a62206 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -260,7 +260,6 @@ static int tmp102_probe(struct i2c_client *client)
return 0;
}
-#ifdef CONFIG_PM_SLEEP
static int tmp102_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@@ -283,9 +282,8 @@ static int tmp102_resume(struct device *dev)
return err;
}
-#endif /* CONFIG_PM */
-static SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume);
static const struct i2c_device_id tmp102_id[] = {
{ "tmp102", 0 },
@@ -302,7 +300,7 @@ MODULE_DEVICE_TABLE(of, tmp102_of_match);
static struct i2c_driver tmp102_driver = {
.driver.name = DRIVER_NAME,
.driver.of_match_table = of_match_ptr(tmp102_of_match),
- .driver.pm = &tmp102_dev_pm_ops,
+ .driver.pm = pm_sleep_ptr(&tmp102_dev_pm_ops),
.probe_new = tmp102_probe,
.id_table = tmp102_id,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 15/18] hwmon: (tmp103) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (13 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 14/18] hwmon: (tmp102) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 16/18] hwmon: (tmp108) " Jonathan Cameron
` (3 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/hwmon/tmp103.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/tmp103.c b/drivers/hwmon/tmp103.c
index 5cab4436aa77..56d5cbf36a45 100644
--- a/drivers/hwmon/tmp103.c
+++ b/drivers/hwmon/tmp103.c
@@ -178,7 +178,7 @@ static int tmp103_probe(struct i2c_client *client)
return PTR_ERR_OR_ZERO(hwmon_dev);
}
-static int __maybe_unused tmp103_suspend(struct device *dev)
+static int tmp103_suspend(struct device *dev)
{
struct regmap *regmap = dev_get_drvdata(dev);
@@ -186,7 +186,7 @@ static int __maybe_unused tmp103_suspend(struct device *dev)
TMP103_CONF_SD_MASK, 0);
}
-static int __maybe_unused tmp103_resume(struct device *dev)
+static int tmp103_resume(struct device *dev)
{
struct regmap *regmap = dev_get_drvdata(dev);
@@ -194,7 +194,7 @@ static int __maybe_unused tmp103_resume(struct device *dev)
TMP103_CONF_SD_MASK, TMP103_CONF_SD);
}
-static SIMPLE_DEV_PM_OPS(tmp103_dev_pm_ops, tmp103_suspend, tmp103_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tmp103_dev_pm_ops, tmp103_suspend, tmp103_resume);
static const struct i2c_device_id tmp103_id[] = {
{ "tmp103", 0 },
@@ -212,7 +212,7 @@ static struct i2c_driver tmp103_driver = {
.driver = {
.name = "tmp103",
.of_match_table = of_match_ptr(tmp103_of_match),
- .pm = &tmp103_dev_pm_ops,
+ .pm = pm_sleep_ptr(&tmp103_dev_pm_ops),
},
.probe_new = tmp103_probe,
.id_table = tmp103_id,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 16/18] hwmon: (tmp108) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (14 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 15/18] hwmon: (tmp103) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 17/18] hwmon: (w83627ehf) " Jonathan Cameron
` (2 subsequent siblings)
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/hwmon/tmp108.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
index 5435664c3f6e..acb4ba750b09 100644
--- a/drivers/hwmon/tmp108.c
+++ b/drivers/hwmon/tmp108.c
@@ -390,7 +390,7 @@ static int tmp108_probe(struct i2c_client *client)
return PTR_ERR_OR_ZERO(hwmon_dev);
}
-static int __maybe_unused tmp108_suspend(struct device *dev)
+static int tmp108_suspend(struct device *dev)
{
struct tmp108 *tmp108 = dev_get_drvdata(dev);
@@ -398,7 +398,7 @@ static int __maybe_unused tmp108_suspend(struct device *dev)
TMP108_CONF_MODE_MASK, TMP108_MODE_SHUTDOWN);
}
-static int __maybe_unused tmp108_resume(struct device *dev)
+static int tmp108_resume(struct device *dev)
{
struct tmp108 *tmp108 = dev_get_drvdata(dev);
int err;
@@ -410,7 +410,7 @@ static int __maybe_unused tmp108_resume(struct device *dev)
return err;
}
-static SIMPLE_DEV_PM_OPS(tmp108_dev_pm_ops, tmp108_suspend, tmp108_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tmp108_dev_pm_ops, tmp108_suspend, tmp108_resume);
static const struct i2c_device_id tmp108_i2c_ids[] = {
{ "tmp108", 0 },
@@ -429,7 +429,7 @@ MODULE_DEVICE_TABLE(of, tmp108_of_ids);
static struct i2c_driver tmp108_driver = {
.driver = {
.name = DRIVER_NAME,
- .pm = &tmp108_dev_pm_ops,
+ .pm = pm_sleep_ptr(&tmp108_dev_pm_ops),
.of_match_table = of_match_ptr(tmp108_of_ids),
},
.probe_new = tmp108_probe,
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 17/18] hwmon: (w83627ehf) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (15 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 16/18] hwmon: (tmp108) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 18/18] hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() Jonathan Cameron
2022-09-25 17:47 ` [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Guenter Roeck
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/hwmon/w83627ehf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index af89b32a93a5..939d4c35e713 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -1944,7 +1944,7 @@ static int __init w83627ehf_probe(struct platform_device *pdev)
return PTR_ERR_OR_ZERO(hwmon_dev);
}
-static int __maybe_unused w83627ehf_suspend(struct device *dev)
+static int w83627ehf_suspend(struct device *dev)
{
struct w83627ehf_data *data = w83627ehf_update_device(dev);
@@ -1955,7 +1955,7 @@ static int __maybe_unused w83627ehf_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused w83627ehf_resume(struct device *dev)
+static int w83627ehf_resume(struct device *dev)
{
struct w83627ehf_data *data = dev_get_drvdata(dev);
int i;
@@ -2010,12 +2010,12 @@ static int __maybe_unused w83627ehf_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(w83627ehf_dev_pm_ops, w83627ehf_suspend, w83627ehf_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(w83627ehf_dev_pm_ops, w83627ehf_suspend, w83627ehf_resume);
static struct platform_driver w83627ehf_driver = {
.driver = {
.name = DRVNAME,
- .pm = &w83627ehf_dev_pm_ops,
+ .pm = pm_sleep_ptr(&w83627ehf_dev_pm_ops),
},
};
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 18/18] hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr()
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (16 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 17/18] hwmon: (w83627ehf) " Jonathan Cameron
@ 2022-09-25 17:27 ` Jonathan Cameron
2022-09-25 17:47 ` [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Guenter Roeck
18 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-25 17:27 UTC (permalink / raw)
To: Jean Delvare, Guenter Roeck, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
These new macros allow the compiler to see all the functions even if
!CONFIG_PM* and remove the structures and functions if unused.
This removes the need for __maybe_unused markings.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Ninad Malwade <nmalwade@nvidia.com>
---
drivers/hwmon/ina3221.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
index 58d3828e2ec0..8ef2631fc312 100644
--- a/drivers/hwmon/ina3221.c
+++ b/drivers/hwmon/ina3221.c
@@ -930,7 +930,7 @@ static int ina3221_remove(struct i2c_client *client)
return 0;
}
-static int __maybe_unused ina3221_suspend(struct device *dev)
+static int ina3221_suspend(struct device *dev)
{
struct ina3221_data *ina = dev_get_drvdata(dev);
int ret;
@@ -953,7 +953,7 @@ static int __maybe_unused ina3221_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused ina3221_resume(struct device *dev)
+static int ina3221_resume(struct device *dev)
{
struct ina3221_data *ina = dev_get_drvdata(dev);
int ret;
@@ -996,11 +996,8 @@ static int __maybe_unused ina3221_resume(struct device *dev)
return 0;
}
-static const struct dev_pm_ops ina3221_pm = {
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
- SET_RUNTIME_PM_OPS(ina3221_suspend, ina3221_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(ina3221_pm, ina3221_suspend, ina3221_resume,
+ NULL);
static const struct of_device_id ina3221_of_match_table[] = {
{ .compatible = "ti,ina3221", },
@@ -1020,7 +1017,7 @@ static struct i2c_driver ina3221_i2c_driver = {
.driver = {
.name = INA3221_DRIVER_NAME,
.of_match_table = ina3221_of_match_table,
- .pm = &ina3221_pm,
+ .pm = pm_ptr(&ina3221_pm),
},
.id_table = ina3221_ids,
};
--
2.37.2
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
` (17 preceding siblings ...)
2022-09-25 17:27 ` [PATCH 18/18] hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() Jonathan Cameron
@ 2022-09-25 17:47 ` Guenter Roeck
18 siblings, 0 replies; 22+ messages in thread
From: Guenter Roeck @ 2022-09-25 17:47 UTC (permalink / raw)
To: Jonathan Cameron, Jean Delvare, linux-hwmon
Cc: Paul Cercueil, Hans de Goede, Rafael J . Wysocki,
Lars-Peter Clausen, Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade,
Jonathan Cameron
On 9/25/22 10:27, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Recently a solution was added to avoiding the need to either guard
> pm functions with #ifdef magic, or mark the __maybe_unused.
> https://lore.kernel.org/all/20220107181723.54392-1-paul@crapouillou.net/
>
> This series switches hwmon over to the new macros that are intended to replace
> SIMPLE_DEV_PM_OPS and similar.
>
> There are a few drivers in hwmon that might be able fine using
> DEFINE_SIMPLE_PM_OPS() but currently do not define as many of the
> callbacks as that macro does. As such I haven't touched them in this set.
>
> This is part of general effort to get rid of examples of the older macros
> that might get copied in new drivers.
Series applied to hwmon-next.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 05/18] hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 17:27 ` [PATCH 05/18] hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
@ 2022-09-25 18:49 ` Guenter Roeck
2022-09-26 8:32 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Guenter Roeck @ 2022-09-25 18:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Jean Delvare, linux-hwmon, Paul Cercueil, Hans de Goede,
Rafael J . Wysocki, Lars-Peter Clausen, Linus Walleij,
Nuno Sá, Roland Stigge, Zoltán Kővágó,
Ninad Malwade, Jonathan Cameron
On Sun, Sep 25, 2022 at 06:27:46PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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: Linus Walleij <linus.walleij@linaro.org>
This patch resulted in build errors.
Building m68k:allmodconfig ... failed
--------------
Error log:
drivers/hwmon/gpio-fan.c: In function 'gpio_fan_suspend':
drivers/hwmon/gpio-fan.c:565:27: error: 'struct gpio_fan_data' has no member named 'resume_speed'
There was an #ifdef CONFIG_PM_SLEEP in struct gpio_fan_data which had
to be dropped. I took care of that.
Guenter
> ---
> drivers/hwmon/gpio-fan.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
> index fbf3f5a4ecb6..b05aedd20b4f 100644
> --- a/drivers/hwmon/gpio-fan.c
> +++ b/drivers/hwmon/gpio-fan.c
> @@ -557,7 +557,6 @@ static void gpio_fan_shutdown(struct platform_device *pdev)
> set_fan_speed(fan_data, 0);
> }
>
> -#ifdef CONFIG_PM_SLEEP
> static int gpio_fan_suspend(struct device *dev)
> {
> struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
> @@ -580,18 +579,14 @@ static int gpio_fan_resume(struct device *dev)
> return 0;
> }
>
> -static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
> -#define GPIO_FAN_PM (&gpio_fan_pm)
> -#else
> -#define GPIO_FAN_PM NULL
> -#endif
> +static DEFINE_SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
>
> static struct platform_driver gpio_fan_driver = {
> .probe = gpio_fan_probe,
> .shutdown = gpio_fan_shutdown,
> .driver = {
> .name = "gpio-fan",
> - .pm = GPIO_FAN_PM,
> + .pm = pm_sleep_ptr(&gpio_fan_pm),
> .of_match_table = of_match_ptr(of_gpio_fan_match),
> },
> };
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 05/18] hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
2022-09-25 18:49 ` Guenter Roeck
@ 2022-09-26 8:32 ` Jonathan Cameron
0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2022-09-26 8:32 UTC (permalink / raw)
To: Guenter Roeck
Cc: Jonathan Cameron, Jean Delvare, linux-hwmon, Paul Cercueil,
Hans de Goede, Rafael J . Wysocki, Lars-Peter Clausen,
Linus Walleij, Nuno Sá, Roland Stigge,
Zoltán Kővágó, Ninad Malwade
On Sun, 25 Sep 2022 11:49:54 -0700
Guenter Roeck <linux@roeck-us.net> wrote:
> On Sun, Sep 25, 2022 at 06:27:46PM +0100, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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: Linus Walleij <linus.walleij@linaro.org>
>
> This patch resulted in build errors.
>
> Building m68k:allmodconfig ... failed
> --------------
> Error log:
> drivers/hwmon/gpio-fan.c: In function 'gpio_fan_suspend':
> drivers/hwmon/gpio-fan.c:565:27: error: 'struct gpio_fan_data' has no member named 'resume_speed'
>
> There was an #ifdef CONFIG_PM_SLEEP in struct gpio_fan_data which had
> to be dropped. I took care of that.
Thanks! I clearly missed some tests I should have done.
Sorry about that.
Jonathan
>
> Guenter
>
> > ---
> > drivers/hwmon/gpio-fan.c | 9 ++-------
> > 1 file changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
> > index fbf3f5a4ecb6..b05aedd20b4f 100644
> > --- a/drivers/hwmon/gpio-fan.c
> > +++ b/drivers/hwmon/gpio-fan.c
> > @@ -557,7 +557,6 @@ static void gpio_fan_shutdown(struct platform_device *pdev)
> > set_fan_speed(fan_data, 0);
> > }
> >
> > -#ifdef CONFIG_PM_SLEEP
> > static int gpio_fan_suspend(struct device *dev)
> > {
> > struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
> > @@ -580,18 +579,14 @@ static int gpio_fan_resume(struct device *dev)
> > return 0;
> > }
> >
> > -static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
> > -#define GPIO_FAN_PM (&gpio_fan_pm)
> > -#else
> > -#define GPIO_FAN_PM NULL
> > -#endif
> > +static DEFINE_SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
> >
> > static struct platform_driver gpio_fan_driver = {
> > .probe = gpio_fan_probe,
> > .shutdown = gpio_fan_shutdown,
> > .driver = {
> > .name = "gpio-fan",
> > - .pm = GPIO_FAN_PM,
> > + .pm = pm_sleep_ptr(&gpio_fan_pm),
> > .of_match_table = of_match_ptr(of_gpio_fan_match),
> > },
> > };
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2022-09-26 8:32 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-25 17:27 [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Jonathan Cameron
2022-09-25 17:27 ` [PATCH 01/18] hwmon: (abitguru) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Jonathan Cameron
2022-09-25 17:27 ` [PATCH 02/18] hwmon: (abitguru3) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 03/18] hwmon: (acpi_power_meter) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 04/18] hwmon: (adt7x10) Switch to EXPORT_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 05/18] hwmon: (gpio-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
2022-09-25 18:49 ` Guenter Roeck
2022-09-26 8:32 ` Jonathan Cameron
2022-09-25 17:27 ` [PATCH 06/18] hwmon: (it87) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 07/18] hwmon: (lm90) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 08/18] hwmon: (ltc2947) Switch to EXPORT_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 09/18] hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 10/18] hwmon: (max31730) witch " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 11/18] hwmon: (max6639) Switch " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 12/18] hwmon: (nct6775) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 13/18] hwmon: (pwm-fan) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 14/18] hwmon: (tmp102) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 15/18] hwmon: (tmp103) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 16/18] hwmon: (tmp108) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 17/18] hwmon: (w83627ehf) " Jonathan Cameron
2022-09-25 17:27 ` [PATCH 18/18] hwmon: (ina3221) Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() Jonathan Cameron
2022-09-25 17:47 ` [PATCH 00/18] hwmon: Move to new PM macros reducing driver complexity Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox