]> git.karo-electronics.de Git - linux-beck.git/commitdiff
regulator: tps6507x: Use devm_regulator_register
authorSachin Kamat <sachin.kamat@linaro.org>
Wed, 4 Sep 2013 11:47:47 +0000 (17:17 +0530)
committerMark Brown <broonie@linaro.org>
Mon, 16 Sep 2013 23:28:43 +0000 (00:28 +0100)
devm_* simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/tps6507x-regulator.c

index 4117ff52dba185909cc3db4e3df9329d4ecadaa8..162a0fae20b317bd0b4899e07520a45f496e43c6 100644 (file)
@@ -508,13 +508,13 @@ static int tps6507x_pmic_probe(struct platform_device *pdev)
                        config.of_node = tps6507x_reg_matches[i].of_node;
                }
 
-               rdev = regulator_register(&tps->desc[i], &config);
+               rdev = devm_regulator_register(&pdev->dev, &tps->desc[i],
+                                              &config);
                if (IS_ERR(rdev)) {
                        dev_err(tps6507x_dev->dev,
                                "failed to register %s regulator\n",
                                pdev->name);
-                       error = PTR_ERR(rdev);
-                       goto fail;
+                       return PTR_ERR(rdev);
                }
 
                /* Save regulator for cleanup */
@@ -525,22 +525,6 @@ static int tps6507x_pmic_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, tps6507x_dev);
 
        return 0;
-
-fail:
-       while (--i >= 0)
-               regulator_unregister(tps->rdev[i]);
-       return error;
-}
-
-static int tps6507x_pmic_remove(struct platform_device *pdev)
-{
-       struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev);
-       struct tps6507x_pmic *tps = tps6507x_dev->pmic;
-       int i;
-
-       for (i = 0; i < TPS6507X_NUM_REGULATOR; i++)
-               regulator_unregister(tps->rdev[i]);
-       return 0;
 }
 
 static struct platform_driver tps6507x_pmic_driver = {
@@ -549,7 +533,6 @@ static struct platform_driver tps6507x_pmic_driver = {
                .owner = THIS_MODULE,
        },
        .probe = tps6507x_pmic_probe,
-       .remove = tps6507x_pmic_remove,
 };
 
 static int __init tps6507x_pmic_init(void)