diff mbox

[v4,03/17] omap4iss: Add vb2_queue lock

Message ID 20180615190737.24139-4-ezequiel@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ezequiel Garcia June 15, 2018, 7:07 p.m. UTC
vb2_queue lock is now mandatory. Add it, remove driver ad-hoc
locks, and implement wait_{prepare, finish}.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/staging/media/omap4iss/iss_video.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

Comments

Hans Verkuil July 2, 2018, 8:28 a.m. UTC | #1
On 15/06/18 21:07, Ezequiel Garcia wrote:
> vb2_queue lock is now mandatory. Add it, remove driver ad-hoc
> locks, and implement wait_{prepare, finish}.

I don't see any wait_prepare/finish implementation?!

Regards,

	Hans

> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  drivers/staging/media/omap4iss/iss_video.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
> index a3a83424a926..d919bae83828 100644
> --- a/drivers/staging/media/omap4iss/iss_video.c
> +++ b/drivers/staging/media/omap4iss/iss_video.c
> @@ -873,8 +873,6 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
>  	if (type != video->type)
>  		return -EINVAL;
>  
> -	mutex_lock(&video->stream_lock);
> -
>  	/*
>  	 * Start streaming on the pipeline. No link touching an entity in the
>  	 * pipeline can be activated or deactivated once streaming is started.
> @@ -978,8 +976,6 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
>  
>  	media_graph_walk_cleanup(&graph);
>  
> -	mutex_unlock(&video->stream_lock);
> -
>  	return 0;
>  
>  err_omap4iss_set_stream:
> @@ -996,8 +992,6 @@ iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
>  err_graph_walk_init:
>  	media_entity_enum_cleanup(&pipe->ent_enum);
>  
> -	mutex_unlock(&video->stream_lock);
> -
>  	return ret;
>  }
>  
> @@ -1013,10 +1007,8 @@ iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
>  	if (type != video->type)
>  		return -EINVAL;
>  
> -	mutex_lock(&video->stream_lock);
> -
>  	if (!vb2_is_streaming(&vfh->queue))
> -		goto done;
> +		return 0;
>  
>  	/* Update the pipeline state. */
>  	if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
> @@ -1041,8 +1033,6 @@ iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
>  		video->iss->pdata->set_constraints(video->iss, false);
>  	media_pipeline_stop(&video->video.entity);
>  
> -done:
> -	mutex_unlock(&video->stream_lock);
>  	return 0;
>  }
>  
> @@ -1137,6 +1127,7 @@ static int iss_video_open(struct file *file)
>  	q->buf_struct_size = sizeof(struct iss_buffer);
>  	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
>  	q->dev = video->iss->dev;
> +	q->lock = &video->stream_lock;
>  
>  	ret = vb2_queue_init(q);
>  	if (ret) {
>
Ezequiel Garcia July 6, 2018, 3:24 p.m. UTC | #2
On Mon, 2018-07-02 at 10:28 +0200, Hans Verkuil wrote:
> On 15/06/18 21:07, Ezequiel Garcia wrote:
> > vb2_queue lock is now mandatory. Add it, remove driver ad-hoc
> > locks, and implement wait_{prepare, finish}.
> 
> I don't see any wait_prepare/finish implementation?!
> 
> 

Oops, seems it felt through the cracks.

Anyway, we need to solve the omap3 issues before going forward with
this series.

Thanks,
Eze
diff mbox

Patch

diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c
index a3a83424a926..d919bae83828 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -873,8 +873,6 @@  iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
 	if (type != video->type)
 		return -EINVAL;
 
-	mutex_lock(&video->stream_lock);
-
 	/*
 	 * Start streaming on the pipeline. No link touching an entity in the
 	 * pipeline can be activated or deactivated once streaming is started.
@@ -978,8 +976,6 @@  iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
 
 	media_graph_walk_cleanup(&graph);
 
-	mutex_unlock(&video->stream_lock);
-
 	return 0;
 
 err_omap4iss_set_stream:
@@ -996,8 +992,6 @@  iss_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
 err_graph_walk_init:
 	media_entity_enum_cleanup(&pipe->ent_enum);
 
-	mutex_unlock(&video->stream_lock);
-
 	return ret;
 }
 
@@ -1013,10 +1007,8 @@  iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
 	if (type != video->type)
 		return -EINVAL;
 
-	mutex_lock(&video->stream_lock);
-
 	if (!vb2_is_streaming(&vfh->queue))
-		goto done;
+		return 0;
 
 	/* Update the pipeline state. */
 	if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
@@ -1041,8 +1033,6 @@  iss_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
 		video->iss->pdata->set_constraints(video->iss, false);
 	media_pipeline_stop(&video->video.entity);
 
-done:
-	mutex_unlock(&video->stream_lock);
 	return 0;
 }
 
@@ -1137,6 +1127,7 @@  static int iss_video_open(struct file *file)
 	q->buf_struct_size = sizeof(struct iss_buffer);
 	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
 	q->dev = video->iss->dev;
+	q->lock = &video->stream_lock;
 
 	ret = vb2_queue_init(q);
 	if (ret) {