Skip to content

Commit 0327476

Browse files
pcercueiWim Van Sebroeck
authored andcommitted
watchdog: omap: 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]> Acked-by: Aaro Koskinen <[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 d36eda7 commit 0327476

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/watchdog/omap_wdt.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,6 @@ static int omap_wdt_remove(struct platform_device *pdev)
316316
return 0;
317317
}
318318

319-
#ifdef CONFIG_PM
320-
321319
/* REVISIT ... not clear this is the best way to handle system suspend; and
322320
* it's very inappropriate for selective device suspend (e.g. suspending this
323321
* through sysfs rather than by stopping the watchdog daemon). Also, this
@@ -353,11 +351,6 @@ static int omap_wdt_resume(struct platform_device *pdev)
353351
return 0;
354352
}
355353

356-
#else
357-
#define omap_wdt_suspend NULL
358-
#define omap_wdt_resume NULL
359-
#endif
360-
361354
static const struct of_device_id omap_wdt_of_match[] = {
362355
{ .compatible = "ti,omap3-wdt", },
363356
{},
@@ -368,8 +361,8 @@ static struct platform_driver omap_wdt_driver = {
368361
.probe = omap_wdt_probe,
369362
.remove = omap_wdt_remove,
370363
.shutdown = omap_wdt_shutdown,
371-
.suspend = omap_wdt_suspend,
372-
.resume = omap_wdt_resume,
364+
.suspend = pm_ptr(omap_wdt_suspend),
365+
.resume = pm_ptr(omap_wdt_resume),
373366
.driver = {
374367
.name = "omap_wdt",
375368
.of_match_table = omap_wdt_of_match,

0 commit comments

Comments
 (0)