aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/ab8500_charger.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-05-05 07:38:19 -0400
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-05-05 07:55:50 -0400
commit2aac3de19b72608f474c90034185c2be4908728f (patch)
treeaf227c50daa395e186f79bbd7507a69860ee9f0b /drivers/power/ab8500_charger.c
parent5f98eb393c6d7a5de3202b7ce9e4439292e952fb (diff)
ab8500: Clean up probe routines
These patches clean up some ugliness and brings the variable initialisation formatting more into line with other drivers. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Diffstat (limited to 'drivers/power/ab8500_charger.c')
-rw-r--r--drivers/power/ab8500_charger.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index 79dc584a53ed..d2303d0b7c75 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -2534,10 +2534,15 @@ static int __devexit ab8500_charger_remove(struct platform_device *pdev)
2534static int __devinit ab8500_charger_probe(struct platform_device *pdev) 2534static int __devinit ab8500_charger_probe(struct platform_device *pdev)
2535{ 2535{
2536 int irq, i, charger_status, ret = 0; 2536 int irq, i, charger_status, ret = 0;
2537 struct abx500_bm_plat_data *plat_data; 2537 struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data;
2538 struct ab8500_charger *di;
2538 2539
2539 struct ab8500_charger *di = 2540 if (!plat_data) {
2540 kzalloc(sizeof(struct ab8500_charger), GFP_KERNEL); 2541 dev_err(&pdev->dev, "No platform data\n");
2542 return -EINVAL;
2543 }
2544
2545 di = kzalloc(sizeof(*di), GFP_KERNEL);
2541 if (!di) 2546 if (!di)
2542 return -ENOMEM; 2547 return -ENOMEM;
2543 2548
@@ -2550,13 +2555,12 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev)
2550 spin_lock_init(&di->usb_state.usb_lock); 2555 spin_lock_init(&di->usb_state.usb_lock);
2551 2556
2552 /* get charger specific platform data */ 2557 /* get charger specific platform data */
2553 plat_data = pdev->dev.platform_data; 2558 di->pdata = plat_data->charger;
2554 if (!plat_data || !plat_data->charger) { 2559 if (!di->pdata) {
2555 dev_err(di->dev, "no charger platform data supplied\n"); 2560 dev_err(di->dev, "no charger platform data supplied\n");
2556 ret = -EINVAL; 2561 ret = -EINVAL;
2557 goto free_device_info; 2562 goto free_device_info;
2558 } 2563 }
2559 di->pdata = plat_data->charger;
2560 2564
2561 /* get battery specific platform data */ 2565 /* get battery specific platform data */
2562 di->bat = plat_data->battery; 2566 di->bat = plat_data->battery;