summaryrefslogtreecommitdiffstats
path: root/drivers/power/supply/charger-manager.c
diff options
context:
space:
mode:
authorJonathan Bakker <xc-racer2@live.ca>2020-05-15 01:04:34 +0200
committerSebastian Reichel <sre@kernel.org>2020-08-28 19:27:45 +0200
commit683aa86eb16ab8cf91075654d08ef7409f160e35 (patch)
tree23997ae6f8b51ac884640fd13387559ce5e17458 /drivers/power/supply/charger-manager.c
parentpower: supply: charger-manager: Update extcon functions (diff)
downloadlinux-683aa86eb16ab8cf91075654d08ef7409f160e35.tar.xz
linux-683aa86eb16ab8cf91075654d08ef7409f160e35.zip
power: supply: charger-manager: Count cm-chargers property directly
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>
Diffstat (limited to 'drivers/power/supply/charger-manager.c')
-rw-r--r--drivers/power/supply/charger-manager.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
index 5f536284d2ca..07992821e252 100644
--- a/drivers/power/supply/charger-manager.c
+++ b/drivers/power/supply/charger-manager.c
@@ -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 */