aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2011-04-10 19:40:13 -0400
committerAnton Vorontsov <cbouatmailru@gmail.com>2011-05-20 11:25:11 -0400
commit906649de0eacde7a643b5a0750de6207441ad54f (patch)
tree197a5e5b24e68bb939d70c8583f10846a5c3ffb1 /drivers/power
parent9c6f8740d0c8d2b4de78511257f38384f4cbb292 (diff)
PXA: Use dev_pm_ops in z2_battery
Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/z2_battery.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/power/z2_battery.c b/drivers/power/z2_battery.c
index e5ced3a4c1ed..d119c38b3ff6 100644
--- a/drivers/power/z2_battery.c
+++ b/drivers/power/z2_battery.c
@@ -271,24 +271,33 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
271} 271}
272 272
273#ifdef CONFIG_PM 273#ifdef CONFIG_PM
274static int z2_batt_suspend(struct i2c_client *client, pm_message_t state) 274static int z2_batt_suspend(struct device *dev)
275{ 275{
276 struct i2c_client *client = to_i2c_client(dev);
276 struct z2_charger *charger = i2c_get_clientdata(client); 277 struct z2_charger *charger = i2c_get_clientdata(client);
277 278
278 flush_work_sync(&charger->bat_work); 279 flush_work_sync(&charger->bat_work);
279 return 0; 280 return 0;
280} 281}
281 282
282static int z2_batt_resume(struct i2c_client *client) 283static int z2_batt_resume(struct device *dev)
283{ 284{
285 struct i2c_client *client = to_i2c_client(dev);
284 struct z2_charger *charger = i2c_get_clientdata(client); 286 struct z2_charger *charger = i2c_get_clientdata(client);
285 287
286 schedule_work(&charger->bat_work); 288 schedule_work(&charger->bat_work);
287 return 0; 289 return 0;
288} 290}
291
292static const struct dev_pm_ops z2_battery_pm_ops = {
293 .suspend = z2_batt_suspend,
294 .resume = z2_batt_resume,
295};
296
297#define Z2_BATTERY_PM_OPS (&z2_battery_pm_ops)
298
289#else 299#else
290#define z2_batt_suspend NULL 300#define Z2_BATTERY_PM_OPS (NULL)
291#define z2_batt_resume NULL
292#endif 301#endif
293 302
294static const struct i2c_device_id z2_batt_id[] = { 303static const struct i2c_device_id z2_batt_id[] = {
@@ -301,11 +310,10 @@ static struct i2c_driver z2_batt_driver = {
301 .driver = { 310 .driver = {
302 .name = "z2-battery", 311 .name = "z2-battery",
303 .owner = THIS_MODULE, 312 .owner = THIS_MODULE,
313 .pm = Z2_BATTERY_PM_OPS
304 }, 314 },
305 .probe = z2_batt_probe, 315 .probe = z2_batt_probe,
306 .remove = z2_batt_remove, 316 .remove = z2_batt_remove,
307 .suspend = z2_batt_suspend,
308 .resume = z2_batt_resume,
309 .id_table = z2_batt_id, 317 .id_table = z2_batt_id,
310}; 318};
311 319