From 0bfa6b4fc7e5f29294697cbf3ebd25d095586091 Mon Sep 17 00:00:00 2001 From: Fenglin Wu Date: Fri, 14 Feb 2020 12:43:33 +0800 Subject: [PATCH] input: qcom-hv-haptics: ignore parsing non-effect subnodes Only parse effect subnodes which have qcom,effect-id property. Change-Id: I70b2c1401bbf7d5238de818ac5b6ed55943a19f6 Signed-off-by: Fenglin Wu --- drivers/input/misc/qcom-hv-haptics.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/input/misc/qcom-hv-haptics.c b/drivers/input/misc/qcom-hv-haptics.c index 7b4283d757bc..a287ba0b8e2f 100644 --- a/drivers/input/misc/qcom-hv-haptics.c +++ b/drivers/input/misc/qcom-hv-haptics.c @@ -2064,9 +2064,12 @@ static int haptics_parse_effects_dt(struct haptics_chip *chip) { struct device_node *node = chip->dev->of_node; struct device_node *child; - int rc, i = 0, num; + int rc, i = 0, num = 0; - num = of_get_available_child_count(node); + for_each_available_child_of_node(node, child) { + if (of_find_property(child, "qcom,effect-id", NULL)) + num++; + } if (num == 0) return 0; @@ -2076,6 +2079,9 @@ static int haptics_parse_effects_dt(struct haptics_chip *chip) return -ENOMEM; for_each_available_child_of_node(node, child) { + if (!of_find_property(child, "qcom,effect-id", NULL)) + continue; + rc = haptics_parse_per_effect_dt(chip, child, &chip->effects[i]); if (rc < 0) {