const: constify remaining dev_pm_ops
[safe/jmp/linux-2.6] / drivers / power / wm97xx_battery.c
index cad1ba2..fa39e75 100644 (file)
@@ -36,7 +36,7 @@ static unsigned long wm97xx_read_bat(struct power_supply *bat_ps)
        struct wm97xx_pdata *wmdata = bat_ps->dev->parent->platform_data;
        struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata;
 
-       return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
+       return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent),
                                        pdata->batt_aux) * pdata->batt_mult /
                                        pdata->batt_div;
 }
@@ -46,7 +46,7 @@ static unsigned long wm97xx_read_temp(struct power_supply *bat_ps)
        struct wm97xx_pdata *wmdata = bat_ps->dev->parent->platform_data;
        struct wm97xx_batt_pdata *pdata = wmdata->batt_pdata;
 
-       return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
+       return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent),
                                        pdata->temp_aux) * pdata->temp_mult /
                                        pdata->temp_div;
 }
@@ -145,20 +145,22 @@ static irqreturn_t wm97xx_chrg_irq(int irq, void *data)
 }
 
 #ifdef CONFIG_PM
-static int wm97xx_bat_suspend(struct platform_device *dev, pm_message_t state)
+static int wm97xx_bat_suspend(struct device *dev)
 {
        flush_scheduled_work();
        return 0;
 }
 
-static int wm97xx_bat_resume(struct platform_device *dev)
+static int wm97xx_bat_resume(struct device *dev)
 {
        schedule_work(&bat_work);
        return 0;
 }
-#else
-#define wm97xx_bat_suspend NULL
-#define wm97xx_bat_resume NULL
+
+static const struct dev_pm_ops wm97xx_bat_pm_ops = {
+       .suspend        = wm97xx_bat_suspend,
+       .resume         = wm97xx_bat_resume,
+};
 #endif
 
 static int __devinit wm97xx_bat_probe(struct platform_device *dev)
@@ -281,11 +283,12 @@ static struct platform_driver wm97xx_bat_driver = {
        .driver = {
                .name   = "wm97xx-battery",
                .owner  = THIS_MODULE,
+#ifdef CONFIG_PM
+               .pm     = &wm97xx_bat_pm_ops,
+#endif
        },
        .probe          = wm97xx_bat_probe,
        .remove         = __devexit_p(wm97xx_bat_remove),
-       .suspend        = wm97xx_bat_suspend,
-       .resume         = wm97xx_bat_resume,
 };
 
 static int __init wm97xx_bat_init(void)