aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 19:21:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 21:28:39 -0400
commit62068e2c4594c61de34fbe857f5b29e8d2deebba (patch)
tree4ade80e71a05ba62b111340080df78391aed53d9 /drivers/rtc
parentb4df8f6ca1d93a89b67dd29a785757f289475729 (diff)
rtc: rtc-coh901331: convert coh901331_driver to dev_pm_ops
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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-coh901331.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
index bf0387f80d2d..93c06588ddca 100644
--- a/drivers/rtc/rtc-coh901331.c
+++ b/drivers/rtc/rtc-coh901331.c
@@ -47,7 +47,7 @@ struct coh901331_port {
47 u32 physize; 47 u32 physize;
48 void __iomem *virtbase; 48 void __iomem *virtbase;
49 int irq; 49 int irq;
50#ifdef CONFIG_PM 50#ifdef CONFIG_PM_SLEEP
51 u32 irqmaskstore; 51 u32 irqmaskstore;
52#endif 52#endif
53}; 53};
@@ -225,17 +225,17 @@ static int __init coh901331_probe(struct platform_device *pdev)
225 return ret; 225 return ret;
226} 226}
227 227
228#ifdef CONFIG_PM 228#ifdef CONFIG_PM_SLEEP
229static int coh901331_suspend(struct platform_device *pdev, pm_message_t state) 229static int coh901331_suspend(struct device *dev)
230{ 230{
231 struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); 231 struct coh901331_port *rtap = dev_get_drvdata(dev);
232 232
233 /* 233 /*
234 * If this RTC alarm will be used for waking the system up, 234 * If this RTC alarm will be used for waking the system up,
235 * don't disable it of course. Else we just disable the alarm 235 * don't disable it of course. Else we just disable the alarm
236 * and await suspension. 236 * and await suspension.
237 */ 237 */
238 if (device_may_wakeup(&pdev->dev)) { 238 if (device_may_wakeup(dev)) {
239 enable_irq_wake(rtap->irq); 239 enable_irq_wake(rtap->irq);
240 } else { 240 } else {
241 clk_enable(rtap->clk); 241 clk_enable(rtap->clk);
@@ -247,12 +247,12 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state)
247 return 0; 247 return 0;
248} 248}
249 249
250static int coh901331_resume(struct platform_device *pdev) 250static int coh901331_resume(struct device *dev)
251{ 251{
252 struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); 252 struct coh901331_port *rtap = dev_get_drvdata(dev);
253 253
254 clk_prepare(rtap->clk); 254 clk_prepare(rtap->clk);
255 if (device_may_wakeup(&pdev->dev)) { 255 if (device_may_wakeup(dev)) {
256 disable_irq_wake(rtap->irq); 256 disable_irq_wake(rtap->irq);
257 } else { 257 } else {
258 clk_enable(rtap->clk); 258 clk_enable(rtap->clk);
@@ -261,11 +261,10 @@ static int coh901331_resume(struct platform_device *pdev)
261 } 261 }
262 return 0; 262 return 0;
263} 263}
264#else
265#define coh901331_suspend NULL
266#define coh901331_resume NULL
267#endif 264#endif
268 265
266static SIMPLE_DEV_PM_OPS(coh901331_pm_ops, coh901331_suspend, coh901331_resume);
267
269static void coh901331_shutdown(struct platform_device *pdev) 268static void coh901331_shutdown(struct platform_device *pdev)
270{ 269{
271 struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); 270 struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev);
@@ -279,10 +278,9 @@ static struct platform_driver coh901331_driver = {
279 .driver = { 278 .driver = {
280 .name = "rtc-coh901331", 279 .name = "rtc-coh901331",
281 .owner = THIS_MODULE, 280 .owner = THIS_MODULE,
281 .pm = &coh901331_pm_ops,
282 }, 282 },
283 .remove = __exit_p(coh901331_remove), 283 .remove = __exit_p(coh901331_remove),
284 .suspend = coh901331_suspend,
285 .resume = coh901331_resume,
286 .shutdown = coh901331_shutdown, 284 .shutdown = coh901331_shutdown,
287}; 285};
288 286