mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
of/platform: 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: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20251231120926.66185-2-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
This commit is contained in:
committed by
Rob Herring (Arm)
parent
4ed31b0c4c
commit
16f47ecae1
@@ -394,7 +394,6 @@ int of_platform_bus_probe(struct device_node *root,
|
||||
const struct of_device_id *matches,
|
||||
struct device *parent)
|
||||
{
|
||||
struct device_node *child;
|
||||
int rc = 0;
|
||||
|
||||
root = root ? of_node_get(root) : of_find_node_by_path("/");
|
||||
@@ -407,13 +406,13 @@ int of_platform_bus_probe(struct device_node *root,
|
||||
/* Do a self check of bus type, if there's a match, create children */
|
||||
if (of_match_node(matches, root)) {
|
||||
rc = of_platform_bus_create(root, matches, NULL, parent, false);
|
||||
} else for_each_child_of_node(root, child) {
|
||||
if (!of_match_node(matches, child))
|
||||
continue;
|
||||
rc = of_platform_bus_create(child, matches, NULL, parent, false);
|
||||
if (rc) {
|
||||
of_node_put(child);
|
||||
break;
|
||||
} else {
|
||||
for_each_child_of_node_scoped(root, child) {
|
||||
if (!of_match_node(matches, child))
|
||||
continue;
|
||||
rc = of_platform_bus_create(child, matches, NULL, parent, false);
|
||||
if (rc)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user