diff options
Diffstat (limited to 'drivers/mfd/tps65090.c')
-rw-r--r-- | drivers/mfd/tps65090.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c index 47f802bf1848..396b9d1b6bd6 100644 --- a/drivers/mfd/tps65090.c +++ b/drivers/mfd/tps65090.c | |||
@@ -283,27 +283,24 @@ static int __devinit tps65090_i2c_probe(struct i2c_client *client, | |||
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | tps65090->rmap = regmap_init_i2c(tps65090->client, | 286 | tps65090->rmap = devm_regmap_init_i2c(tps65090->client, |
287 | &tps65090_regmap_config); | 287 | &tps65090_regmap_config); |
288 | if (IS_ERR(tps65090->rmap)) { | 288 | if (IS_ERR(tps65090->rmap)) { |
289 | dev_err(&client->dev, "regmap_init failed with err: %ld\n", | 289 | ret = PTR_ERR(tps65090->rmap); |
290 | PTR_ERR(tps65090->rmap)); | 290 | dev_err(&client->dev, "regmap_init failed with err: %d\n", ret); |
291 | goto err_irq_exit; | 291 | goto err_irq_exit; |
292 | }; | 292 | } |
293 | 293 | ||
294 | ret = mfd_add_devices(tps65090->dev, -1, tps65090s, | 294 | ret = mfd_add_devices(tps65090->dev, -1, tps65090s, |
295 | ARRAY_SIZE(tps65090s), NULL, 0); | 295 | ARRAY_SIZE(tps65090s), NULL, 0); |
296 | if (ret) { | 296 | if (ret) { |
297 | dev_err(&client->dev, "add mfd devices failed with err: %d\n", | 297 | dev_err(&client->dev, "add mfd devices failed with err: %d\n", |
298 | ret); | 298 | ret); |
299 | goto err_regmap_exit; | 299 | goto err_irq_exit; |
300 | } | 300 | } |
301 | 301 | ||
302 | return 0; | 302 | return 0; |
303 | 303 | ||
304 | err_regmap_exit: | ||
305 | regmap_exit(tps65090->rmap); | ||
306 | |||
307 | err_irq_exit: | 304 | err_irq_exit: |
308 | if (client->irq) | 305 | if (client->irq) |
309 | free_irq(client->irq, tps65090); | 306 | free_irq(client->irq, tps65090); |
@@ -316,29 +313,34 @@ static int __devexit tps65090_i2c_remove(struct i2c_client *client) | |||
316 | struct tps65090 *tps65090 = i2c_get_clientdata(client); | 313 | struct tps65090 *tps65090 = i2c_get_clientdata(client); |
317 | 314 | ||
318 | mfd_remove_devices(tps65090->dev); | 315 | mfd_remove_devices(tps65090->dev); |
319 | regmap_exit(tps65090->rmap); | ||
320 | if (client->irq) | 316 | if (client->irq) |
321 | free_irq(client->irq, tps65090); | 317 | free_irq(client->irq, tps65090); |
322 | 318 | ||
323 | return 0; | 319 | return 0; |
324 | } | 320 | } |
325 | 321 | ||
326 | #ifdef CONFIG_PM | 322 | #ifdef CONFIG_PM_SLEEP |
327 | static int tps65090_i2c_suspend(struct i2c_client *client, pm_message_t state) | 323 | static int tps65090_suspend(struct device *dev) |
328 | { | 324 | { |
325 | struct i2c_client *client = to_i2c_client(dev); | ||
329 | if (client->irq) | 326 | if (client->irq) |
330 | disable_irq(client->irq); | 327 | disable_irq(client->irq); |
331 | return 0; | 328 | return 0; |
332 | } | 329 | } |
333 | 330 | ||
334 | static int tps65090_i2c_resume(struct i2c_client *client) | 331 | static int tps65090_resume(struct device *dev) |
335 | { | 332 | { |
333 | struct i2c_client *client = to_i2c_client(dev); | ||
336 | if (client->irq) | 334 | if (client->irq) |
337 | enable_irq(client->irq); | 335 | enable_irq(client->irq); |
338 | return 0; | 336 | return 0; |
339 | } | 337 | } |
340 | #endif | 338 | #endif |
341 | 339 | ||
340 | static const struct dev_pm_ops tps65090_pm_ops = { | ||
341 | SET_SYSTEM_SLEEP_PM_OPS(tps65090_suspend, tps65090_resume) | ||
342 | }; | ||
343 | |||
342 | static const struct i2c_device_id tps65090_id_table[] = { | 344 | static const struct i2c_device_id tps65090_id_table[] = { |
343 | { "tps65090", 0 }, | 345 | { "tps65090", 0 }, |
344 | { }, | 346 | { }, |
@@ -349,13 +351,10 @@ static struct i2c_driver tps65090_driver = { | |||
349 | .driver = { | 351 | .driver = { |
350 | .name = "tps65090", | 352 | .name = "tps65090", |
351 | .owner = THIS_MODULE, | 353 | .owner = THIS_MODULE, |
354 | .pm = &tps65090_pm_ops, | ||
352 | }, | 355 | }, |
353 | .probe = tps65090_i2c_probe, | 356 | .probe = tps65090_i2c_probe, |
354 | .remove = __devexit_p(tps65090_i2c_remove), | 357 | .remove = __devexit_p(tps65090_i2c_remove), |
355 | #ifdef CONFIG_PM | ||
356 | .suspend = tps65090_i2c_suspend, | ||
357 | .resume = tps65090_i2c_resume, | ||
358 | #endif | ||
359 | .id_table = tps65090_id_table, | 358 | .id_table = tps65090_id_table, |
360 | }; | 359 | }; |
361 | 360 | ||