提交 95095e42 编写于 作者: S Sachin Kamat 提交者: Mark Brown

regulator: tps65910: Use devm_regulator_register

devm_* simplifies the code.
Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: NMark Brown <broonie@linaro.org>
上级 884ea557
...@@ -1177,35 +1177,19 @@ static int tps65910_probe(struct platform_device *pdev) ...@@ -1177,35 +1177,19 @@ static int tps65910_probe(struct platform_device *pdev)
if (tps65910_reg_matches) if (tps65910_reg_matches)
config.of_node = tps65910_reg_matches[i].of_node; config.of_node = tps65910_reg_matches[i].of_node;
rdev = regulator_register(&pmic->desc[i], &config); rdev = devm_regulator_register(&pdev->dev, &pmic->desc[i],
&config);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
dev_err(tps65910->dev, dev_err(tps65910->dev,
"failed to register %s regulator\n", "failed to register %s regulator\n",
pdev->name); pdev->name);
err = PTR_ERR(rdev); return PTR_ERR(rdev);
goto err_unregister_regulator;
} }
/* Save regulator for cleanup */ /* Save regulator for cleanup */
pmic->rdev[i] = rdev; pmic->rdev[i] = rdev;
} }
return 0; return 0;
err_unregister_regulator:
while (--i >= 0)
regulator_unregister(pmic->rdev[i]);
return err;
}
static int tps65910_remove(struct platform_device *pdev)
{
struct tps65910_reg *pmic = platform_get_drvdata(pdev);
int i;
for (i = 0; i < pmic->num_regulators; i++)
regulator_unregister(pmic->rdev[i]);
return 0;
} }
static void tps65910_shutdown(struct platform_device *pdev) static void tps65910_shutdown(struct platform_device *pdev)
...@@ -1244,7 +1228,6 @@ static struct platform_driver tps65910_driver = { ...@@ -1244,7 +1228,6 @@ static struct platform_driver tps65910_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = tps65910_probe, .probe = tps65910_probe,
.remove = tps65910_remove,
.shutdown = tps65910_shutdown, .shutdown = tps65910_shutdown,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册