linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/rtc/rtc-mrst: Fix suspend/resume
@ 2015-03-15 14:18 Lars-Peter Clausen
  2015-03-17 22:50 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Lars-Peter Clausen @ 2015-03-15 14:18 UTC (permalink / raw)
  To: Andrew Morton, Alessandro Zummo
  Cc: Feng Tang, rtc-linux, linux-kernel, Lars-Peter Clausen

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.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/rtc/rtc-mrst.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index ab02bda..175a5fb 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -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 NULL
 
 static 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,
 	}
 };
 
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers/rtc/rtc-mrst: Fix suspend/resume
  2015-03-15 14:18 [PATCH] drivers/rtc/rtc-mrst: Fix suspend/resume Lars-Peter Clausen
@ 2015-03-17 22:50 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2015-03-17 22:50 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Alessandro Zummo, Feng Tang, rtc-linux, linux-kernel

On Sun, 15 Mar 2015 15:18:29 +0100 Lars-Peter Clausen <lars@metafoo.de> wrote:

> 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.
> 
> @@ -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 <akpm@linux-foundation.org>
Subject: drivers-rtc-rtc-mrst-fix-suspend-resume-fix

device_driver.name is const char *

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Feng Tang <feng.tang@intel.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/rtc/rtc-mrst.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/rtc/rtc-mrst.c~drivers-rtc-rtc-mrst-fix-suspend-resume-fix drivers/rtc/rtc-mrst.c
--- a/drivers/rtc/rtc-mrst.c~drivers-rtc-rtc-mrst-fix-suspend-resume-fix
+++ a/drivers/rtc/rtc-mrst.c
@@ -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,
 	}
 };
_


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-17 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-15 14:18 [PATCH] drivers/rtc/rtc-mrst: Fix suspend/resume Lars-Peter Clausen
2015-03-17 22:50 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).