of: Simplify API of_find_node_with_property() implementation

Simplify of_find_node_with_property() implementation
by __of_find_property().

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241206-of_core_fix-v1-10-dc28ed56bec3@quicinc.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
This commit is contained in:
Zijun Hu 2024-12-06 08:52:36 +08:00 committed by Rob Herring (Arm)
parent 4ff899ee4e
commit 4bc244f681

View File

@ -1026,19 +1026,15 @@ struct device_node *of_find_node_with_property(struct device_node *from,
const char *prop_name)
{
struct device_node *np;
const struct property *pp;
unsigned long flags;
raw_spin_lock_irqsave(&devtree_lock, flags);
for_each_of_allnodes_from(from, np) {
for (pp = np->properties; pp; pp = pp->next) {
if (of_prop_cmp(pp->name, prop_name) == 0) {
of_node_get(np);
goto out;
}
if (__of_find_property(np, prop_name, NULL)) {
of_node_get(np);
break;
}
}
out:
of_node_put(from);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
return np;