summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2022-09-25 18:27:54 +0100
committerGuenter Roeck <linux@roeck-us.net>2022-09-25 14:22:12 -0700
commit1839391bdedb23d0e07e9030e18466172818d824 (patch)
tree12b051fd867e4b5c6a9323fbcf3ab45411ffac28 /drivers/hwmon
parent8de7295c207fcf78f61b6c7e00ef45554a0ebd22 (diff)
hwmon: (pwm-fan) Switch to DEFINE_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 #ifdef guards whilst achieving the same result. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20220925172759.3573439-14-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/pwm-fan.c6
1 files 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,
},
};