diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-03-10 09:34:06 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-01 02:01:15 -0400 |
commit | 43cf454aba2516799d571472fa69425e1e15c4bc (patch) | |
tree | fed4dd19cf39b7c79d33fac7313217087d2250d8 /drivers/power/max17040_battery.c | |
parent | cc6616f6902fe96287585664cbad082d0c431206 (diff) |
max17040_battery: Use dev_pm_ops
Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks.
Cc: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power/max17040_battery.c')
-rw-r--r-- | drivers/power/max17040_battery.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c index 74a0bd9bc162..c7ff6d67f158 100644 --- a/drivers/power/max17040_battery.c +++ b/drivers/power/max17040_battery.c | |||
@@ -246,31 +246,34 @@ static int max17040_remove(struct i2c_client *client) | |||
246 | return 0; | 246 | return 0; |
247 | } | 247 | } |
248 | 248 | ||
249 | #ifdef CONFIG_PM | 249 | #ifdef CONFIG_PM_SLEEP |
250 | 250 | ||
251 | static int max17040_suspend(struct i2c_client *client, | 251 | static int max17040_suspend(struct device *dev) |
252 | pm_message_t state) | ||
253 | { | 252 | { |
253 | struct i2c_client *client = to_i2c_client(dev); | ||
254 | struct max17040_chip *chip = i2c_get_clientdata(client); | 254 | struct max17040_chip *chip = i2c_get_clientdata(client); |
255 | 255 | ||
256 | cancel_delayed_work(&chip->work); | 256 | cancel_delayed_work(&chip->work); |
257 | return 0; | 257 | return 0; |
258 | } | 258 | } |
259 | 259 | ||
260 | static int max17040_resume(struct i2c_client *client) | 260 | static int max17040_resume(struct device *dev) |
261 | { | 261 | { |
262 | struct i2c_client *client = to_i2c_client(dev); | ||
262 | struct max17040_chip *chip = i2c_get_clientdata(client); | 263 | struct max17040_chip *chip = i2c_get_clientdata(client); |
263 | 264 | ||
264 | schedule_delayed_work(&chip->work, MAX17040_DELAY); | 265 | schedule_delayed_work(&chip->work, MAX17040_DELAY); |
265 | return 0; | 266 | return 0; |
266 | } | 267 | } |
267 | 268 | ||
269 | static SIMPLE_DEV_PM_OPS(max17040_pm_ops, max17040_suspend, max17040_resume); | ||
270 | #define MAX17040_PM_OPS (&max17040_pm_ops) | ||
271 | |||
268 | #else | 272 | #else |
269 | 273 | ||
270 | #define max17040_suspend NULL | 274 | #define MAX17040_PM_OPS NULL |
271 | #define max17040_resume NULL | ||
272 | 275 | ||
273 | #endif /* CONFIG_PM */ | 276 | #endif /* CONFIG_PM_SLEEP */ |
274 | 277 | ||
275 | static const struct i2c_device_id max17040_id[] = { | 278 | static const struct i2c_device_id max17040_id[] = { |
276 | { "max17040", 0 }, | 279 | { "max17040", 0 }, |
@@ -281,11 +284,10 @@ MODULE_DEVICE_TABLE(i2c, max17040_id); | |||
281 | static struct i2c_driver max17040_i2c_driver = { | 284 | static struct i2c_driver max17040_i2c_driver = { |
282 | .driver = { | 285 | .driver = { |
283 | .name = "max17040", | 286 | .name = "max17040", |
287 | .pm = MAX17040_PM_OPS, | ||
284 | }, | 288 | }, |
285 | .probe = max17040_probe, | 289 | .probe = max17040_probe, |
286 | .remove = max17040_remove, | 290 | .remove = max17040_remove, |
287 | .suspend = max17040_suspend, | ||
288 | .resume = max17040_resume, | ||
289 | .id_table = max17040_id, | 291 | .id_table = max17040_id, |
290 | }; | 292 | }; |
291 | module_i2c_driver(max17040_i2c_driver); | 293 | module_i2c_driver(max17040_i2c_driver); |