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 <fenglinw@codeaurora.org>
This commit is contained in:
Fenglin Wu 2020-02-14 12:43:33 +08:00 committed by David Collins
parent 9f3a5f2187
commit 0bfa6b4fc7

View File

@ -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) {