mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
USB: of: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Signed-off-by: Hans Zhang <18255117159@163.com> Link: https://patch.msgid.link/20260407013122.1296818-1-18255117159@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
2ab833a16a
commit
9a8881aab5
|
|
@ -79,17 +79,13 @@ EXPORT_SYMBOL_GPL(usb_of_has_combined_node);
|
|||
static bool usb_of_has_devices_or_graph(const struct usb_device *hub)
|
||||
{
|
||||
const struct device_node *np = hub->dev.of_node;
|
||||
struct device_node *child;
|
||||
|
||||
if (of_graph_is_present(np))
|
||||
return true;
|
||||
|
||||
for_each_child_of_node(np, child) {
|
||||
if (of_property_present(child, "reg")) {
|
||||
of_node_put(child);
|
||||
for_each_child_of_node_scoped(np, child)
|
||||
if (of_property_present(child, "reg"))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user