regulator: lp8788-ldo: use devm_regulator_register()
authorJingoo Han <jg1.han@samsung.com>
Mon, 30 Sep 2013 00:55:51 +0000 (09:55 +0900)
committerMark Brown <broonie@linaro.org>
Mon, 30 Sep 2013 17:10:59 +0000 (18:10 +0100)
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>
drivers/regulator/lp8788-ldo.c

index 0527d87c6dd5adea8c7614ecc61f44fc8599f5f6..b9a29a29933fb8658e3a53202ceafcd41ae27c73 100644 (file)
@@ -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,