mirror of https://gitee.com/openkylin/linux.git
regulator: lp8788-ldo: 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>
This commit is contained in:
parent
3343fa1748
commit
0b7bb09054
|
@ -543,7 +543,7 @@ static int lp8788_dldo_probe(struct platform_device *pdev)
|
|||
cfg.driver_data = ldo;
|
||||
cfg.regmap = lp->regmap;
|
||||
|
||||
rdev = regulator_register(&lp8788_dldo_desc[id], &cfg);
|
||||
rdev = devm_regulator_register(&pdev->dev, &lp8788_dldo_desc[id], &cfg);
|
||||
if (IS_ERR(rdev)) {
|
||||
ret = PTR_ERR(rdev);
|
||||
dev_err(&pdev->dev, "DLDO%d regulator register err = %d\n",
|
||||
|
@ -557,18 +557,8 @@ static int lp8788_dldo_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lp8788_dldo_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct lp8788_ldo *ldo = platform_get_drvdata(pdev);
|
||||
|
||||
regulator_unregister(ldo->regulator);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver lp8788_dldo_driver = {
|
||||
.probe = lp8788_dldo_probe,
|
||||
.remove = lp8788_dldo_remove,
|
||||
.driver = {
|
||||
.name = LP8788_DEV_DLDO,
|
||||
.owner = THIS_MODULE,
|
||||
|
@ -603,7 +593,7 @@ static int lp8788_aldo_probe(struct platform_device *pdev)
|
|||
cfg.driver_data = ldo;
|
||||
cfg.regmap = lp->regmap;
|
||||
|
||||
rdev = regulator_register(&lp8788_aldo_desc[id], &cfg);
|
||||
rdev = devm_regulator_register(&pdev->dev, &lp8788_aldo_desc[id], &cfg);
|
||||
if (IS_ERR(rdev)) {
|
||||
ret = PTR_ERR(rdev);
|
||||
dev_err(&pdev->dev, "ALDO%d regulator register err = %d\n",
|
||||
|
@ -617,18 +607,8 @@ static int lp8788_aldo_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lp8788_aldo_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct lp8788_ldo *ldo = platform_get_drvdata(pdev);
|
||||
|
||||
regulator_unregister(ldo->regulator);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver lp8788_aldo_driver = {
|
||||
.probe = lp8788_aldo_probe,
|
||||
.remove = lp8788_aldo_remove,
|
||||
.driver = {
|
||||
.name = LP8788_DEV_ALDO,
|
||||
.owner = THIS_MODULE,
|
||||
|
|
Loading…
Reference in New Issue