Commit 62068e2c authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

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: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b4df8f6c
...@@ -47,7 +47,7 @@ struct coh901331_port { ...@@ -47,7 +47,7 @@ struct coh901331_port {
u32 physize; u32 physize;
void __iomem *virtbase; void __iomem *virtbase;
int irq; int irq;
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
u32 irqmaskstore; u32 irqmaskstore;
#endif #endif
}; };
...@@ -225,17 +225,17 @@ static int __init coh901331_probe(struct platform_device *pdev) ...@@ -225,17 +225,17 @@ static int __init coh901331_probe(struct platform_device *pdev)
return ret; return ret;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int coh901331_suspend(struct platform_device *pdev, pm_message_t state) static int coh901331_suspend(struct device *dev)
{ {
struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); struct coh901331_port *rtap = dev_get_drvdata(dev);
/* /*
* If this RTC alarm will be used for waking the system up, * If this RTC alarm will be used for waking the system up,
* don't disable it of course. Else we just disable the alarm * don't disable it of course. Else we just disable the alarm
* and await suspension. * and await suspension.
*/ */
if (device_may_wakeup(&pdev->dev)) { if (device_may_wakeup(dev)) {
enable_irq_wake(rtap->irq); enable_irq_wake(rtap->irq);
} else { } else {
clk_enable(rtap->clk); clk_enable(rtap->clk);
...@@ -247,12 +247,12 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -247,12 +247,12 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state)
return 0; return 0;
} }
static int coh901331_resume(struct platform_device *pdev) static int coh901331_resume(struct device *dev)
{ {
struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); struct coh901331_port *rtap = dev_get_drvdata(dev);
clk_prepare(rtap->clk); clk_prepare(rtap->clk);
if (device_may_wakeup(&pdev->dev)) { if (device_may_wakeup(dev)) {
disable_irq_wake(rtap->irq); disable_irq_wake(rtap->irq);
} else { } else {
clk_enable(rtap->clk); clk_enable(rtap->clk);
...@@ -261,11 +261,10 @@ static int coh901331_resume(struct platform_device *pdev) ...@@ -261,11 +261,10 @@ static int coh901331_resume(struct platform_device *pdev)
} }
return 0; return 0;
} }
#else
#define coh901331_suspend NULL
#define coh901331_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(coh901331_pm_ops, coh901331_suspend, coh901331_resume);
static void coh901331_shutdown(struct platform_device *pdev) static void coh901331_shutdown(struct platform_device *pdev)
{ {
struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev);
...@@ -279,10 +278,9 @@ static struct platform_driver coh901331_driver = { ...@@ -279,10 +278,9 @@ static struct platform_driver coh901331_driver = {
.driver = { .driver = {
.name = "rtc-coh901331", .name = "rtc-coh901331",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &coh901331_pm_ops,
}, },
.remove = __exit_p(coh901331_remove), .remove = __exit_p(coh901331_remove),
.suspend = coh901331_suspend,
.resume = coh901331_resume,
.shutdown = coh901331_shutdown, .shutdown = coh901331_shutdown,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment