power: supply: ab8500: Call battery population once
authorLinus Walleij <linus.walleij@linaro.org>
Sat, 22 May 2021 22:50:40 +0000 (00:50 +0200)
committerSebastian Reichel <sre@kernel.org>
Thu, 3 Jun 2021 16:40:15 +0000 (18:40 +0200)
The code was calling ab8500_bm_of_probe() in four different
spots effectively overwriting the same configuration three
times. This was done because probe order was uncertain.

Since we now used componentized probe, call it only once
while probing the main charging component.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/ab8500_btemp.c
drivers/power/supply/ab8500_fg.c
drivers/power/supply/abx500_chargalg.c

index 3598b5a748e7006df4c2eaee0a6d5ace05420715..5b664d2f6b82728745baff9a324593a07c82b1bc 100644 (file)
@@ -983,7 +983,6 @@ static const struct component_ops ab8500_btemp_component_ops = {
 
 static int ab8500_btemp_probe(struct platform_device *pdev)
 {
-       struct device_node *np = pdev->dev.of_node;
        struct power_supply_config psy_cfg = {};
        struct device *dev = &pdev->dev;
        struct ab8500_btemp *di;
@@ -996,12 +995,6 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
 
        di->bm = &ab8500_bm_data;
 
-       ret = ab8500_bm_of_probe(dev, np, di->bm);
-       if (ret) {
-               dev_err(dev, "failed to get battery information\n");
-               return ret;
-       }
-
        /* get parent data */
        di->dev = dev;
        di->parent = dev_get_drvdata(pdev->dev.parent);
index c0ba0dfb3fd674f93f72587e4b61886a367e3d7c..4da89920657cebf47e998120557d3a2e80f64808 100644 (file)
@@ -3058,12 +3058,6 @@ static int ab8500_fg_probe(struct platform_device *pdev)
 
        di->bm = &ab8500_bm_data;
 
-       ret = ab8500_bm_of_probe(dev, np, di->bm);
-       if (ret) {
-               dev_err(dev, "failed to get battery information\n");
-               return ret;
-       }
-
        mutex_init(&di->cc_lock);
 
        /* get parent data */
index 599684ce0e4b06b858928c3dcd07c245da2bb98a..a17849bfacbff954e078402ee7c294cd4c41b2d9 100644 (file)
@@ -2002,7 +2002,6 @@ static const struct component_ops abx500_chargalg_component_ops = {
 static int abx500_chargalg_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
-       struct device_node *np = dev->of_node;
        struct power_supply_config psy_cfg = {};
        struct abx500_chargalg *di;
        int ret = 0;
@@ -2013,12 +2012,6 @@ static int abx500_chargalg_probe(struct platform_device *pdev)
 
        di->bm = &ab8500_bm_data;
 
-       ret = ab8500_bm_of_probe(dev, np, di->bm);
-       if (ret) {
-               dev_err(dev, "failed to get battery information\n");
-               return ret;
-       }
-
        /* get device struct and parent */
        di->dev = dev;
        di->parent = dev_get_drvdata(pdev->dev.parent);