Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <paul@crapouillou.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20221020185047.1001522-2-paul@crapouillou.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Paul Cercueil and committed by
Wim Van Sebroeck
b49e2a3c 08435c2a

+4 -16
+2 -9
drivers/watchdog/at91rm9200_wdt.c
··· 278 278 at91_wdt_stop(); 279 279 } 280 280 281 - #ifdef CONFIG_PM 282 - 283 281 static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message) 284 282 { 285 283 at91_wdt_stop(); ··· 291 293 return 0; 292 294 } 293 295 294 - #else 295 - #define at91wdt_suspend NULL 296 - #define at91wdt_resume NULL 297 - #endif 298 - 299 296 static const struct of_device_id at91_wdt_dt_ids[] = { 300 297 { .compatible = "atmel,at91rm9200-wdt" }, 301 298 { /* sentinel */ } ··· 301 308 .probe = at91wdt_probe, 302 309 .remove = at91wdt_remove, 303 310 .shutdown = at91wdt_shutdown, 304 - .suspend = at91wdt_suspend, 305 - .resume = at91wdt_resume, 311 + .suspend = pm_ptr(at91wdt_suspend), 312 + .resume = pm_ptr(at91wdt_resume), 306 313 .driver = { 307 314 .name = "atmel_st_watchdog", 308 315 .of_match_table = at91_wdt_dt_ids,
+2 -7
drivers/watchdog/db8500_wdt.c
··· 105 105 return 0; 106 106 } 107 107 108 - #ifdef CONFIG_PM 109 108 static int db8500_wdt_suspend(struct platform_device *pdev, 110 109 pm_message_t state) 111 110 { ··· 129 130 } 130 131 return 0; 131 132 } 132 - #else 133 - #define db8500_wdt_suspend NULL 134 - #define db8500_wdt_resume NULL 135 - #endif 136 133 137 134 static struct platform_driver db8500_wdt_driver = { 138 135 .probe = db8500_wdt_probe, 139 - .suspend = db8500_wdt_suspend, 140 - .resume = db8500_wdt_resume, 136 + .suspend = pm_ptr(db8500_wdt_suspend), 137 + .resume = pm_ptr(db8500_wdt_resume), 141 138 .driver = { 142 139 .name = "db8500_wdt", 143 140 },