* [PATCH] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP
@ 2019-04-29 7:02 Anson Huang
2019-04-29 10:37 ` Aisheng Dong
2019-04-29 17:12 ` Trent Piepho
0 siblings, 2 replies; 4+ messages in thread
From: Anson Huang @ 2019-04-29 7:02 UTC (permalink / raw)
To: a.zummo, alexandre.belloni, linux-rtc, linux-kernel; +Cc: dl-linux-imx
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@nxp.com>
---
drivers/rtc/rtc-snvs.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
index e0edd594..2a2b8da 100644
--- a/drivers/rtc/rtc-snvs.c
+++ b/drivers/rtc/rtc-snvs.c
@@ -360,9 +360,7 @@ static int snvs_rtc_probe(struct platform_device *pdev)
return ret;
}
-#ifdef CONFIG_PM_SLEEP
-
-static int snvs_rtc_suspend_noirq(struct device *dev)
+static int __maybe_unused snvs_rtc_suspend_noirq(struct device *dev)
{
struct snvs_rtc_data *data = dev_get_drvdata(dev);
@@ -372,7 +370,7 @@ static int snvs_rtc_suspend_noirq(struct device *dev)
return 0;
}
-static int snvs_rtc_resume_noirq(struct device *dev)
+static int __maybe_unused snvs_rtc_resume_noirq(struct device *dev)
{
struct snvs_rtc_data *data = dev_get_drvdata(dev);
@@ -387,14 +385,6 @@ static const struct dev_pm_ops snvs_rtc_pm_ops = {
.resume_noirq = snvs_rtc_resume_noirq,
};
-#define SNVS_RTC_PM_OPS (&snvs_rtc_pm_ops)
-
-#else
-
-#define SNVS_RTC_PM_OPS NULL
-
-#endif
-
static const struct of_device_id snvs_dt_ids[] = {
{ .compatible = "fsl,sec-v4.0-mon-rtc-lp", },
{ /* sentinel */ }
@@ -404,7 +394,7 @@ MODULE_DEVICE_TABLE(of, snvs_dt_ids);
static struct platform_driver snvs_rtc_driver = {
.driver = {
.name = "snvs_rtc",
- .pm = SNVS_RTC_PM_OPS,
+ .pm = &snvs_rtc_pm_ops,
.of_match_table = snvs_dt_ids,
},
.probe = snvs_rtc_probe,
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP
2019-04-29 7:02 [PATCH] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson Huang
@ 2019-04-29 10:37 ` Aisheng Dong
2019-04-29 17:12 ` Trent Piepho
1 sibling, 0 replies; 4+ messages in thread
From: Aisheng Dong @ 2019-04-29 10:37 UTC (permalink / raw)
To: Anson Huang, a.zummo, alexandre.belloni, linux-rtc, linux-kernel
Cc: dl-linux-imx
> 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 <Anson.Huang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP
2019-04-29 7:02 [PATCH] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson Huang
2019-04-29 10:37 ` Aisheng Dong
@ 2019-04-29 17:12 ` Trent Piepho
2019-04-30 1:09 ` Anson Huang
1 sibling, 1 reply; 4+ messages in thread
From: Trent Piepho @ 2019-04-29 17:12 UTC (permalink / raw)
To: linux-rtc, anson.huang, a.zummo, linux-kernel, alexandre.belloni
Cc: linux-imx
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@nxp.com>
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP
2019-04-29 17:12 ` Trent Piepho
@ 2019-04-30 1:09 ` Anson Huang
0 siblings, 0 replies; 4+ messages in thread
From: Anson Huang @ 2019-04-30 1:09 UTC (permalink / raw)
To: Trent Piepho, linux-rtc, a.zummo, linux-kernel, alexandre.belloni
Cc: dl-linux-imx
Hi, Trent
> -----Original Message-----
> From: Trent Piepho [mailto:tpiepho@impinj.com]
> Sent: Tuesday, April 30, 2019 1:13 AM
> To: linux-rtc@vger.kernel.org; Anson Huang <anson.huang@nxp.com>;
> a.zummo@towertech.it; linux-kernel@vger.kernel.org;
> alexandre.belloni@bootlin.com
> Cc: dl-linux-imx <linux-imx@nxp.com>
> Subject: Re: [PATCH] rtc: snvs: Use __maybe_unused instead of #if
> CONFIG_PM_SLEEP
>
> 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@nxp.com>
>
> 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%2F376&data=02%7C01%7Canson.huan
> g%40nxp.com%7C5b5aea8d276d4a3e195008d6ccc5e1b5%7C686ea1d3bc2b4
> c6fa92cd99c5c301635%7C0%7C1%7C636921547599787617&sdata=K8jv
> KXTCIPw4IDgx8aA2Nn%2Fs64FiSpmf7GVuzuXulbI%3D&reserved=0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-30 1:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 7:02 [PATCH] rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Anson Huang
2019-04-29 10:37 ` Aisheng Dong
2019-04-29 17:12 ` Trent Piepho
2019-04-30 1:09 ` Anson Huang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.