diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-04 12:01:00 +0530 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-17 00:28:42 +0100 |
commit | 8c0b4ab5024c7b7d3498957cdbe4fea151142f7a (patch) | |
tree | 28a958ec1aa3f7463847192fe54037c09cc0e772 /drivers/regulator/mc13892-regulator.c | |
parent | 8e568635afcce245d771c2fc527f3902b6d2e723 (diff) | |
download | op-kernel-dev-8c0b4ab5024c7b7d3498957cdbe4fea151142f7a.zip op-kernel-dev-8c0b4ab5024c7b7d3498957cdbe4fea151142f7a.tar.gz |
regulator: mc13892: Use devm_regulator_register
devm_* simplifies the code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/mc13892-regulator.c')
-rw-r--r-- | drivers/regulator/mc13892-regulator.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index 1037e07..96c9f80 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c @@ -611,43 +611,27 @@ static int mc13892_regulator_probe(struct platform_device *pdev) config.driver_data = priv; config.of_node = node; - priv->regulators[i] = regulator_register(desc, &config); + priv->regulators[i] = devm_regulator_register(&pdev->dev, desc, + &config); if (IS_ERR(priv->regulators[i])) { dev_err(&pdev->dev, "failed to register regulator %s\n", mc13892_regulators[i].desc.name); - ret = PTR_ERR(priv->regulators[i]); - goto err; + return PTR_ERR(priv->regulators[i]); } } return 0; -err: - while (--i >= 0) - regulator_unregister(priv->regulators[i]); - return ret; err_unlock: mc13xxx_unlock(mc13892); return ret; } -static int mc13892_regulator_remove(struct platform_device *pdev) -{ - struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); - int i; - - for (i = 0; i < priv->num_regulators; i++) - regulator_unregister(priv->regulators[i]); - - return 0; -} - static struct platform_driver mc13892_regulator_driver = { .driver = { .name = "mc13892-regulator", .owner = THIS_MODULE, }, - .remove = mc13892_regulator_remove, .probe = mc13892_regulator_probe, }; |