Skip to contentSkip to conversation

drm: Using for_each_available_child_of_node to simplify code logic

PATCH New Zhang Zekun 1 participant 1 message Aug 8, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Using for_each_available_child_of_node to simplify code logic

The while loop of of_get_next_available_child() can be replaced by for_each_available_child_of_node(). Using this helper function to make code logic more simple.

---
 drivers/gpu/drm/sti/sti_drv.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/sti/sti_drv.c +1 -5
index 1799c12babf5..3a2cf3dc880f 100644
@@ -239,13 +239,9 @@ static int sti_platform_probe(struct platform_device *pdev)
 
 	devm_of_platform_populate(dev);
 
-	child_np = of_get_next_available_child(node, NULL);
-
-	while (child_np) {
+	for_each_available_child_of_node(node, child_np)
 		drm_of_component_match_add(dev, &match, component_compare_of,
 					   child_np);
-		child_np = of_get_next_available_child(node, child_np);
-	}
 
 	return component_master_add_with_match(dev, &sti_ops, match);
 }
Signature · 1 line
2.17.1