Skip to content

Commit 758f46c

Browse files
pcercueiWim Van Sebroeck
authored andcommitted
watchdog: kempld: 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 0327476 commit 758f46c

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/watchdog/kempld_wdt.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ struct kempld_wdt_data {
7575
struct watchdog_device wdd;
7676
unsigned int pretimeout;
7777
struct kempld_wdt_stage stage[KEMPLD_WDT_MAX_STAGES];
78-
#ifdef CONFIG_PM
7978
u8 pm_status_store;
80-
#endif
8179
};
8280

8381
#define DEFAULT_TIMEOUT 30 /* seconds */
@@ -495,7 +493,6 @@ static int kempld_wdt_probe(struct platform_device *pdev)
495493
return 0;
496494
}
497495

498-
#ifdef CONFIG_PM
499496
/* Disable watchdog if it is active during suspend */
500497
static int kempld_wdt_suspend(struct platform_device *pdev,
501498
pm_message_t message)
@@ -531,18 +528,14 @@ static int kempld_wdt_resume(struct platform_device *pdev)
531528
else
532529
return kempld_wdt_stop(wdd);
533530
}
534-
#else
535-
#define kempld_wdt_suspend NULL
536-
#define kempld_wdt_resume NULL
537-
#endif
538531

539532
static struct platform_driver kempld_wdt_driver = {
540533
.driver = {
541534
.name = "kempld-wdt",
542535
},
543536
.probe = kempld_wdt_probe,
544-
.suspend = kempld_wdt_suspend,
545-
.resume = kempld_wdt_resume,
537+
.suspend = pm_ptr(kempld_wdt_suspend),
538+
.resume = pm_ptr(kempld_wdt_resume),
546539
};
547540

548541
module_platform_driver(kempld_wdt_driver);

0 commit comments

Comments
 (0)