diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-04 11:07:59 +0530 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-17 00:28:41 +0100 |
commit | 5ecdf140f21c50c08be34a83b44f28722813366c (patch) | |
tree | 7a8b4d38ca51cb137813ea52c771b86a4a0c7a3f /drivers/regulator/max8907-regulator.c | |
parent | dcfb6b56f18b5d9eff9b784d4e5b4a085f149de2 (diff) | |
download | talos-obmc-linux-5ecdf140f21c50c08be34a83b44f28722813366c.tar.gz talos-obmc-linux-5ecdf140f21c50c08be34a83b44f28722813366c.zip |
regulator: max8907-regulator: Use devm_regulator_register
devm_* simplifies the code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/max8907-regulator.c')
-rw-r--r-- | drivers/regulator/max8907-regulator.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index 4568c15fa78d..0c5fe6c6ac26 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c @@ -350,33 +350,17 @@ static int max8907_regulator_probe(struct platform_device *pdev) pmic->desc[i].ops = &max8907_out5v_hwctl_ops; } - pmic->rdev[i] = regulator_register(&pmic->desc[i], &config); + pmic->rdev[i] = devm_regulator_register(&pdev->dev, + &pmic->desc[i], &config); if (IS_ERR(pmic->rdev[i])) { dev_err(&pdev->dev, "failed to register %s regulator\n", pmic->desc[i].name); - ret = PTR_ERR(pmic->rdev[i]); - goto err_unregister_regulator; + return PTR_ERR(pmic->rdev[i]); } } return 0; - -err_unregister_regulator: - while (--i >= 0) - regulator_unregister(pmic->rdev[i]); - return ret; -} - -static int max8907_regulator_remove(struct platform_device *pdev) -{ - struct max8907_regulator *pmic = platform_get_drvdata(pdev); - int i; - - for (i = 0; i < MAX8907_NUM_REGULATORS; i++) - regulator_unregister(pmic->rdev[i]); - - return 0; } static struct platform_driver max8907_regulator_driver = { @@ -385,7 +369,6 @@ static struct platform_driver max8907_regulator_driver = { .owner = THIS_MODULE, }, .probe = max8907_regulator_probe, - .remove = max8907_regulator_remove, }; static int __init max8907_regulator_init(void) |