]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
power: supply: charger-manager: Count cm-chargers property directly
authorJonathan Bakker <xc-racer2@live.ca>
Thu, 14 May 2020 23:04:34 +0000 (16:04 -0700)
committerSebastian Reichel <sre@kernel.org>
Fri, 28 Aug 2020 17:27:45 +0000 (19:27 +0200)
Rather than having a cm-chargers and a separate cm-num-chargers
property, simply count the entries in cm-chargers.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/charger-manager.c

index 5f536284d2ca9aa952773cde000bb55e2a89318f..07992821e2523ea8e368b8fa84d7626a69a12d8a 100644 (file)
@@ -1311,8 +1311,8 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev)
        desc->battery_present = battery_stat;
 
        /* chargers */
-       of_property_read_u32(np, "cm-num-chargers", &num_chgs);
-       if (num_chgs) {
+       num_chgs = of_property_count_strings(np, "cm-chargers");
+       if (num_chgs > 0) {
                int i;
 
                /* Allocate empty bin at the tail of array */