Skip to content

Commit 8b3c366

Browse files
pcercueiWim Van Sebroeck
authored andcommitted
watchdog: starfive: Remove #ifdef guards for PM related functions
Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently 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 aeb3ef5 commit 8b3c366

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/watchdog/starfive-wdt.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,6 @@ static void starfive_wdt_shutdown(struct platform_device *pdev)
527527
starfive_wdt_pm_stop(&wdt->wdd);
528528
}
529529

530-
#ifdef CONFIG_PM_SLEEP
531530
static int starfive_wdt_suspend(struct device *dev)
532531
{
533532
struct starfive_wdt *wdt = dev_get_drvdata(dev);
@@ -557,9 +556,7 @@ static int starfive_wdt_resume(struct device *dev)
557556

558557
return starfive_wdt_start(wdt);
559558
}
560-
#endif /* CONFIG_PM_SLEEP */
561559

562-
#ifdef CONFIG_PM
563560
static int starfive_wdt_runtime_suspend(struct device *dev)
564561
{
565562
struct starfive_wdt *wdt = dev_get_drvdata(dev);
@@ -575,11 +572,10 @@ static int starfive_wdt_runtime_resume(struct device *dev)
575572

576573
return starfive_wdt_enable_clock(wdt);
577574
}
578-
#endif /* CONFIG_PM */
579575

580576
static const struct dev_pm_ops starfive_wdt_pm_ops = {
581-
SET_RUNTIME_PM_OPS(starfive_wdt_runtime_suspend, starfive_wdt_runtime_resume, NULL)
582-
SET_SYSTEM_SLEEP_PM_OPS(starfive_wdt_suspend, starfive_wdt_resume)
577+
RUNTIME_PM_OPS(starfive_wdt_runtime_suspend, starfive_wdt_runtime_resume, NULL)
578+
SYSTEM_SLEEP_PM_OPS(starfive_wdt_suspend, starfive_wdt_resume)
583579
};
584580

585581
static const struct of_device_id starfive_wdt_match[] = {
@@ -595,7 +591,7 @@ static struct platform_driver starfive_wdt_driver = {
595591
.shutdown = starfive_wdt_shutdown,
596592
.driver = {
597593
.name = "starfive-wdt",
598-
.pm = &starfive_wdt_pm_ops,
594+
.pm = pm_ptr(&starfive_wdt_pm_ops),
599595
.of_match_table = starfive_wdt_match,
600596
},
601597
};

0 commit comments

Comments
 (0)