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

2019-04-29 Thread Anson Huang
Hi, Trent

> -Original Message-
> From: Trent Piepho [mailto:tpie...@impinj.com]
> Sent: Tuesday, April 30, 2019 1:13 AM
> To: linux-...@vger.kernel.org; Anson Huang ;
> a.zu...@towertech.it; linux-kernel@vger.kernel.org;
> alexandre.bell...@bootlin.com
> Cc: dl-linux-imx 
> Subject: Re: [PATCH] rtc: snvs: Use __maybe_unused instead of #if
> CONFIG_PM_SLEEP
> 
> On Mon, 2019-04-29 at 07:02 +, 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 
> 
> 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.

You are right, I missed this part, have sent out V2 patch with 
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() used to define the ops, please help review.

Thanks,
Anson.

> 
> 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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flkml.o
> rg%2Flkml%2F2019%2F1%2F17%2F376data=02%7C01%7Canson.huan
> g%40nxp.com%7C5b5aea8d276d4a3e195008d6ccc5e1b5%7C686ea1d3bc2b4
> c6fa92cd99c5c301635%7C0%7C1%7C636921547599787617sdata=K8jv
> KXTCIPw4IDgx8aA2Nn%2Fs64FiSpmf7GVuzuXulbI%3Dreserved=0


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

2019-04-29 Thread Trent Piepho
On Mon, 2019-04-29 at 07:02 +, 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 

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


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

2019-04-29 Thread Aisheng Dong
> From: Anson Huang
> Sent: Monday, April 29, 2019 3:03 PM
> 
> Use __maybe_unused for power management related functions instead of #if
> CONFIG_PM_SLEEP to simply the code.
> 
> Signed-off-by: Anson Huang 

Reviewed-by: Dong Aisheng 

Regards
Dong Aisheng