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

clocksource/drivers/ingenic-timer: Use pm_sleep_ptr() macro

The use of the pm_sleep_ptr() macro allows the compiler to always see
the dev_pm_ops structure and related functions, while still allowing the
unused code to be removed, without the need for the __maybe_unused
markings.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230618153937.96649-1-paul@crapouillou.net

authored by

Paul Cercueil and committed by
Daniel Lezcano
ea950510 2951580b

+4 -6
+4 -6
drivers/clocksource/ingenic-timer.c
··· 369 369 return 0; 370 370 } 371 371 372 - static int __maybe_unused ingenic_tcu_suspend(struct device *dev) 372 + static int ingenic_tcu_suspend(struct device *dev) 373 373 { 374 374 struct ingenic_tcu *tcu = dev_get_drvdata(dev); 375 375 unsigned int cpu; ··· 382 382 return 0; 383 383 } 384 384 385 - static int __maybe_unused ingenic_tcu_resume(struct device *dev) 385 + static int ingenic_tcu_resume(struct device *dev) 386 386 { 387 387 struct ingenic_tcu *tcu = dev_get_drvdata(dev); 388 388 unsigned int cpu; ··· 406 406 return ret; 407 407 } 408 408 409 - static const struct dev_pm_ops __maybe_unused ingenic_tcu_pm_ops = { 409 + static const struct dev_pm_ops ingenic_tcu_pm_ops = { 410 410 /* _noirq: We want the TCU clocks to be gated last / ungated first */ 411 411 .suspend_noirq = ingenic_tcu_suspend, 412 412 .resume_noirq = ingenic_tcu_resume, ··· 415 415 static struct platform_driver ingenic_tcu_driver = { 416 416 .driver = { 417 417 .name = "ingenic-tcu-timer", 418 - #ifdef CONFIG_PM_SLEEP 419 - .pm = &ingenic_tcu_pm_ops, 420 - #endif 418 + .pm = pm_sleep_ptr(&ingenic_tcu_pm_ops), 421 419 .of_match_table = ingenic_tcu_of_match, 422 420 }, 423 421 };