Skip to content

Commit 5f02d03

Browse files
pcercueiWim Van Sebroeck
authored andcommitted
watchdog: wdat_wdt: Remove #ifdef guards for PM related functions
Use the new NOIRQ_SYSTEM_SLEEP_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent c1eaa8c commit 5f02d03

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/watchdog/wdat_wdt.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ static int wdat_wdt_probe(struct platform_device *pdev)
467467
return devm_watchdog_register_device(dev, &wdat->wdd);
468468
}
469469

470-
#ifdef CONFIG_PM_SLEEP
471470
static int wdat_wdt_suspend_noirq(struct device *dev)
472471
{
473472
struct wdat_wdt *wdat = dev_get_drvdata(dev);
@@ -528,18 +527,16 @@ static int wdat_wdt_resume_noirq(struct device *dev)
528527

529528
return wdat_wdt_start(&wdat->wdd);
530529
}
531-
#endif
532530

533531
static const struct dev_pm_ops wdat_wdt_pm_ops = {
534-
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(wdat_wdt_suspend_noirq,
535-
wdat_wdt_resume_noirq)
532+
NOIRQ_SYSTEM_SLEEP_PM_OPS(wdat_wdt_suspend_noirq, wdat_wdt_resume_noirq)
536533
};
537534

538535
static struct platform_driver wdat_wdt_driver = {
539536
.probe = wdat_wdt_probe,
540537
.driver = {
541538
.name = "wdat_wdt",
542-
.pm = &wdat_wdt_pm_ops,
539+
.pm = pm_sleep_ptr(&wdat_wdt_pm_ops),
543540
},
544541
};
545542

0 commit comments

Comments
 (0)