diff options
author | Lee Jones <lee.jones@linaro.org> | 2012-05-05 07:38:19 -0400 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-05-05 07:55:50 -0400 |
commit | 2aac3de19b72608f474c90034185c2be4908728f (patch) | |
tree | af227c50daa395e186f79bbd7507a69860ee9f0b /drivers/power/ab8500_btemp.c | |
parent | 5f98eb393c6d7a5de3202b7ce9e4439292e952fb (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_btemp.c')
-rw-r--r-- | drivers/power/ab8500_btemp.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index e266f038a110..bba3ccac72fe 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c | |||
@@ -964,10 +964,15 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev) | |||
964 | { | 964 | { |
965 | int irq, i, ret = 0; | 965 | int irq, i, ret = 0; |
966 | u8 val; | 966 | u8 val; |
967 | struct abx500_bm_plat_data *plat_data; | 967 | struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data; |
968 | struct ab8500_btemp *di; | ||
969 | |||
970 | if (!plat_data) { | ||
971 | dev_err(&pdev->dev, "No platform data\n"); | ||
972 | return -EINVAL; | ||
973 | } | ||
968 | 974 | ||
969 | struct ab8500_btemp *di = | 975 | di = kzalloc(sizeof(*di), GFP_KERNEL); |
970 | kzalloc(sizeof(struct ab8500_btemp), GFP_KERNEL); | ||
971 | if (!di) | 976 | if (!di) |
972 | return -ENOMEM; | 977 | return -ENOMEM; |
973 | 978 | ||
@@ -977,13 +982,12 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev) | |||
977 | di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); | 982 | di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); |
978 | 983 | ||
979 | /* get btemp specific platform data */ | 984 | /* get btemp specific platform data */ |
980 | plat_data = pdev->dev.platform_data; | 985 | di->pdata = plat_data->btemp; |
981 | if (!plat_data || !plat_data->btemp) { | 986 | if (!di->pdata) { |
982 | dev_err(di->dev, "no btemp platform data supplied\n"); | 987 | dev_err(di->dev, "no btemp platform data supplied\n"); |
983 | ret = -EINVAL; | 988 | ret = -EINVAL; |
984 | goto free_device_info; | 989 | goto free_device_info; |
985 | } | 990 | } |
986 | di->pdata = plat_data->btemp; | ||
987 | 991 | ||
988 | /* get battery specific platform data */ | 992 | /* get battery specific platform data */ |
989 | di->bat = plat_data->battery; | 993 | di->bat = plat_data->battery; |