diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-12-06 02:07:09 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-12-09 12:38:40 -0500 |
commit | baafdc1d20a97c5c243f78981c95eadbd3b40caf (patch) | |
tree | a1ed7d3c09ae827befb7c889066388fde04ffaff /drivers/regulator/ab8500.c | |
parent | 34c040ce1a9d9c13121c95101164383ce516ddd6 (diff) |
regulator: ab8500: use devm_regulator_register()
Use devm_regulator_register() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/ab8500.c')
-rw-r--r-- | drivers/regulator/ab8500.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 0f86695b737a..c625468c7f2c 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
@@ -3005,7 +3005,6 @@ static int ab8500_regulator_register(struct platform_device *pdev, | |||
3005 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); | 3005 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
3006 | struct ab8500_regulator_info *info = NULL; | 3006 | struct ab8500_regulator_info *info = NULL; |
3007 | struct regulator_config config = { }; | 3007 | struct regulator_config config = { }; |
3008 | int err; | ||
3009 | 3008 | ||
3010 | /* assign per-regulator data */ | 3009 | /* assign per-regulator data */ |
3011 | info = &abx500_regulator.info[id]; | 3010 | info = &abx500_regulator.info[id]; |
@@ -3027,17 +3026,12 @@ static int ab8500_regulator_register(struct platform_device *pdev, | |||
3027 | } | 3026 | } |
3028 | 3027 | ||
3029 | /* register regulator with framework */ | 3028 | /* register regulator with framework */ |
3030 | info->regulator = regulator_register(&info->desc, &config); | 3029 | info->regulator = devm_regulator_register(&pdev->dev, &info->desc, |
3030 | &config); | ||
3031 | if (IS_ERR(info->regulator)) { | 3031 | if (IS_ERR(info->regulator)) { |
3032 | err = PTR_ERR(info->regulator); | ||
3033 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 3032 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
3034 | info->desc.name); | 3033 | info->desc.name); |
3035 | /* when we fail, un-register all earlier regulators */ | 3034 | return PTR_ERR(info->regulator); |
3036 | while (--id >= 0) { | ||
3037 | info = &abx500_regulator.info[id]; | ||
3038 | regulator_unregister(info->regulator); | ||
3039 | } | ||
3040 | return err; | ||
3041 | } | 3035 | } |
3042 | 3036 | ||
3043 | return 0; | 3037 | return 0; |
@@ -3086,17 +3080,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev) | |||
3086 | 3080 | ||
3087 | static int ab8500_regulator_remove(struct platform_device *pdev) | 3081 | static int ab8500_regulator_remove(struct platform_device *pdev) |
3088 | { | 3082 | { |
3089 | int i, err; | 3083 | int err; |
3090 | |||
3091 | for (i = 0; i < abx500_regulator.info_size; i++) { | ||
3092 | struct ab8500_regulator_info *info = NULL; | ||
3093 | info = &abx500_regulator.info[i]; | ||
3094 | |||
3095 | dev_vdbg(rdev_get_dev(info->regulator), | ||
3096 | "%s-remove\n", info->desc.name); | ||
3097 | |||
3098 | regulator_unregister(info->regulator); | ||
3099 | } | ||
3100 | 3084 | ||
3101 | /* remove regulator debug */ | 3085 | /* remove regulator debug */ |
3102 | err = ab8500_regulator_debug_exit(pdev); | 3086 | err = ab8500_regulator_debug_exit(pdev); |