Skip to content

Commit b49e2a3

Browse files
pcercueiWim Van Sebroeck
authored andcommitted
watchdog: at91rm9200: 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]> Reviewed-by: Claudiu Beznea <[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 08435c2 commit b49e2a3

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

drivers/watchdog/at91rm9200_wdt.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ static void at91wdt_shutdown(struct platform_device *pdev)
278278
at91_wdt_stop();
279279
}
280280

281-
#ifdef CONFIG_PM
282-
283281
static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message)
284282
{
285283
at91_wdt_stop();
@@ -293,11 +291,6 @@ static int at91wdt_resume(struct platform_device *pdev)
293291
return 0;
294292
}
295293

296-
#else
297-
#define at91wdt_suspend NULL
298-
#define at91wdt_resume NULL
299-
#endif
300-
301294
static const struct of_device_id at91_wdt_dt_ids[] = {
302295
{ .compatible = "atmel,at91rm9200-wdt" },
303296
{ /* sentinel */ }
@@ -308,8 +301,8 @@ static struct platform_driver at91wdt_driver = {
308301
.probe = at91wdt_probe,
309302
.remove = at91wdt_remove,
310303
.shutdown = at91wdt_shutdown,
311-
.suspend = at91wdt_suspend,
312-
.resume = at91wdt_resume,
304+
.suspend = pm_ptr(at91wdt_suspend),
305+
.resume = pm_ptr(at91wdt_resume),
313306
.driver = {
314307
.name = "atmel_st_watchdog",
315308
.of_match_table = at91_wdt_dt_ids,

drivers/watchdog/db8500_wdt.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ static int db8500_wdt_probe(struct platform_device *pdev)
105105
return 0;
106106
}
107107

108-
#ifdef CONFIG_PM
109108
static int db8500_wdt_suspend(struct platform_device *pdev,
110109
pm_message_t state)
111110
{
@@ -130,15 +129,11 @@ static int db8500_wdt_resume(struct platform_device *pdev)
130129
}
131130
return 0;
132131
}
133-
#else
134-
#define db8500_wdt_suspend NULL
135-
#define db8500_wdt_resume NULL
136-
#endif
137132

138133
static struct platform_driver db8500_wdt_driver = {
139134
.probe = db8500_wdt_probe,
140-
.suspend = db8500_wdt_suspend,
141-
.resume = db8500_wdt_resume,
135+
.suspend = pm_ptr(db8500_wdt_suspend),
136+
.resume = pm_ptr(db8500_wdt_resume),
142137
.driver = {
143138
.name = "db8500_wdt",
144139
},

0 commit comments

Comments
 (0)