linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/8] rtc: rtc-at91sam9: convert at91_rtc_driver to dev_pm_ops
@ 2013-04-17  1:06 Jingoo Han
  2013-04-17  1:07 ` [PATCH RESEND 2/8] rtc: rtc-bfin: convert bfin_rtc_driver " Jingoo Han
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Jingoo Han @ 2013-04-17  1:06 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: linux-kernel, 'Alessandro Zummo',
	rtc-linux, 'Jingoo Han'

Instead of using legacy suspend/resume methods, using newer dev_pm_ops
structure allows better control over power management.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/rtc/rtc-at91sam9.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 39cfd2e..4843e42 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -414,14 +414,13 @@ static void at91_rtc_shutdown(struct platform_device *pdev)
 	rtt_writel(rtc, MR, mr & ~rtc->imr);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 /* AT91SAM9 RTC Power management control */
 
-static int at91_rtc_suspend(struct platform_device *pdev,
-					pm_message_t state)
+static int at91_rtc_suspend(struct device *dev)
 {
-	struct sam9_rtc	*rtc = platform_get_drvdata(pdev);
+	struct sam9_rtc	*rtc = dev_get_drvdata(dev);
 	u32		mr = rtt_readl(rtc, MR);
 
 	/*
@@ -430,7 +429,7 @@ static int at91_rtc_suspend(struct platform_device *pdev,
 	 */
 	rtc->imr = mr & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
 	if (rtc->imr) {
-		if (device_may_wakeup(&pdev->dev) && (mr & AT91_RTT_ALMIEN)) {
+		if (device_may_wakeup(dev) && (mr & AT91_RTT_ALMIEN)) {
 			enable_irq_wake(rtc->irq);
 			/* don't let RTTINC cause wakeups */
 			if (mr & AT91_RTT_RTTINCIEN)
@@ -442,13 +441,13 @@ static int at91_rtc_suspend(struct platform_device *pdev,
 	return 0;
 }
 
-static int at91_rtc_resume(struct platform_device *pdev)
+static int at91_rtc_resume(struct device *dev)
 {
-	struct sam9_rtc	*rtc = platform_get_drvdata(pdev);
+	struct sam9_rtc	*rtc = dev_get_drvdata(dev);
 	u32		mr;
 
 	if (rtc->imr) {
-		if (device_may_wakeup(&pdev->dev))
+		if (device_may_wakeup(dev))
 			disable_irq_wake(rtc->irq);
 		mr = rtt_readl(rtc, MR);
 		rtt_writel(rtc, MR, mr | rtc->imr);
@@ -456,20 +455,18 @@ static int at91_rtc_resume(struct platform_device *pdev)
 
 	return 0;
 }
-#else
-#define at91_rtc_suspend	NULL
-#define at91_rtc_resume		NULL
 #endif
 
+static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume);
+
 static struct platform_driver at91_rtc_driver = {
 	.probe		= at91_rtc_probe,
 	.remove		= at91_rtc_remove,
 	.shutdown	= at91_rtc_shutdown,
-	.suspend	= at91_rtc_suspend,
-	.resume		= at91_rtc_resume,
 	.driver		= {
 		.name	= "rtc-at91sam9",
 		.owner	= THIS_MODULE,
+		.pm	= &at91_rtc_pm_ops,
 	},
 };
 
-- 
1.7.2.5



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

end of thread, other threads:[~2013-04-17  1:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-17  1:06 [PATCH RESEND 1/8] rtc: rtc-at91sam9: convert at91_rtc_driver to dev_pm_ops Jingoo Han
2013-04-17  1:07 ` [PATCH RESEND 2/8] rtc: rtc-bfin: convert bfin_rtc_driver " Jingoo Han
2013-04-17  1:07 ` [PATCH RESEND 3/8] rtc: rtc-coh901331: convert coh901331_driver " Jingoo Han
2013-04-17  1:07 ` [PATCH RESEND 4/8] rtc: rtc-omap: convert omap_rtc_driver " Jingoo Han
2013-04-17  1:08 ` [PATCH RESEND 5/8] rtc: rtc-puv3: convert puv3_rtc_driver " Jingoo Han
2013-04-17  1:08 ` [PATCH RESEND 6/8] rtc: rtc-spear: convert spear_rtc_driver " Jingoo Han
2013-04-17  1:08 ` [PATCH RESEND 7/8] rtc: rtc-stmp3xxx: convert stmp3xxx_rtcdrv " Jingoo Han
2013-04-17  1:09 ` [PATCH RESEND 8/8] rtc: rtc-twl: convert twl4030rtc_driver " Jingoo Han

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).