Merge remote-tracking branch 'regulator/topic/devm' into regulator-next
authorMark Brown <broonie@linaro.org>
Thu, 24 Oct 2013 10:11:35 +0000 (11:11 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 24 Oct 2013 10:11:35 +0000 (11:11 +0100)
14 files changed:
drivers/regulator/ab3100.c
drivers/regulator/ab8500-ext.c
drivers/regulator/da9063-regulator.c
drivers/regulator/da9210-regulator.c
drivers/regulator/lp872x.c
drivers/regulator/lp8788-buck.c
drivers/regulator/lp8788-ldo.c
drivers/regulator/max8925-regulator.c
drivers/regulator/pcap-regulator.c
drivers/regulator/pcf50633-regulator.c
drivers/regulator/tps6105x-regulator.c
drivers/regulator/tps6524x-regulator.c
drivers/regulator/twl-regulator.c
drivers/regulator/vexpress.c

index 7d5eaa874b2da9337e387b1271bd2e38a3d25d2e..77b46d0b37a604fa31f7b90fb270d8ac59023e0c 100644 (file)
@@ -535,7 +535,7 @@ static int ab3100_regulator_register(struct platform_device *pdev,
        config.dev = &pdev->dev;
        config.driver_data = reg;
 
-       rdev = regulator_register(desc, &config);
+       rdev = devm_regulator_register(&pdev->dev, desc, &config);
        if (IS_ERR(rdev)) {
                err = PTR_ERR(rdev);
                dev_err(&pdev->dev,
@@ -616,7 +616,6 @@ static int ab3100_regulators_remove(struct platform_device *pdev)
        for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
                struct ab3100_regulator *reg = &ab3100_regulators[i];
 
-               regulator_unregister(reg->rdev);
                reg->rdev = NULL;
        }
        return 0;
index 02ff691cdb8b291b44ecc1569339a9251aa59987..29c0faaf8eba4e94f34d8848d91b7d0d85dea2ec 100644 (file)
@@ -413,16 +413,12 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev)
                        &pdata->ext_regulator[i];
 
                /* register regulator with framework */
-               info->rdev = regulator_register(&info->desc, &config);
+               info->rdev = devm_regulator_register(&pdev->dev, &info->desc,
+                                                    &config);
                if (IS_ERR(info->rdev)) {
                        err = PTR_ERR(info->rdev);
                        dev_err(&pdev->dev, "failed to register regulator %s\n",
                                        info->desc.name);
-                       /* when we fail, un-register all earlier regulators */
-                       while (--i >= 0) {
-                               info = &ab8500_ext_regulator_info[i];
-                               regulator_unregister(info->rdev);
-                       }
                        return err;
                }
 
@@ -433,26 +429,8 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int ab8500_ext_regulator_remove(struct platform_device *pdev)
-{
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(ab8500_ext_regulator_info); i++) {
-               struct ab8500_ext_regulator_info *info = NULL;
-               info = &ab8500_ext_regulator_info[i];
-
-               dev_vdbg(rdev_get_dev(info->rdev),
-                       "%s-remove\n", info->desc.name);
-
-               regulator_unregister(info->rdev);
-       }
-
-       return 0;
-}
-
 static struct platform_driver ab8500_ext_regulator_driver = {
        .probe = ab8500_ext_regulator_probe,
-       .remove = ab8500_ext_regulator_remove,
        .driver         = {
                .name   = "ab8500-ext-regulator",
                .owner  = THIS_MODULE,
index 3d910f4f3a0e855f95dc336500edb74af1176d99..56727eb745df69171d77fac8313e6ea3ab2499ef 100644 (file)
@@ -847,13 +847,13 @@ static int da9063_regulator_probe(struct platform_device *pdev)
                if (da9063_reg_matches)
                        config.of_node = da9063_reg_matches[id].of_node;
                config.regmap = da9063->regmap;
-               regl->rdev = regulator_register(&regl->desc, &config);
+               regl->rdev = devm_regulator_register(&pdev->dev, &regl->desc,
+                                                    &config);
                if (IS_ERR(regl->rdev)) {
                        dev_err(&pdev->dev,
                                "Failed to register %s regulator\n",
                                regl->desc.name);
-                       ret = PTR_ERR(regl->rdev);
-                       goto err;
+                       return PTR_ERR(regl->rdev);
                }
                id++;
                n++;
@@ -862,9 +862,8 @@ static int da9063_regulator_probe(struct platform_device *pdev)
        /* LDOs overcurrent event support */
        irq = platform_get_irq_byname(pdev, "LDO_LIM");
        if (irq < 0) {
-               ret = irq;
                dev_err(&pdev->dev, "Failed to get IRQ.\n");
-               goto err;
+               return irq;
        }
 
        regulators->irq_ldo_lim = regmap_irq_get_virq(da9063->regmap_irq, irq);
@@ -881,27 +880,15 @@ static int da9063_regulator_probe(struct platform_device *pdev)
        }
 
        return 0;
-
-err:
-       /* Wind back regulators registeration */
-       while (--n >= 0)
-               regulator_unregister(regulators->regulator[n].rdev);
-
-       return ret;
 }
 
 static int da9063_regulator_remove(struct platform_device *pdev)
 {
        struct da9063_regulators *regulators = platform_get_drvdata(pdev);
-       struct da9063_regulator *regl;
 
        free_irq(regulators->irq_ldo_lim, regulators);
        free_irq(regulators->irq_uvov, regulators);
 
-       for (regl = &regulators->regulator[regulators->n_regulators - 1];
-            regl >= &regulators->regulator[0]; regl--)
-               regulator_unregister(regl->rdev);
-
        return 0;
 }
 
index f7ccff14f7639b2e1dc4580422bd24ba2feb789f..6f5ecbe1132e7da4f02496672578ef2301285767 100644 (file)
@@ -155,7 +155,7 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
        config.regmap = chip->regmap;
        config.of_node = dev->of_node;
 
-       rdev = regulator_register(&da9210_reg, &config);
+       rdev = devm_regulator_register(&i2c->dev, &da9210_reg, &config);
        if (IS_ERR(rdev)) {
                dev_err(&i2c->dev, "Failed to register DA9210 regulator\n");
                return PTR_ERR(rdev);
@@ -168,13 +168,6 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
        return 0;
 }
 
-static int da9210_i2c_remove(struct i2c_client *i2c)
-{
-       struct da9210 *chip = i2c_get_clientdata(i2c);
-       regulator_unregister(chip->rdev);
-       return 0;
-}
-
 static const struct i2c_device_id da9210_i2c_id[] = {
        {"da9210", 0},
        {},
@@ -188,7 +181,6 @@ static struct i2c_driver da9210_regulator_driver = {
                .owner = THIS_MODULE,
        },
        .probe = da9210_i2c_probe,
-       .remove = da9210_i2c_remove,
        .id_table = da9210_i2c_id,
 };
 
index 2b84b727a3c498c6e22f97fe9d297d06ee1470c8..2e4734ff79fce29eaa2cab621b2e13cfa565a0da 100644 (file)
@@ -785,7 +785,7 @@ static int lp872x_regulator_register(struct lp872x *lp)
        struct regulator_desc *desc;
        struct regulator_config cfg = { };
        struct regulator_dev *rdev;
-       int i, ret;
+       int i;
 
        for (i = 0; i < lp->num_regulators; i++) {
                desc = (lp->chipid == LP8720) ? &lp8720_regulator_desc[i] :
@@ -796,34 +796,16 @@ static int lp872x_regulator_register(struct lp872x *lp)
                cfg.driver_data = lp;
                cfg.regmap = lp->regmap;
 
-               rdev = regulator_register(desc, &cfg);
+               rdev = devm_regulator_register(lp->dev, desc, &cfg);
                if (IS_ERR(rdev)) {
                        dev_err(lp->dev, "regulator register err");
-                       ret =  PTR_ERR(rdev);
-                       goto err;
+                       return PTR_ERR(rdev);
                }
 
                *(lp->regulators + i) = rdev;
        }
 
        return 0;
-err:
-       while (--i >= 0) {
-               rdev = *(lp->regulators + i);
-               regulator_unregister(rdev);
-       }
-       return ret;
-}
-
-static void lp872x_regulator_unregister(struct lp872x *lp)
-{
-       struct regulator_dev *rdev;
-       int i;
-
-       for (i = 0; i < lp->num_regulators; i++) {
-               rdev = *(lp->regulators + i);
-               regulator_unregister(rdev);
-       }
 }
 
 static const struct regmap_config lp872x_regmap_config = {
@@ -979,14 +961,6 @@ err_dev:
        return ret;
 }
 
