[PATCH 2/5] pda-power: switch to new dev_pm_ops

Daniel Mack
2009-08-05T18:29:53Z

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Ian Molton <spyro@f2s.com>
Cc: Anton Vorontsov <cbou@mail.ru>
Cc: Matt Reimer <mreimer@vpop.net>
---
drivers/power/pda_power.c | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index a232de6..34af275 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -402,9 +402,9 @@ static int pda_power_remove(struct platform_device *pdev)
static int ac_wakeup_enabled;
static int usb_wakeup_enabled;

-static int pda_power_suspend(struct platform_device *pdev, pm_message_t state)
+static int pda_power_suspend(struct device *dev)
{
- if (device_may_wakeup(&pdev->dev)) {
+ if (device_may_wakeup(dev)) {
if (ac_irq)
ac_wakeup_enabled = !enable_irq_wake(ac_irq->start);
if (usb_irq)
@@ -414,9 +414,9 @@ static int pda_power_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}

-static int pda_power_resume(struct platform_device *pdev)
+static int pda_power_resume(struct device *dev)
{
- if (device_may_wakeup(&pdev->dev)) {
+ if (device_may_wakeup(dev)) {
if (usb_irq && usb_wakeup_enabled)
disable_irq_wake(usb_irq->start);
if (ac_irq && ac_wakeup_enabled)
@@ -425,21 +425,30 @@ static int pda_power_resume(struct platform_device *pdev)

return 0;
}
+
+static struct dev_pm_ops pda_power_pm_ops = {
+ .suspend = pda_power_suspend,
+ .freeze = pda_power_freeze,
+ .resume = pda_power_resume,
+ .thaw = pda_power_resume,
+};
+
+#define PDA_POWER_PM_OPS (&pda_power_pm_ops)
+
#else
-#define pda_power_suspend NULL
-#define pda_power_resume NULL
+#define PDA_POWER_PM_OPS NULL
#endif /* CONFIG_PM */

MODULE_ALIAS("platform:pda-power");

static struct platform_driver pda_power_pdrv = {
.driver = {
- .name = "pda-power",
+ .name = "pda-power",
+ .owner = THIS_MODULE,
+ .pm = PDA_POWER_PM_OPS,
},
.probe = pda_power_probe,
.remove = pda_power_remove,
- .suspend = pda_power_suspend,
- .resume = pda_power_resume,
};

static int __init pda_power_init(void)
--
1.6.3.3