summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-11-30 10:57:14 +0000
committerLee Jones <lee.jones@linaro.org>2012-12-11 08:43:55 +0000
commitbdc56b44038e1472d24c9195337226b8d6f2961e (patch)
tree15e8b795473b6c2a4ee82b6ea82156e4b2a4c6ad
parent195c1c660c1868ac2024ad0ee3d5dce49bde4488 (diff)
downloadlwn-bdc56b44038e1472d24c9195337226b8d6f2961e.tar.gz
lwn-bdc56b44038e1472d24c9195337226b8d6f2961e.zip
abx500_chargalg: Reorder obtainment of platform specific battery management data
Now that we always pass platform specific battery management data through platform_data instead of obtaining it via different means depending the way be boot the system (DT or ATAGs); we need to re-jiggle the way we acquire it in the driver start-up functions. Now it is wrong for it to be missing, but we still allow Device Tree code to fiddle with it once we've confirmed it's there. Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/power/abx500_chargalg.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
index 22a511c2a719..a8acfe5b863f 100644
--- a/drivers/power/abx500_chargalg.c
+++ b/drivers/power/abx500_chargalg.c
@@ -1806,6 +1806,7 @@ static char *supply_interface[] = {
static int __devinit abx500_chargalg_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
+ struct abx500_bm_data *plat = pdev->dev.platform_data;
struct abx500_chargalg *di;
int ret = 0;
@@ -1814,21 +1815,19 @@ static int __devinit abx500_chargalg_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "%s no mem for ab8500_chargalg\n", __func__);
return -ENOMEM;
}
- di->bm = pdev->mfd_cell->platform_data;
- if (!di->bm) {
- if (np) {
- ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm);
- if (ret) {
- dev_err(&pdev->dev,
- "failed to get battery information\n");
- return ret;
- }
- } else {
- dev_err(&pdev->dev, "missing dt node for ab8500_chargalg\n");
- return -EINVAL;
+
+ if (!plat) {
+ dev_err(&pdev->dev, "no battery management data supplied\n");
+ return -EINVAL;
+ }
+ di->bm = plat;
+
+ if (np) {
+ ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to get battery information\n");
+ return ret;
}
- } else {
- dev_info(&pdev->dev, "falling back to legacy platform data\n");
}
/* get device struct */