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

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 <paul@crapouillou.net>
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20221020185047.1001522-4-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
0327476d d36eda79

+2 -9
+2 -9
drivers/watchdog/omap_wdt.c
··· 316 316 return 0; 317 317 } 318 318 319 - #ifdef CONFIG_PM 320 - 321 319 /* REVISIT ... not clear this is the best way to handle system suspend; and 322 320 * it's very inappropriate for selective device suspend (e.g. suspending this 323 321 * through sysfs rather than by stopping the watchdog daemon). Also, this ··· 351 353 return 0; 352 354 } 353 355 354 - #else 355 - #define omap_wdt_suspend NULL 356 - #define omap_wdt_resume NULL 357 - #endif 358 - 359 356 static const struct of_device_id omap_wdt_of_match[] = { 360 357 { .compatible = "ti,omap3-wdt", }, 361 358 {}, ··· 361 368 .probe = omap_wdt_probe, 362 369 .remove = omap_wdt_remove, 363 370 .shutdown = omap_wdt_shutdown, 364 - .suspend = omap_wdt_suspend, 365 - .resume = omap_wdt_resume, 371 + .suspend = pm_ptr(omap_wdt_suspend), 372 + .resume = pm_ptr(omap_wdt_resume), 366 373 .driver = { 367 374 .name = "omap_wdt", 368 375 .of_match_table = omap_wdt_of_match,