Skip to content

Commit 1839391

Browse files
jic23groeck
authored andcommitted
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>
1 parent 8de7295 commit 1839391

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/hwmon/pwm-fan.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@ static void pwm_fan_shutdown(struct platform_device *pdev)
639639
pwm_fan_cleanup(ctx);
640640
}
641641

642-
#ifdef CONFIG_PM_SLEEP
643642
static int pwm_fan_suspend(struct device *dev)
644643
{
645644
struct pwm_fan_ctx *ctx = dev_get_drvdata(dev);
@@ -653,9 +652,8 @@ static int pwm_fan_resume(struct device *dev)
653652

654653
return set_pwm(ctx, ctx->pwm_value);
655654
}
656-
#endif
657655

658-
static SIMPLE_DEV_PM_OPS(pwm_fan_pm, pwm_fan_suspend, pwm_fan_resume);
656+
static DEFINE_SIMPLE_DEV_PM_OPS(pwm_fan_pm, pwm_fan_suspend, pwm_fan_resume);
659657

660658
static const struct of_device_id of_pwm_fan_match[] = {
661659
{ .compatible = "pwm-fan", },
@@ -668,7 +666,7 @@ static struct platform_driver pwm_fan_driver = {
668666
.shutdown = pwm_fan_shutdown,
669667
.driver = {
670668
.name = "pwm-fan",
671-
.pm = &pwm_fan_pm,
669+
.pm = pm_sleep_ptr(&pwm_fan_pm),
672670
.of_match_table = of_pwm_fan_match,
673671
},
674672
};

0 commit comments

Comments
 (0)