提交 195c1c66 编写于 作者: L Lee Jones

ab8500_fg: 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: NLee Jones <lee.jones@linaro.org>
上级 7722b799
...@@ -2448,6 +2448,7 @@ static char *supply_interface[] = { ...@@ -2448,6 +2448,7 @@ static char *supply_interface[] = {
static int __devinit ab8500_fg_probe(struct platform_device *pdev) static int __devinit ab8500_fg_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct abx500_bm_data *plat = pdev->dev.platform_data;
struct ab8500_fg *di; struct ab8500_fg *di;
int i, irq; int i, irq;
int ret = 0; int ret = 0;
...@@ -2457,21 +2458,19 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev) ...@@ -2457,21 +2458,19 @@ static int __devinit ab8500_fg_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "%s no mem for ab8500_fg\n", __func__); dev_err(&pdev->dev, "%s no mem for ab8500_fg\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
di->bm = pdev->mfd_cell->platform_data;
if (!di->bm) { if (!plat) {
if (np) { dev_err(&pdev->dev, "no battery management data supplied\n");
ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm); return -EINVAL;
if (ret) { }
dev_err(&pdev->dev, di->bm = plat;
"failed to get battery information\n");
return ret; if (np) {
} ret = ab8500_bm_of_probe(&pdev->dev, np, di->bm);
} else { if (ret) {
dev_err(&pdev->dev, "missing dt node for ab8500_fg\n"); dev_err(&pdev->dev, "failed to get battery information\n");
return -EINVAL; return ret;
} }
} else {
dev_info(&pdev->dev, "falling back to legacy platform data\n");
} }
mutex_init(&di->cc_lock); mutex_init(&di->cc_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册