Skip to content

Commit d36eda7

Browse files
pcercueiWim Van Sebroeck
authored andcommitted
watchdog: twl4030: Remove #ifdef guards for PM related functions
Use the pm_ptr() macro to handle the .suspend/.resume callbacks. This macro allows 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 b49e2a3 commit d36eda7

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/watchdog/twl4030_wdt.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ static int twl4030_wdt_probe(struct platform_device *pdev)
8181
return devm_watchdog_register_device(dev, wdt);
8282
}
8383

84-
#ifdef CONFIG_PM
8584
static int twl4030_wdt_suspend(struct platform_device *pdev, pm_message_t state)
8685
{
8786
struct watchdog_device *wdt = platform_get_drvdata(pdev);
@@ -99,10 +98,6 @@ static int twl4030_wdt_resume(struct platform_device *pdev)
9998

10099
return 0;
101100
}
102-
#else
103-
#define twl4030_wdt_suspend NULL
104-
#define twl4030_wdt_resume NULL
105-
#endif
106101

107102
static const struct of_device_id twl_wdt_of_match[] = {
108103
{ .compatible = "ti,twl4030-wdt", },
@@ -112,8 +107,8 @@ MODULE_DEVICE_TABLE(of, twl_wdt_of_match);
112107

113108
static struct platform_driver twl4030_wdt_driver = {
114109
.probe = twl4030_wdt_probe,
115-
.suspend = twl4030_wdt_suspend,
116-
.resume = twl4030_wdt_resume,
110+
.suspend = pm_ptr(twl4030_wdt_suspend),
111+
.resume = pm_ptr(twl4030_wdt_resume),
117112
.driver = {
118113
.name = "twl4030_wdt",
119114
.of_match_table = twl_wdt_of_match,

0 commit comments

Comments
 (0)