diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-09-29 20:52:37 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-30 13:10:52 -0400 |
commit | a4a6b9de5c859ff953ce1b854cbfa112718a3f43 (patch) | |
tree | 75bd89fe61780aa6206168561642b41126882acb /drivers/regulator/ab8500-ext.c | |
parent | fda5842cc62c36c5ed02b763f6045e720582b083 (diff) |
regulator: ab8500-ext: use devm_regulator_register()
Use devm_regulator_register() to make cleanup paths simpler,
and remove unnecessary remove().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/ab8500-ext.c')
-rw-r--r-- | drivers/regulator/ab8500-ext.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c index 02ff691cdb8b..29c0faaf8eba 100644 --- a/drivers/regulator/ab8500-ext.c +++ b/drivers/regulator/ab8500-ext.c | |||
@@ -413,16 +413,12 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev) | |||
413 | &pdata->ext_regulator[i]; | 413 | &pdata->ext_regulator[i]; |
414 | 414 | ||
415 | /* register regulator with framework */ | 415 | /* register regulator with framework */ |
416 | info->rdev = regulator_register(&info->desc, &config); | 416 | info->rdev = devm_regulator_register(&pdev->dev, &info->desc, |
417 | &config); | ||
417 | if (IS_ERR(info->rdev)) { | 418 | if (IS_ERR(info->rdev)) { |
418 | err = PTR_ERR(info->rdev); | 419 | err = PTR_ERR(info->rdev); |
419 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 420 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
420 | info->desc.name); | 421 | info->desc.name); |
421 | /* when we fail, un-register all earlier regulators */ | ||
422 | while (--i >= 0) { | ||
423 | info = &ab8500_ext_regulator_info[i]; | ||
424 | regulator_unregister(info->rdev); | ||
425 | } | ||
426 | return err; | 422 | return err; |
427 | } | 423 | } |
428 | 424 | ||
@@ -433,26 +429,8 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev) | |||
433 | return 0; | 429 | return 0; |
434 | } | 430 | } |
435 | 431 | ||
436 | static int ab8500_ext_regulator_remove(struct platform_device *pdev) | ||
437 | { | ||
438 | int i; | ||
439 | |||
440 | for (i = 0; i < ARRAY_SIZE(ab8500_ext_regulator_info); i++) { | ||
441 | struct ab8500_ext_regulator_info *info = NULL; | ||
442 | info = &ab8500_ext_regulator_info[i]; | ||
443 | |||
444 | dev_vdbg(rdev_get_dev(info->rdev), | ||
445 | "%s-remove\n", info->desc.name); | ||
446 | |||
447 | regulator_unregister(info->rdev); | ||
448 | } | ||
449 | |||
450 | return 0; | ||
451 | } | ||
452 | |||
453 | static struct platform_driver ab8500_ext_regulator_driver = { | 432 | static struct platform_driver ab8500_ext_regulator_driver = { |
454 | .probe = ab8500_ext_regulator_probe, | 433 | .probe = ab8500_ext_regulator_probe, |
455 | .remove = ab8500_ext_regulator_remove, | ||
456 | .driver = { | 434 | .driver = { |
457 | .name = "ab8500-ext-regulator", | 435 | .name = "ab8500-ext-regulator", |
458 | .owner = THIS_MODULE, | 436 | .owner = THIS_MODULE, |