* [PATCH] drivers/rtc/class: Convert from Legacy pm ops to dev_pm_ops
@ 2013-05-31 15:57 Shuah Khan
2013-05-31 16:50 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2013-05-31 15:57 UTC (permalink / raw)
To: a.zummo, rafael.j.wysocki; +Cc: Shuah Khan, rtc-linux, linux-kernel, shuahkhan
Convert drivers/rtc/class to use dev_pm_ops for power management and
remove Legacy PM ops hooks. With this change, rtc class registers
suspend/resume callbacks via class->pm (dev_pm_ops) instead of Legacy
class->suspend/resume. When __device_suspend() runs call-backs, it will
find class->pm ops for the rtc class.
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
drivers/rtc/class.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 6638540..21d83ec 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -135,9 +135,9 @@ static int rtc_resume(struct device *dev)
return 0;
}
+static SIMPLE_DEV_PM_OPS(rtc_class_dev_pm_ops, rtc_suspend, rtc_resume);
#else
-#define rtc_suspend NULL
-#define rtc_resume NULL
+#define rtc_class_dev_pm_ops NULL
#endif
@@ -336,8 +336,7 @@ static int __init rtc_init(void)
pr_err("couldn't create class\n");
return PTR_ERR(rtc_class);
}
- rtc_class->suspend = rtc_suspend;
- rtc_class->resume = rtc_resume;
+ rtc_class->pm = &rtc_class_dev_pm_ops;
rtc_dev_init();
rtc_sysfs_init(rtc_class);
return 0;
--
1.7.10.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/rtc/class: Convert from Legacy pm ops to dev_pm_ops
2013-05-31 15:57 [PATCH] drivers/rtc/class: Convert from Legacy pm ops to dev_pm_ops Shuah Khan
@ 2013-05-31 16:50 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2013-05-31 16:50 UTC (permalink / raw)
To: Shuah Khan; +Cc: a.zummo, rafael.j.wysocki, rtc-linux, linux-kernel, shuahkhan
On 05/31/2013 09:58 AM, Shuah Khan wrote:
> Convert drivers/rtc/class to use dev_pm_ops for power management and
> remove Legacy PM ops hooks. With this change, rtc class registers
> suspend/resume callbacks via class->pm (dev_pm_ops) instead of Legacy
> class->suspend/resume. When __device_suspend() runs call-backs, it will
> find class->pm ops for the rtc class.
>
> Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
> ---
> drivers/rtc/class.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
> index 6638540..21d83ec 100644
> --- a/drivers/rtc/class.c
> +++ b/drivers/rtc/class.c
> @@ -135,9 +135,9 @@ static int rtc_resume(struct device *dev)
> return 0;
> }
>
> +static SIMPLE_DEV_PM_OPS(rtc_class_dev_pm_ops, rtc_suspend, rtc_resume);
> #else
> -#define rtc_suspend NULL
> -#define rtc_resume NULL
> +#define rtc_class_dev_pm_ops NULL
> #endif
>
>
> @@ -336,8 +336,7 @@ static int __init rtc_init(void)
> pr_err("couldn't create class\n");
> return PTR_ERR(rtc_class);
> }
> - rtc_class->suspend = rtc_suspend;
> - rtc_class->resume = rtc_resume;
> + rtc_class->pm = &rtc_class_dev_pm_ops;
> rtc_dev_init();
> rtc_sysfs_init(rtc_class);
> return 0;
>
oops. I noticed a build warning rtc_suspend()
drivers/rtc/class.c:138:8: warning: initialization from incompatible
pointer type [enabled by default]
drivers/rtc/class.c:138:8: warning: (near initialization for
‘rtc_class_dev_pm_ops.suspend’) [enabled by default]
Please ignore this version. I will re-send v2 with the correct one. I
missed removing the extra pm_message_t mesg on rtc_suspend().
-- Shuah
Shuah Khan, Linux Kernel Developer - Open Source Group Samsung Research
America (Silicon Valley) shuah.kh@samsung.com | (970) 672-0658
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-31 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-31 15:57 [PATCH] drivers/rtc/class: Convert from Legacy pm ops to dev_pm_ops Shuah Khan
2013-05-31 16:50 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®