summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-12-07 12:53:28 +0100
committerAnton Vorontsov <anton@enomsg.org>2013-01-06 04:07:22 +0100
commit8feffd109977c045669913f4e80e8811f2212cd9 (patch)
treef228b1304530d1e65467f99241ee7853209940ea /drivers
parentbq27x00_battery: Fix bugs introduced with BQ27425 support (diff)
downloadlinux-8feffd109977c045669913f4e80e8811f2212cd9.tar.xz
linux-8feffd109977c045669913f4e80e8811f2212cd9.zip
ab8500_charger: Use devm_regulator_get API
devm_regulator_get() is device managed and makes error handling and code cleanup simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Arun Murthy <arun.murthy@stericsson.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/ab8500_charger.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index e5755f0ba831..c342f79cb588 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -2604,9 +2604,6 @@ static int ab8500_charger_remove(struct platform_device *pdev)
free_irq(irq, di);
}
- /* disable the regulator */
- regulator_put(di->regu);
-
/* Backup battery voltage and current disable */
ret = abx500_mask_and_set_register_interruptible(di->dev,
AB8500_RTC, AB8500_RTC_CTRL_REG, RTC_BUP_CH_ENA, 0);
@@ -2759,7 +2756,7 @@ static int ab8500_charger_probe(struct platform_device *pdev)
* is a charger connected to avoid erroneous BTEMP_HIGH/LOW
* interrupts during charging
*/
- di->regu = regulator_get(di->dev, "vddadc");
+ di->regu = devm_regulator_get(di->dev, "vddadc");
if (IS_ERR(di->regu)) {
ret = PTR_ERR(di->regu);
dev_err(di->dev, "failed to get vddadc regulator\n");
@@ -2771,14 +2768,14 @@ static int ab8500_charger_probe(struct platform_device *pdev)
ret = ab8500_charger_init_hw_registers(di);
if (ret) {
dev_err(di->dev, "failed to initialize ABB registers\n");
- goto free_regulator;
+ goto free_charger_wq;
}
/* Register AC charger class */
ret = power_supply_register(di->dev, &di->ac_chg.psy);
if (ret) {
dev_err(di->dev, "failed to register AC charger\n");
- goto free_regulator;
+ goto free_charger_wq;
}
/* Register USB charger class */
@@ -2852,8 +2849,6 @@ free_usb:
power_supply_unregister(&di->usb_chg.psy);
free_ac:
power_supply_unregister(&di->ac_chg.psy);
-free_regulator:
- regulator_put(di->regu);
free_charger_wq:
destroy_workqueue(di->charger_wq);
return ret;