aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/ab8500_charger.c
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-12-07 06:53:28 -0500
committerAnton Vorontsov <anton@enomsg.org>2013-01-05 22:07:22 -0500
commit8feffd109977c045669913f4e80e8811f2212cd9 (patch)
treef228b1304530d1e65467f99241ee7853209940ea /drivers/power/ab8500_charger.c
parentbde83b9a6b44c1e0fd872e57ecc869cfcf88538f (diff)
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/power/ab8500_charger.c')
-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)
2604 free_irq(irq, di); 2604 free_irq(irq, di);
2605 } 2605 }
2606 2606
2607 /* disable the regulator */
2608 regulator_put(di->regu);
2609
2610 /* Backup battery voltage and current disable */ 2607 /* Backup battery voltage and current disable */
2611 ret = abx500_mask_and_set_register_interruptible(di->dev, 2608 ret = abx500_mask_and_set_register_interruptible(di->dev,
2612 AB8500_RTC, AB8500_RTC_CTRL_REG, RTC_BUP_CH_ENA, 0); 2609 AB8500_RTC, AB8500_RTC_CTRL_REG, RTC_BUP_CH_ENA, 0);
@@ -2759,7 +2756,7 @@ static int ab8500_charger_probe(struct platform_device *pdev)
2759 * is a charger connected to avoid erroneous BTEMP_HIGH/LOW 2756 * is a charger connected to avoid erroneous BTEMP_HIGH/LOW
2760 * interrupts during charging 2757 * interrupts during charging
2761 */ 2758 */
2762 di->regu = regulator_get(di->dev, "vddadc"); 2759 di->regu = devm_regulator_get(di->dev, "vddadc");
2763 if (IS_ERR(di->regu)) { 2760 if (IS_ERR(di->regu)) {
2764 ret = PTR_ERR(di->regu); 2761 ret = PTR_ERR(di->regu);
2765 dev_err(di->dev, "failed to get vddadc regulator\n"); 2762 dev_err(di->dev, "failed to get vddadc regulator\n");
@@ -2771,14 +2768,14 @@ static int ab8500_charger_probe(struct platform_device *pdev)
2771 ret = ab8500_charger_init_hw_registers(di); 2768 ret = ab8500_charger_init_hw_registers(di);
2772 if (ret) { 2769 if (ret) {
2773 dev_err(di->dev, "failed to initialize ABB registers\n"); 2770 dev_err(di->dev, "failed to initialize ABB registers\n");
2774 goto free_regulator; 2771 goto free_charger_wq;
2775 } 2772 }
2776 2773
2777 /* Register AC charger class */ 2774 /* Register AC charger class */
2778 ret = power_supply_register(di->dev, &di->ac_chg.psy); 2775 ret = power_supply_register(di->dev, &di->ac_chg.psy);
2779 if (ret) { 2776 if (ret) {
2780 dev_err(di->dev, "failed to register AC charger\n"); 2777 dev_err(di->dev, "failed to register AC charger\n");
2781 goto free_regulator; 2778 goto free_charger_wq;
2782 } 2779 }
2783 2780
2784 /* Register USB charger class */ 2781 /* Register USB charger class */
@@ -2852,8 +2849,6 @@ free_usb:
2852 power_supply_unregister(&di->usb_chg.psy); 2849 power_supply_unregister(&di->usb_chg.psy);
2853free_ac: 2850free_ac:
2854 power_supply_unregister(&di->ac_chg.psy); 2851 power_supply_unregister(&di->ac_chg.psy);
2855free_regulator:
2856 regulator_put(di->regu);
2857free_charger_wq: 2852free_charger_wq:
2858 destroy_workqueue(di->charger_wq); 2853 destroy_workqueue(di->charger_wq);
2859 return ret; 2854 return ret;