diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-04 12:01:02 +0530 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-17 00:28:42 +0100 |
commit | 1377530910da1502b07d09df1a368ce9a246c114 (patch) | |
tree | 329d81ac2ecfa6eca0efc915dce532baab50f8a5 | |
parent | 51c86b3eb80ebe0a35aba5ba3e96b22d61043ad1 (diff) | |
download | linux-1377530910da1502b07d09df1a368ce9a246c114.tar.gz linux-1377530910da1502b07d09df1a368ce9a246c114.tar.bz2 linux-1377530910da1502b07d09df1a368ce9a246c114.zip |
regulator: rc5t583: 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>
-rw-r--r-- | drivers/regulator/rc5t583-regulator.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c index 5885b4504596..b58affb33143 100644 --- a/drivers/regulator/rc5t583-regulator.c +++ b/drivers/regulator/rc5t583-regulator.c @@ -173,33 +173,16 @@ skip_ext_pwr_config: config.driver_data = reg; config.regmap = rc5t583->regmap; - 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); - ret = PTR_ERR(rdev); - goto clean_exit; + return PTR_ERR(rdev); } reg->rdev = rdev; } platform_set_drvdata(pdev, regs); return 0; - -clean_exit: - while (--id >= 0) - regulator_unregister(regs[id].rdev); - - return ret; -} - -static int rc5t583_regulator_remove(struct platform_device *pdev) -{ - struct rc5t583_regulator *regs = platform_get_drvdata(pdev); - int id; - - for (id = 0; id < RC5T583_REGULATOR_MAX; ++id) - regulator_unregister(regs[id].rdev); - return 0; } static struct platform_driver rc5t583_regulator_driver = { @@ -208,7 +191,6 @@ static struct platform_driver rc5t583_regulator_driver = { .owner = THIS_MODULE, }, .probe = rc5t583_regulator_probe, - .remove = rc5t583_regulator_remove, }; static int __init rc5t583_regulator_init(void) |