Re: [PATCH] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP

From: Trent Piepho
Date: Mon Apr 29 2019 - 13:12:41 EST


On Mon, 2019-04-29 at 07:02 +0000, Anson Huang wrote:
> Use __maybe_unused for power management related functions
> instead of #if CONFIG_PM_SLEEP to simply the code.
>
> Signed-off-by: Anson Huang <Anson.Huang@xxxxxxx>

This will result in the functions always being included, even if
PM_SLEEP is off...

>
> @@ -387,14 +385,6 @@ static const struct dev_pm_ops snvs_rtc_pm_ops = {
> .resume_noirq = snvs_rtc_resume_noirq,
> };

...because they will always be used by the definition of
snvs_rtc_pm_ops here.

In order for this to work, SIMPLE_DEV_PM_OPS() needs to be used,
so that the dev_pm_ops struct is empty when PM is off and the functions
don't get referenced. See: https://lkml.org/lkml/2019/1/17/376