Skip to content

Commit

Permalink
hwmon: (pwm-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
jic23 authored and groeck committed Sep 25, 2022
1 parent 8de7295 commit 1839391
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/hwmon/pwm-fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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", },
Expand All @@ -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,
},
};
Expand Down

0 comments on commit 1839391

Please sign in to comment.