-static int lp872x_remove(struct i2c_client *cl)
-{
-       struct lp872x *lp = i2c_get_clientdata(cl);
-
-       lp872x_regulator_unregister(lp);
-       return 0;
-}
-
 static const struct of_device_id lp872x_dt_ids[] = {
        { .compatible = "ti,lp8720", },
        { .compatible = "ti,lp8725", },
@@ -1008,7 +982,6 @@ static struct i2c_driver lp872x_driver = {
                .of_match_table = of_match_ptr(lp872x_dt_ids),
        },
        .probe = lp872x_probe,
-       .remove = lp872x_remove,
        .id_table = lp872x_ids,
 };
 
index 0b015f2a7fd9e3dd33c0928421f55441b1459467..948afc249e296005207c621d3d3bfbfb39b914e2 100644 (file)
@@ -515,7 +515,7 @@ static int lp8788_buck_probe(struct platform_device *pdev)
        cfg.driver_data = buck;
        cfg.regmap = lp->regmap;
 
-       rdev = regulator_register(&lp8788_buck_desc[id], &cfg);
+       rdev = devm_regulator_register(&pdev->dev, &lp8788_buck_desc[id], &cfg);
        if (IS_ERR(rdev)) {
                ret = PTR_ERR(rdev);
                dev_err(&pdev->dev, "BUCK%d regulator register err = %d\n",
@@ -529,18 +529,8 @@ static int lp8788_buck_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int lp8788_buck_remove(struct platform_device *pdev)
-{
-       struct lp8788_buck *buck = platform_get_drvdata(pdev);
-
-       regulator_unregister(buck->regulator);
-
-       return 0;
-}
-
 static struct platform_driver lp8788_buck_driver = {
        .probe = lp8788_buck_probe,
-       .remove = lp8788_buck_remove,
        .driver = {
                .name = LP8788_DEV_BUCK,
                .owner = THIS_MODULE,
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,
index d80b5fa758ae5012585acb0a2e2b2947005177ce..759510789e71db39b0b287f9849cea88827d50c4 100644 (file)
@@ -312,7 +312,7 @@ static int max8925_regulator_probe(struct platform_device *pdev)
                if (pdata)
                        config.init_data = pdata;
 
-       rdev = regulator_register(&ri->desc, &config);
+       rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
        if (IS_ERR(rdev)) {
                dev_err(&pdev->dev, "failed to register regulator %s\n",
                                ri->desc.name);
@@ -323,22 +323,12 @@ static int max8925_regulator_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int max8925_regulator_remove(struct platform_device *pdev)
-{
-       struct regulator_dev *rdev = platform_get_drvdata(pdev);
-
-       regulator_unregister(rdev);
-
-       return 0;
-}
-
 static struct platform_driver max8925_regulator_driver = {
        .driver         = {
                .name   = "max8925-regulator",
                .owner  = THIS_MODULE,
        },
        .probe          = max8925_regulator_probe,
-       .remove         = max8925_regulator_remove,
 };
 
 static int __init max8925_regulator_init(void)
index b49eaeedea849f5c380059417050bd9d75f2901e..3727b7d0e9ac3c1f633f801f715fdb1520d01fe8 100644 (file)
@@ -246,7 +246,8 @@ static int pcap_regulator_probe(struct platform_device *pdev)
        config.init_data = dev_get_platdata(&pdev->dev);
        config.driver_data = pcap;
 
-       rdev = regulator_register(&pcap_regulators[pdev->id], &config);
+       rdev = devm_regulator_register(&pdev->dev, &pcap_regulators[pdev->id],
+                                      &config);
        if (IS_ERR(rdev))
                return PTR_ERR(rdev);
 
@@ -255,22 +256,12 @@ static int pcap_regulator_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int pcap_regulator_remove(struct platform_device *pdev)
-{
-       struct regulator_dev *rdev = platform_get_drvdata(pdev);
-
-       regulator_unregister(rdev);
-
-       return 0;
-}
-
 static struct platform_driver pcap_regulator_driver = {
        .driver = {
                .name   = "pcap-regulator",
                .owner  = THIS_MODULE,
        },
        .probe  = pcap_regulator_probe,
-       .remove = pcap_regulator_remove,
 };
 
 static int __init pcap_regulator_init(void)
index 0f3576d48abf9733cb87a27231f471ca263cade9..d7da1c15a6da447d699e080a4bfda259f734c5f0 100644 (file)
@@ -90,7 +90,8 @@ static int pcf50633_regulator_probe(struct platform_device *pdev)
        config.driver_data = pcf;
        config.regmap = pcf->regmap;
 
-       rdev = regulator_register(&regulators[pdev->id], &config);
+       rdev = devm_regulator_register(&pdev->dev, &regulators[pdev->id],
+                                      &config);
        if (IS_ERR(rdev))
                return PTR_ERR(rdev);
 
@@ -102,21 +103,11 @@ static int pcf50633_regulator_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int pcf50633_regulator_remove(struct platform_device *pdev)
-{
-       struct regulator_dev *rdev = platform_get_drvdata(pdev);
-
-       regulator_unregister(rdev);
-
-       return 0;
-}
-
 static struct platform_driver pcf50633_regulator_driver = {
        .driver = {
                .name = "pcf50633-regltr",
        },
        .probe = pcf50633_regulator_probe,
-       .remove = pcf50633_regulator_remove,
 };
 
 static int __init pcf50633_regulator_init(void)
index ec9453ffb77fd561ec1c2d6c3591b7302bc16b5f..e0e818d89f46673aa50f11377cec58b83cbb6e04 100644 (file)
@@ -146,8 +146,9 @@ static int tps6105x_regulator_probe(struct platform_device *pdev)
        config.driver_data = tps6105x;
 
        /* Register regulator with framework */
-       tps6105x->regulator = regulator_register(&tps6105x_regulator_desc,
-                                                &config);
+       tps6105x->regulator = devm_regulator_register(&pdev->dev,
+                                                     &tps6105x_regulator_desc,
+                                                     &config);
        if (IS_ERR(tps6105x->regulator)) {
                ret = PTR_ERR(tps6105x->regulator);
                dev_err(&tps6105x->client->dev,
@@ -159,20 +160,12 @@ static int tps6105x_regulator_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int tps6105x_regulator_remove(struct platform_device *pdev)
-{
-       struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev);
-       regulator_unregister(tps6105x->regulator);
-       return 0;
-}
-
 static struct platform_driver tps6105x_regulator_driver = {
        .driver = {
                .name  = "tps6105x-regulator",
                .owner = THIS_MODULE,
        },
        .probe = tps6105x_regulator_probe,
-       .remove = tps6105x_regulator_remove,
 };
 
 static __init int tps6105x_regulator_init(void)
index 62e8d28beabd7cc8ad51b2935e29b7d348e17438..9f6bfda711b73a6dae9cdc9b8be3b69b2f5e88cc 100644 (file)
@@ -577,21 +577,6 @@ static struct regulator_ops regulator_ops = {
        .get_current_limit      = get_current_limit,
 };
 
-static int pmic_remove(struct spi_device *spi)
-{
-       struct tps6524x *hw = spi_get_drvdata(spi);
-       int i;
-
-       if (!hw)
-               return 0;
-       for (i = 0; i < N_REGULATORS; i++) {
-               regulator_unregister(hw->rdev[i]);
-               hw->rdev[i] = NULL;
-       }
-       spi_set_drvdata(spi, NULL);
-       return 0;
-}
-
 static int pmic_probe(struct spi_device *spi)
 {
        struct tps6524x *hw;
@@ -599,7 +584,7 @@ static int pmic_probe(struct spi_device *spi)
        const struct supply_info *info = supply_info;
        struct regulator_init_data *init_data;
        struct regulator_config config = { };
-       int ret = 0, i;
+       int i;
 
        init_data = dev_get_platdata(dev);
        if (!init_data) {
@@ -632,24 +617,17 @@ static int pmic_probe(struct spi_device *spi)
                config.init_data = init_data;
                config.driver_data = hw;
 
-               hw->rdev[i] = regulator_register(&hw->desc[i], &config);
-               if (IS_ERR(hw->rdev[i])) {
-                       ret = PTR_ERR(hw->rdev[i]);
-                       hw->rdev[i] = NULL;
-                       goto fail;
-               }
+               hw->rdev[i] = devm_regulator_register(dev, &hw->desc[i],
+                                                     &config);
+               if (IS_ERR(hw->rdev[i]))
+                       return PTR_ERR(hw->rdev[i]);
        }
 
        return 0;
-
-fail:
-       pmic_remove(spi);
-       return ret;
 }
 
 static struct spi_driver pmic_driver = {
        .probe          = pmic_probe,
-       .remove         = pmic_remove,
        .driver         = {
                .name   = "tps6524x",
                .owner  = THIS_MODULE,
index 78aae4cbb00424864fbad430fc55379a060065c5..8ebd785485c73ddceba4047facf3960192a2cdf2 100644 (file)
@@ -1188,7 +1188,7 @@ static int twlreg_probe(struct platform_device *pdev)
        config.driver_data = info;
        config.of_node = pdev->dev.of_node;
 
-       rdev = regulator_register(&info->desc, &config);
+       rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
        if (IS_ERR(rdev)) {
                dev_err(&pdev->dev, "can't register %s, %ld\n",
                                info->desc.name, PTR_ERR(rdev));
@@ -1217,7 +1217,6 @@ static int twlreg_remove(struct platform_device *pdev)
        struct regulator_dev *rdev = platform_get_drvdata(pdev);
        struct twlreg_info *info = rdev->reg_data;
 
-       regulator_unregister(rdev);
        kfree(info);
        return 0;
 }
index 4668c7f8133d7ecff17261d0af3640bbe5ba5cf4..f3ae28a7e66371143b6be01c9640712533faf541 100644 (file)
@@ -96,7 +96,7 @@ static int vexpress_regulator_probe(struct platform_device *pdev)
        config.driver_data = reg;
        config.of_node = pdev->dev.of_node;
 
-       reg->regdev = regulator_register(&reg->desc, &config);
+       reg->regdev = devm_regulator_register(&pdev->dev, &reg->desc, &config);
        if (IS_ERR(reg->regdev)) {
                err = PTR_ERR(reg->regdev);
                goto error_regulator_register;
@@ -119,7 +119,6 @@ static int vexpress_regulator_remove(struct platform_device *pdev)
        struct vexpress_regulator *reg = platform_get_drvdata(pdev);
 
        vexpress_config_func_put(reg->func);
-       regulator_unregister(reg->regdev);
 
        return 0;
 }
This page took 0.03942 seconds and 5 git commands to generate.