diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-04 01:37:54 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-16 19:28:40 -0400 |
commit | 44815b4a619065f510cffa2976722e78381d4fd2 (patch) | |
tree | 41f9d28dd5329ebc5959705b012f6c67e10af065 /drivers/regulator/max77686.c | |
parent | d55cd794d6ae9d0730c0b039c0a2d5d0e5ff12c4 (diff) |
regulator: max77686: Use devm_regulator_register
devm_* simplifies the code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/max77686.c')
-rw-r--r-- | drivers/regulator/max77686.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index f563057e5690..de5b30ea823c 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c | |||
@@ -478,32 +478,17 @@ static int max77686_pmic_probe(struct platform_device *pdev) | |||
478 | config.of_node = pdata->regulators[i].of_node; | 478 | config.of_node = pdata->regulators[i].of_node; |
479 | 479 | ||
480 | max77686->opmode[i] = regulators[i].enable_mask; | 480 | max77686->opmode[i] = regulators[i].enable_mask; |
481 | max77686->rdev[i] = regulator_register(®ulators[i], &config); | 481 | max77686->rdev[i] = devm_regulator_register(&pdev->dev, |
482 | ®ulators[i], &config); | ||
482 | if (IS_ERR(max77686->rdev[i])) { | 483 | if (IS_ERR(max77686->rdev[i])) { |
483 | ret = PTR_ERR(max77686->rdev[i]); | ||
484 | dev_err(&pdev->dev, | 484 | dev_err(&pdev->dev, |
485 | "regulator init failed for %d\n", i); | 485 | "regulator init failed for %d\n", i); |
486 | max77686->rdev[i] = NULL; | 486 | max77686->rdev[i] = NULL; |
487 | goto err; | 487 | return PTR_ERR(max77686->rdev[i]); |
488 | } | 488 | } |
489 | } | 489 | } |
490 | 490 | ||
491 | return 0; | 491 | return 0; |
492 | err: | ||
493 | while (--i >= 0) | ||
494 | regulator_unregister(max77686->rdev[i]); | ||
495 | return ret; | ||
496 | } | ||
497 | |||
498 | static int max77686_pmic_remove(struct platform_device *pdev) | ||
499 | { | ||
500 | struct max77686_data *max77686 = platform_get_drvdata(pdev); | ||
501 | int i; | ||
502 | |||
503 | for (i = 0; i < MAX77686_REGULATORS; i++) | ||
504 | regulator_unregister(max77686->rdev[i]); | ||
505 | |||
506 | return 0; | ||
507 | } | 492 | } |
508 | 493 | ||
509 | static const struct platform_device_id max77686_pmic_id[] = { | 494 | static const struct platform_device_id max77686_pmic_id[] = { |
@@ -518,7 +503,6 @@ static struct platform_driver max77686_pmic_driver = { | |||
518 | .owner = THIS_MODULE, | 503 | .owner = THIS_MODULE, |
519 | }, | 504 | }, |
520 | .probe = max77686_pmic_probe, | 505 | .probe = max77686_pmic_probe, |
521 | .remove = max77686_pmic_remove, | ||
522 | .id_table = max77686_pmic_id, | 506 | .id_table = max77686_pmic_id, |
523 | }; | 507 | }; |
524 | 508 | ||