Commit baafdc1d authored by Jingoo Han's avatar Jingoo Han Committed by Mark Brown

regulator: ab8500: use devm_regulator_register()

Use devm_regulator_register() to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Acked-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 34c040ce
...@@ -3005,7 +3005,6 @@ static int ab8500_regulator_register(struct platform_device *pdev, ...@@ -3005,7 +3005,6 @@ static int ab8500_regulator_register(struct platform_device *pdev,
struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
struct ab8500_regulator_info *info = NULL; struct ab8500_regulator_info *info = NULL;
struct regulator_config config = { }; struct regulator_config config = { };
int err;
/* assign per-regulator data */ /* assign per-regulator data */
info = &abx500_regulator.info[id]; info = &abx500_regulator.info[id];
...@@ -3027,17 +3026,12 @@ static int ab8500_regulator_register(struct platform_device *pdev, ...@@ -3027,17 +3026,12 @@ static int ab8500_regulator_register(struct platform_device *pdev,
} }
/* register regulator with framework */ /* register regulator with framework */
info->regulator = regulator_register(&info->desc, &config); info->regulator = devm_regulator_register(&pdev->dev, &info->desc,
&config);
if (IS_ERR(info->regulator)) { if (IS_ERR(info->regulator)) {
err = PTR_ERR(info->regulator);
dev_err(&pdev->dev, "failed to register regulator %s\n", dev_err(&pdev->dev, "failed to register regulator %s\n",
info->desc.name); info->desc.name);
/* when we fail, un-register all earlier regulators */ return PTR_ERR(info->regulator);
while (--id >= 0) {
info = &abx500_regulator.info[id];
regulator_unregister(info->regulator);
}
return err;
} }
return 0; return 0;
...@@ -3086,17 +3080,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev) ...@@ -3086,17 +3080,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
static int ab8500_regulator_remove(struct platform_device *pdev) static int ab8500_regulator_remove(struct platform_device *pdev)
{ {
int i, err; int err;
for (i = 0; i < abx500_regulator.info_size; i++) {
struct ab8500_regulator_info *info = NULL;
info = &abx500_regulator.info[i];
dev_vdbg(rdev_get_dev(info->regulator),
"%s-remove\n", info->desc.name);
regulator_unregister(info->regulator);
}
/* remove regulator debug */ /* remove regulator debug */
err = ab8500_regulator_debug_exit(pdev); err = ab8500_regulator_debug_exit(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment