drivers/rtc/rtc-mrst: Fix suspend/resume
PATCH 1/1 drivers/rtc/rtc-mrst: Fix suspend/resume
The Moorestown RTC driver implements suspend and resume callbacks and assigns them to the suspend and resume fields of the device_driver struct. These callbacks are never actually called by anything though.
Modify the driver to properly use dev_pm_ops so that the suspend and resume functions are actually executed upon suspend/resume.
--- drivers/rtc/rtc-mrst.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/rtc/rtc-mrst.c +9 -8
@@ -415,8 +415,8 @@ static void rtc_mrst_do_remove(struct device *dev) mrst->dev =NULL ; } -#ifdef CONFIG_PM -static int mrst_suspend (struct device *dev,pm_message_t mesg) +#ifdef CONFIG_PM_SLEEP +static int mrst_suspend (struct device *dev) {struct mrst_rtc *mrst =dev_get_drvdata (dev);unsigned char tmp;
@@ -455,7 +455,7 @@ static int mrst_suspend(struct device *dev, pm_message_t mesg)*/ static inline int mrst_poweroff (struct device *dev) { -return mrst_suspend (dev,PMSG_HIBERNATE ); +return mrst_suspend (dev); }static int mrst_resume (struct device *dev)
@@ -492,9 +492,11 @@ static int mrst_resume(struct device *dev)return 0 ; } +static SIMPLE_DEV_PM_OPS(mrst_pm_ops, mrst_suspend, mrst_resume); +#define MRST_PM_OPS (&mrst_pm_ops) +#else -#define mrst_suspend NULL -#define mrst_resume NULL +#define MRST_PM_OPS NULLstatic inline int mrst_poweroff (struct device *dev) {
@@ -531,9 +533,8 @@ static struct platform_driver vrtc_mrst_platform_driver = { .remove = vrtc_mrst_platform_remove, .shutdown = vrtc_mrst_platform_shutdown, .driver = { - .name = (char *) driver_name, - .suspend = mrst_suspend, - .resume = mrst_resume, + .name = (char *) driver_name, + .pm = MRST_PM_OPS, } };
Signature · 1 line
1.8.0
Quoted 8 lines · On Sun, 15 Mar 2015 15:18:29 +0100 Lars-Peter Clausen <[email protected]> wrote:
The Moorestown RTC driver implements suspend and resume callbacks and assigns them to the suspend and resume fields of the
device_driverstruct. These callbacks are never actually called by anything though.Modify the driver to properly use
dev_pm_opsso that the suspend and resume functions are actually executed upon suspend/resume.
Review static struct platform_driver vrtc_mrst_platform_driver = { · line 538
Quoted 9 lines
(quoted diff) +2
-3@@ -531,9 +533,8 @@ static struct platform_driver vrtc_mrst_platform_driver = { .remove = vrtc_mrst_platform_remove, .shutdown = vrtc_mrst_platform_shutdown, .driver = { - .name = (char *) driver_name, - .suspend = mrst_suspend, - .resume = mrst_resume, + .name = (char *) driver_name, + .pm = MRST_PM_OPS, }
The cast isn't needed?
From: Andrew Morton <[email protected]>
Subject: drivers-rtc-rtc-mrst-fix-suspend-resume-fix
device_driver.name is const char *
---
drivers/rtc/rtc-mrst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-mrst.c renamed from drivers/rtc/rtc-mrst.c~drivers-rtc-rtc-mrst-fix-suspend-resume-fix +1 -1
@@ -531,7 +531,7 @@ static struct platform_driver vrtc_mrst_ .remove = vrtc_mrst_platform_remove, .shutdown = vrtc_mrst_platform_shutdown, .driver = { - .name = (char *) driver_name, + .name = driver_name, .pm = MRST_PM_OPS, } };
_