diff mbox series

[3/4] media: vsp1: Switch to the new pipeline iterators

Message ID 20240822212445.2037-4-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series media: Drop one user of the deprecated graph walk API | expand

Commit Message

Laurent Pinchart Aug. 22, 2024, 9:24 p.m. UTC
Replace the soon to be deprecated graph walk API with the more efficient
iterator over entities in the media pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../media/platform/renesas/vsp1/vsp1_video.c    | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/renesas/vsp1/vsp1_video.c b/drivers/media/platform/renesas/vsp1/vsp1_video.c
index f0288968bd55..0c6152f73126 100644
--- a/drivers/media/platform/renesas/vsp1/vsp1_video.c
+++ b/drivers/media/platform/renesas/vsp1/vsp1_video.c
@@ -439,21 +439,16 @@  static int vsp1_video_pipeline_build_branch(struct vsp1_pipeline *pipe,
 static int vsp1_video_pipeline_build(struct vsp1_pipeline *pipe,
 				     struct vsp1_video *video)
 {
-	struct media_graph graph;
-	struct media_entity *entity = &video->video.entity;
-	struct media_device *mdev = entity->graph_obj.mdev;
+	struct media_pipeline_entity_iter iter;
+	struct media_entity *entity;
 	struct list_head *cursor;
 	unsigned int i;
 	int ret;
 
-	/* Walk the graph to locate the entities and video nodes. */
-	ret = media_graph_walk_init(&graph, mdev);
-	if (ret)
-		return ret;
+	/* Iterate over the pipeline to locate the entities and video nodes. */
+	media_pipeline_entity_iter_init(&pipe->pipe, &iter);
 
-	media_graph_walk_start(&graph, entity);
-
-	while ((entity = media_graph_walk_next(&graph))) {
+	media_pipeline_for_each_entity(&pipe->pipe, &iter, entity) {
 		struct v4l2_subdev *subdev;
 		struct vsp1_rwpf *rwpf;
 		struct vsp1_entity *e;
@@ -501,7 +496,7 @@  static int vsp1_video_pipeline_build(struct vsp1_pipeline *pipe,
 		}
 	}
 
-	media_graph_walk_cleanup(&graph);
+	media_pipeline_entity_iter_cleanup(&iter);
 
 	/* We need one output and at least one input. */
 	if (pipe->num_inputs == 0 || !pipe->output)