[PATCH] drm: Using for_each_available_child_of_node to simplify code logic

Zhang Zekun zhangzekun11 at huawei.com
Thu Aug 8 07:45:10 UTC 2024


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.

Signed-off-by: Zhang Zekun <zhangzekun11 at huawei.com>
---
 drivers/gpu/drm/sti/sti_drv.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 1799c12babf5..3a2cf3dc880f 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -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);
 }
-- 
2.17.1



More information about the dri-devel mailing list