Commit 906649de0eacde7a643b5a0750de6207441ad54f
Committed by
Anton Vorontsov
1 parent
9c6f8740d0
Exists in
master
and in
39 other branches
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>
Showing 1 changed file with 14 additions and 6 deletions Side-by-side Diff
drivers/power/z2_battery.c
... | ... | @@ -271,24 +271,33 @@ |
271 | 271 | } |
272 | 272 | |
273 | 273 | #ifdef CONFIG_PM |
274 | -static int z2_batt_suspend(struct i2c_client *client, pm_message_t state) | |
274 | +static int z2_batt_suspend(struct device *dev) | |
275 | 275 | { |
276 | + struct i2c_client *client = to_i2c_client(dev); | |
276 | 277 | struct z2_charger *charger = i2c_get_clientdata(client); |
277 | 278 | |
278 | 279 | flush_work_sync(&charger->bat_work); |
279 | 280 | return 0; |
280 | 281 | } |
281 | 282 | |
282 | -static int z2_batt_resume(struct i2c_client *client) | |
283 | +static int z2_batt_resume(struct device *dev) | |
283 | 284 | { |
285 | + struct i2c_client *client = to_i2c_client(dev); | |
284 | 286 | struct z2_charger *charger = i2c_get_clientdata(client); |
285 | 287 | |
286 | 288 | schedule_work(&charger->bat_work); |
287 | 289 | return 0; |
288 | 290 | } |
291 | + | |
292 | +static 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 | 299 | #else |
290 | -#define z2_batt_suspend NULL | |
291 | -#define z2_batt_resume NULL | |
300 | +#define Z2_BATTERY_PM_OPS (NULL) | |
292 | 301 | #endif |
293 | 302 | |
294 | 303 | static const struct i2c_device_id z2_batt_id[] = { |
295 | 304 | |
... | ... | @@ -301,11 +310,10 @@ |
301 | 310 | .driver = { |
302 | 311 | .name = "z2-battery", |
303 | 312 | .owner = THIS_MODULE, |
313 | + .pm = Z2_BATTERY_PM_OPS | |
304 | 314 | }, |
305 | 315 | .probe = z2_batt_probe, |
306 | 316 | .remove = z2_batt_remove, |
307 | - .suspend = z2_batt_suspend, | |
308 | - .resume = z2_batt_resume, | |
309 | 317 | .id_table = z2_batt_id, |
310 | 318 | }; |
311 | 319 |