pda_power: Add function callbacks for suspend and resume
authorDaniel Mack <daniel@caiaq.de>
Mon, 12 Apr 2010 21:33:22 +0000 (23:33 +0200)
committerAnton Vorontsov <cbouatmailru@gmail.com>
Fri, 16 Apr 2010 15:14:34 +0000 (19:14 +0400)
Add function prototypes for power management events so they can be
handled and used by platform implementations.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
drivers/power/pda_power.c
include/linux/pda_power.h

index a232de6..69f8aa3 100644 (file)
@@ -404,6 +404,13 @@ static int usb_wakeup_enabled;
 
 static int pda_power_suspend(struct platform_device *pdev, pm_message_t state)
 {
+       if (pdata->suspend) {
+               int ret = pdata->suspend(state);
+
+               if (ret)
+                       return ret;
+       }
+
        if (device_may_wakeup(&pdev->dev)) {
                if (ac_irq)
                        ac_wakeup_enabled = !enable_irq_wake(ac_irq->start);
@@ -423,6 +430,9 @@ static int pda_power_resume(struct platform_device *pdev)
                        disable_irq_wake(ac_irq->start);
        }
 
+       if (pdata->resume)
+               return pdata->resume();
+
        return 0;
 }
 #else
index d4cf7a2..c9e4d81 100644 (file)
@@ -24,6 +24,8 @@ struct pda_power_pdata {
        int (*is_usb_online)(void);
        void (*set_charge)(int flags);
        void (*exit)(struct device *dev);
+       int (*suspend)(pm_message_t state);
+       int (*resume)(void);
 
        char **supplied_to;
        size_t num_supplicants;