diff mbox series

[v1,3/5] media: ti: omap3isp: Use media_pipeline_for_each_entity()

Message ID 20221212141621.724-4-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series media: Replace media graph walk in several drivers | expand

Commit Message

Laurent Pinchart Dec. 12, 2022, 2:16 p.m. UTC
Replace usage of the deprecated media graph walk API with the new
media_pipeline_for_each_entity() macro.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/platform/ti/omap3isp/ispvideo.c | 21 +++----------------
 1 file changed, 3 insertions(+), 18 deletions(-)

Comments

Tomi Valkeinen Dec. 15, 2022, 1:16 p.m. UTC | #1
On 12/12/2022 16:16, Laurent Pinchart wrote:
> Replace usage of the deprecated media graph walk API with the new
> media_pipeline_for_each_entity() macro.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>   drivers/media/platform/ti/omap3isp/ispvideo.c | 21 +++----------------
>   1 file changed, 3 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/platform/ti/omap3isp/ispvideo.c
> index 3e5348c63773..aa81b5564b4f 100644
> --- a/drivers/media/platform/ti/omap3isp/ispvideo.c
> +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c
> @@ -221,22 +221,11 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad)
>   static int isp_video_get_graph_data(struct isp_video *video,
>   				    struct isp_pipeline *pipe)
>   {
> -	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 isp_video *far_end = NULL;
> -	int ret;
>   
> -	mutex_lock(&mdev->graph_mutex);
> -	ret = media_graph_walk_init(&graph, mdev);
> -	if (ret) {
> -		mutex_unlock(&mdev->graph_mutex);
> -		return ret;
> -	}
> -
> -	media_graph_walk_start(&graph, entity);
> -
> -	while ((entity = media_graph_walk_next(&graph))) {
> +	media_pipeline_for_each_entity(&pipe->pipe, &iter, entity) {
>   		struct isp_video *__video;
>   
>   		media_entity_enum_set(&pipe->ent_enum, entity);
> @@ -255,10 +244,6 @@ static int isp_video_get_graph_data(struct isp_video *video,
>   			far_end = __video;
>   	}
>   
> -	mutex_unlock(&mdev->graph_mutex);
> -
> -	media_graph_walk_cleanup(&graph);
> -
>   	if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
>   		pipe->input = far_end;
>   		pipe->output = video;

media_pipeline_entity_iter_init() and media_pipeline_entity_iter_cleanup()?

  Tomi
diff mbox series

Patch

diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/platform/ti/omap3isp/ispvideo.c
index 3e5348c63773..aa81b5564b4f 100644
--- a/drivers/media/platform/ti/omap3isp/ispvideo.c
+++ b/drivers/media/platform/ti/omap3isp/ispvideo.c
@@ -221,22 +221,11 @@  isp_video_remote_subdev(struct isp_video *video, u32 *pad)
 static int isp_video_get_graph_data(struct isp_video *video,
 				    struct isp_pipeline *pipe)
 {
-	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 isp_video *far_end = NULL;
-	int ret;
 
-	mutex_lock(&mdev->graph_mutex);
-	ret = media_graph_walk_init(&graph, mdev);
-	if (ret) {
-		mutex_unlock(&mdev->graph_mutex);
-		return ret;
-	}
-
-	media_graph_walk_start(&graph, entity);
-
-	while ((entity = media_graph_walk_next(&graph))) {
+	media_pipeline_for_each_entity(&pipe->pipe, &iter, entity) {
 		struct isp_video *__video;
 
 		media_entity_enum_set(&pipe->ent_enum, entity);
@@ -255,10 +244,6 @@  static int isp_video_get_graph_data(struct isp_video *video,
 			far_end = __video;
 	}
 
-	mutex_unlock(&mdev->graph_mutex);
-
-	media_graph_walk_cleanup(&graph);
-
 	if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 		pipe->input = far_end;
 		pipe->output = video;