* [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
* [PATCH RESEND 2/8] rtc: rtc-bfin: convert bfin_rtc_driver to dev_pm_ops
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 ` Jingoo Han
2013-04-17 1:07 ` [PATCH RESEND 3/8] rtc: rtc-coh901331: convert coh901331_driver " Jingoo Han
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2013-04-17 1:07 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-bfin.c | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index 4ec614b..f35b17a 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -402,11 +402,9 @@ static int bfin_rtc_remove(struct platform_device *pdev)
return 0;
}
-#ifdef CONFIG_PM
-static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int bfin_rtc_suspend(struct device *dev)
{
- struct device *dev = &pdev->dev;
-
dev_dbg_stamp(dev);
if (device_may_wakeup(dev)) {
@@ -418,10 +416,8 @@ static int bfin_rtc_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}
-static int bfin_rtc_resume(struct platform_device *pdev)
+static int bfin_rtc_resume(struct device *dev)
{
- struct device *dev = &pdev->dev;
-
dev_dbg_stamp(dev);
if (device_may_wakeup(dev))
@@ -440,20 +436,18 @@ static int bfin_rtc_resume(struct platform_device *pdev)
return 0;
}
-#else
-# define bfin_rtc_suspend NULL
-# define bfin_rtc_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(bfin_rtc_pm_ops, bfin_rtc_suspend, bfin_rtc_resume);
+
static struct platform_driver bfin_rtc_driver = {
.driver = {
.name = "rtc-bfin",
.owner = THIS_MODULE,
+ .pm = &bfin_rtc_pm_ops,
},
.probe = bfin_rtc_probe,
.remove = bfin_rtc_remove,
- .suspend = bfin_rtc_suspend,
- .resume = bfin_rtc_resume,
};
module_platform_driver(bfin_rtc_driver);
--
1.7.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND 3/8] rtc: rtc-coh901331: convert coh901331_driver to dev_pm_ops
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 ` Jingoo Han
2013-04-17 1:07 ` [PATCH RESEND 4/8] rtc: rtc-omap: convert omap_rtc_driver " Jingoo Han
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2013-04-17 1:07 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-coh901331.c | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
index bf0387f..93c0658 100644
--- a/drivers/rtc/rtc-coh901331.c
+++ b/drivers/rtc/rtc-coh901331.c
@@ -47,7 +47,7 @@ struct coh901331_port {
u32 physize;
void __iomem *virtbase;
int irq;
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
u32 irqmaskstore;
#endif
};
@@ -225,17 +225,17 @@ static int __init coh901331_probe(struct platform_device *pdev)
return ret;
}
-#ifdef CONFIG_PM
-static int coh901331_suspend(struct platform_device *pdev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+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,
* don't disable it of course. Else we just disable the alarm
* and await suspension.
*/
- if (device_may_wakeup(&pdev->dev)) {
+ if (device_may_wakeup(dev)) {
enable_irq_wake(rtap->irq);
} else {
clk_enable(rtap->clk);
@@ -247,12 +247,12 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state)
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);
- if (device_may_wakeup(&pdev->dev)) {
+ if (device_may_wakeup(dev)) {
disable_irq_wake(rtap->irq);
} else {
clk_enable(rtap->clk);
@@ -261,11 +261,10 @@ static int coh901331_resume(struct platform_device *pdev)
}
return 0;
}
-#else
-#define coh901331_suspend NULL
-#define coh901331_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(coh901331_pm_ops, coh901331_suspend, coh901331_resume);
+
static void coh901331_shutdown(struct platform_device *pdev)
{
struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev);
@@ -279,10 +278,9 @@ static struct platform_driver coh901331_driver = {
.driver = {
.name = "rtc-coh901331",
.owner = THIS_MODULE,
+ .pm = &coh901331_pm_ops,
},
.remove = __exit_p(coh901331_remove),
- .suspend = coh901331_suspend,
- .resume = coh901331_resume,
.shutdown = coh901331_shutdown,
};
--
1.7.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND 4/8] rtc: rtc-omap: convert omap_rtc_driver to dev_pm_ops
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 ` Jingoo Han
2013-04-17 1:08 ` [PATCH RESEND 5/8] rtc: rtc-puv3: convert puv3_rtc_driver " Jingoo Han
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2013-04-17 1:07 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-omap.c | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index a1f9d30..4e1bdb8 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -464,11 +464,10 @@ static int __exit omap_rtc_remove(struct platform_device *pdev)
return 0;
}
-#ifdef CONFIG_PM
-
+#ifdef CONFIG_PM_SLEEP
static u8 irqstat;
-static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
+static int omap_rtc_suspend(struct device *dev)
{
irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG);
@@ -476,34 +475,32 @@ static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
* source, and in fact this enable() call is just saving a flag
* that's never used...
*/
- if (device_may_wakeup(&pdev->dev))
+ if (device_may_wakeup(dev))
enable_irq_wake(omap_rtc_alarm);
else
rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
/* Disable the clock/module */
- pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_put_sync(dev);
return 0;
}
-static int omap_rtc_resume(struct platform_device *pdev)
+static int omap_rtc_resume(struct device *dev)
{
/* Enable the clock/module so that we can access the registers */
- pm_runtime_get_sync(&pdev->dev);
+ pm_runtime_get_sync(dev);
- if (device_may_wakeup(&pdev->dev))
+ if (device_may_wakeup(dev))
disable_irq_wake(omap_rtc_alarm);
else
rtc_write(irqstat, OMAP_RTC_INTERRUPTS_REG);
return 0;
}
-
-#else
-#define omap_rtc_suspend NULL
-#define omap_rtc_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(omap_rtc_pm_ops, omap_rtc_suspend, omap_rtc_resume);
+
static void omap_rtc_shutdown(struct platform_device *pdev)
{
rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
@@ -512,12 +509,11 @@ static void omap_rtc_shutdown(struct platform_device *pdev)
MODULE_ALIAS("platform:omap_rtc");
static struct platform_driver omap_rtc_driver = {
.remove = __exit_p(omap_rtc_remove),
- .suspend = omap_rtc_suspend,
- .resume = omap_rtc_resume,
.shutdown = omap_rtc_shutdown,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
+ .pm = &omap_rtc_pm_ops,
.of_match_table = of_match_ptr(omap_rtc_of_match),
},
.id_table = omap_rtc_devtype,
--
1.7.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND 5/8] rtc: rtc-puv3: convert puv3_rtc_driver to dev_pm_ops
2013-04-17 1:06 [PATCH RESEND 1/8] rtc: rtc-at91sam9: convert at91_rtc_driver to dev_pm_ops Jingoo Han
` (2 preceding siblings ...)
2013-04-17 1:07 ` [PATCH RESEND 4/8] rtc: rtc-omap: convert omap_rtc_driver " Jingoo Han
@ 2013-04-17 1:08 ` Jingoo Han
2013-04-17 1:08 ` [PATCH RESEND 6/8] rtc: rtc-spear: convert spear_rtc_driver " Jingoo Han
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2013-04-17 1:08 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-puv3.c | 27 ++++++++++++---------------
1 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c
index 0407e13..72f4371 100644
--- a/drivers/rtc/rtc-puv3.c
+++ b/drivers/rtc/rtc-puv3.c
@@ -207,14 +207,14 @@ static const struct rtc_class_ops puv3_rtcops = {
.proc = puv3_rtc_proc,
};
-static void puv3_rtc_enable(struct platform_device *pdev, int en)
+static void puv3_rtc_enable(struct device *dev, int en)
{
if (!en) {
writel(readl(RTC_RTSR) & ~RTC_RTSR_HZE, RTC_RTSR);
} else {
/* re-enable the device, and check it is ok */
if ((readl(RTC_RTSR) & RTC_RTSR_HZE) == 0) {
- dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
+ dev_info(dev, "rtc disabled, re-enabling\n");
writel(readl(RTC_RTSR) | RTC_RTSR_HZE, RTC_RTSR);
}
}
@@ -276,7 +276,7 @@ static int puv3_rtc_probe(struct platform_device *pdev)
goto err_nores;
}
- puv3_rtc_enable(pdev, 1);
+ puv3_rtc_enable(&pdev->dev, 1);
/* register RTC and exit */
rtc = rtc_device_register("pkunity", &pdev->dev, &puv3_rtcops,
@@ -296,44 +296,41 @@ static int puv3_rtc_probe(struct platform_device *pdev)
return 0;
err_nortc:
- puv3_rtc_enable(pdev, 0);
+ puv3_rtc_enable(&pdev->dev, 0);
release_resource(puv3_rtc_mem);
err_nores:
return ret;
}
-#ifdef CONFIG_PM
-
+#ifdef CONFIG_PM_SLEEP
static int ticnt_save;
-static int puv3_rtc_suspend(struct platform_device *pdev, pm_message_t state)
+static int puv3_rtc_suspend(struct device *dev)
{
/* save RTAR for anyone using periodic interrupts */
ticnt_save = readl(RTC_RTAR);
- puv3_rtc_enable(pdev, 0);
+ puv3_rtc_enable(dev, 0);
return 0;
}
-static int puv3_rtc_resume(struct platform_device *pdev)
+static int puv3_rtc_resume(struct device *dev)
{
- puv3_rtc_enable(pdev, 1);
+ puv3_rtc_enable(dev, 1);
writel(ticnt_save, RTC_RTAR);
return 0;
}
-#else
-#define puv3_rtc_suspend NULL
-#define puv3_rtc_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(puv3_rtc_pm_ops, puv3_rtc_suspend, puv3_rtc_resume);
+
static struct platform_driver puv3_rtc_driver = {
.probe = puv3_rtc_probe,
.remove = puv3_rtc_remove,
- .suspend = puv3_rtc_suspend,
- .resume = puv3_rtc_resume,
.driver = {
.name = "PKUnity-v3-RTC",
.owner = THIS_MODULE,
+ .pm = &puv3_rtc_pm_ops,
}
};
--
1.7.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND 6/8] rtc: rtc-spear: convert spear_rtc_driver to dev_pm_ops
2013-04-17 1:06 [PATCH RESEND 1/8] rtc: rtc-at91sam9: convert at91_rtc_driver to dev_pm_ops Jingoo Han
` (3 preceding siblings ...)
2013-04-17 1:08 ` [PATCH RESEND 5/8] rtc: rtc-puv3: convert puv3_rtc_driver " Jingoo Han
@ 2013-04-17 1:08 ` 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
6 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2013-04-17 1:08 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-spear.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index db3ef61..574359c 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -434,10 +434,10 @@ static int spear_rtc_remove(struct platform_device *pdev)
return 0;
}
-#ifdef CONFIG_PM
-
-static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int spear_rtc_suspend(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct spear_rtc_config *config = platform_get_drvdata(pdev);
int irq;
@@ -453,8 +453,9 @@ static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}
-static int spear_rtc_resume(struct platform_device *pdev)
+static int spear_rtc_resume(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct spear_rtc_config *config = platform_get_drvdata(pdev);
int irq;
@@ -472,12 +473,10 @@ static int spear_rtc_resume(struct platform_device *pdev)
return 0;
}
-
-#else
-#define spear_rtc_suspend NULL
-#define spear_rtc_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(spear_rtc_pm_ops, spear_rtc_suspend, spear_rtc_resume);
+
static void spear_rtc_shutdown(struct platform_device *pdev)
{
struct spear_rtc_config *config = platform_get_drvdata(pdev);
@@ -497,11 +496,10 @@ MODULE_DEVICE_TABLE(of, spear_rtc_id_table);
static struct platform_driver spear_rtc_driver = {
.probe = spear_rtc_probe,
.remove = spear_rtc_remove,
- .suspend = spear_rtc_suspend,
- .resume = spear_rtc_resume,
.shutdown = spear_rtc_shutdown,
.driver = {
.name = "rtc-spear",
+ .pm = &spear_rtc_pm_ops,
.of_match_table = of_match_ptr(spear_rtc_id_table),
},
};
--
1.7.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND 7/8] rtc: rtc-stmp3xxx: convert stmp3xxx_rtcdrv to dev_pm_ops
2013-04-17 1:06 [PATCH RESEND 1/8] rtc: rtc-at91sam9: convert at91_rtc_driver to dev_pm_ops Jingoo Han
` (4 preceding siblings ...)
2013-04-17 1:08 ` [PATCH RESEND 6/8] rtc: rtc-spear: convert spear_rtc_driver " Jingoo Han
@ 2013-04-17 1:08 ` Jingoo Han
2013-04-17 1:09 ` [PATCH RESEND 8/8] rtc: rtc-twl: convert twl4030rtc_driver " Jingoo Han
6 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2013-04-17 1:08 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-stmp3xxx.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index 67d2612..30eacdb 100644
--- a/drivers/rtc/rtc-stmp3xxx.c
+++ b/drivers/rtc/rtc-stmp3xxx.c
@@ -307,15 +307,15 @@ out_free:
return err;
}
-#ifdef CONFIG_PM
-static int stmp3xxx_rtc_suspend(struct platform_device *dev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int stmp3xxx_rtc_suspend(struct device *dev)
{
return 0;
}
-static int stmp3xxx_rtc_resume(struct platform_device *dev)
+static int stmp3xxx_rtc_resume(struct device *dev)
{
- struct stmp3xxx_rtc_data *rtc_data = platform_get_drvdata(dev);
+ struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);
stmp_reset_block(rtc_data->io);
writel(STMP3XXX_RTC_PERSISTENT0_ALARM_EN |
@@ -324,11 +324,11 @@ static int stmp3xxx_rtc_resume(struct platform_device *dev)
rtc_data->io + STMP3XXX_RTC_PERSISTENT0_CLR);
return 0;
}
-#else
-#define stmp3xxx_rtc_suspend NULL
-#define stmp3xxx_rtc_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(stmp3xxx_rtc_pm_ops, stmp3xxx_rtc_suspend,
+ stmp3xxx_rtc_resume);
+
static const struct of_device_id rtc_dt_ids[] = {
{ .compatible = "fsl,stmp3xxx-rtc", },
{ /* sentinel */ }
@@ -338,11 +338,10 @@ MODULE_DEVICE_TABLE(of, rtc_dt_ids);
static struct platform_driver stmp3xxx_rtcdrv = {
.probe = stmp3xxx_rtc_probe,
.remove = stmp3xxx_rtc_remove,
- .suspend = stmp3xxx_rtc_suspend,
- .resume = stmp3xxx_rtc_resume,
.driver = {
.name = "stmp3xxx-rtc",
.owner = THIS_MODULE,
+ .pm = &stmp3xxx_rtc_pm_ops,
.of_match_table = of_match_ptr(rtc_dt_ids),
},
};
--
1.7.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH RESEND 8/8] rtc: rtc-twl: convert twl4030rtc_driver to dev_pm_ops
2013-04-17 1:06 [PATCH RESEND 1/8] rtc: rtc-at91sam9: convert at91_rtc_driver to dev_pm_ops Jingoo Han
` (5 preceding siblings ...)
2013-04-17 1:08 ` [PATCH RESEND 7/8] rtc: rtc-stmp3xxx: convert stmp3xxx_rtcdrv " Jingoo Han
@ 2013-04-17 1:09 ` Jingoo Han
6 siblings, 0 replies; 8+ messages in thread
From: Jingoo Han @ 2013-04-17 1:09 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-twl.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 8bc6c80..8751a52 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -566,11 +566,10 @@ static void twl_rtc_shutdown(struct platform_device *pdev)
mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
}
-#ifdef CONFIG_PM
-
+#ifdef CONFIG_PM_SLEEP
static unsigned char irqstat;
-static int twl_rtc_suspend(struct platform_device *pdev, pm_message_t state)
+static int twl_rtc_suspend(struct device *dev)
{
irqstat = rtc_irq_bits;
@@ -578,17 +577,15 @@ static int twl_rtc_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}
-static int twl_rtc_resume(struct platform_device *pdev)
+static int twl_rtc_resume(struct device *dev)
{
set_rtc_irq_bit(irqstat);
return 0;
}
-
-#else
-#define twl_rtc_suspend NULL
-#define twl_rtc_resume NULL
#endif
+static SIMPLE_DEV_PM_OPS(twl_rtc_pm_ops, twl_rtc_suspend, twl_rtc_resume);
+
#ifdef CONFIG_OF
static const struct of_device_id twl_rtc_of_match[] = {
{.compatible = "ti,twl4030-rtc", },
@@ -603,11 +600,10 @@ static struct platform_driver twl4030rtc_driver = {
.probe = twl_rtc_probe,
.remove = twl_rtc_remove,
.shutdown = twl_rtc_shutdown,
- .suspend = twl_rtc_suspend,
- .resume = twl_rtc_resume,
.driver = {
.owner = THIS_MODULE,
.name = "twl_rtc",
+ .pm = &twl_rtc_pm_ops,
.of_match_table = of_match_ptr(twl_rtc_of_match),
},
};
--
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).