Skip to content

Commit ea95051

Browse files
pcercueidlezcano
authored andcommitted
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
1 parent 2951580 commit ea95051

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/clocksource/ingenic-timer.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static int __init ingenic_tcu_probe(struct platform_device *pdev)
369369
return 0;
370370
}
371371

372-
static int __maybe_unused ingenic_tcu_suspend(struct device *dev)
372+
static int ingenic_tcu_suspend(struct device *dev)
373373
{
374374
struct ingenic_tcu *tcu = dev_get_drvdata(dev);
375375
unsigned int cpu;
@@ -382,7 +382,7 @@ static int __maybe_unused ingenic_tcu_suspend(struct device *dev)
382382
return 0;
383383
}
384384

385-
static int __maybe_unused ingenic_tcu_resume(struct device *dev)
385+
static int ingenic_tcu_resume(struct device *dev)
386386
{
387387
struct ingenic_tcu *tcu = dev_get_drvdata(dev);
388388
unsigned int cpu;
@@ -406,7 +406,7 @@ static int __maybe_unused ingenic_tcu_resume(struct device *dev)
406406
return ret;
407407
}
408408

409-
static const struct dev_pm_ops __maybe_unused ingenic_tcu_pm_ops = {
409+
static const struct dev_pm_ops ingenic_tcu_pm_ops = {
410410
/* _noirq: We want the TCU clocks to be gated last / ungated first */
411411
.suspend_noirq = ingenic_tcu_suspend,
412412
.resume_noirq = ingenic_tcu_resume,
@@ -415,9 +415,7 @@ static const struct dev_pm_ops __maybe_unused ingenic_tcu_pm_ops = {
415415
static struct platform_driver ingenic_tcu_driver = {
416416
.driver = {
417417
.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),
421419
.of_match_table = ingenic_tcu_of_match,
422420
},
423421
};

0 commit comments

Comments
 (0)