Commit 3f02de27 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] uvcvideo: Don't stop the stream twice at file handle release

When releasing the file handle the driver calls the vb2_queue_release
which turns the stream off. There's thus no need to turn the stream off
explicitly beforehand.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent a11a03e5
...@@ -194,6 +194,13 @@ int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, ...@@ -194,6 +194,13 @@ int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
return 0; return 0;
} }
void uvc_queue_release(struct uvc_video_queue *queue)
{
mutex_lock(&queue->mutex);
vb2_queue_release(&queue->queue);
mutex_unlock(&queue->mutex);
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* V4L2 queue operations * V4L2 queue operations
*/ */
...@@ -210,13 +217,6 @@ int uvc_alloc_buffers(struct uvc_video_queue *queue, ...@@ -210,13 +217,6 @@ int uvc_alloc_buffers(struct uvc_video_queue *queue,
return ret ? ret : rb->count; return ret ? ret : rb->count;
} }
void uvc_free_buffers(struct uvc_video_queue *queue)
{
mutex_lock(&queue->mutex);
vb2_queue_release(&queue->queue);
mutex_unlock(&queue->mutex);
}
int uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) int uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf)
{ {
int ret; int ret;
......
...@@ -530,10 +530,8 @@ static int uvc_v4l2_release(struct file *file) ...@@ -530,10 +530,8 @@ static int uvc_v4l2_release(struct file *file)
uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_release\n"); uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_release\n");
/* Only free resources if this is a privileged handle. */ /* Only free resources if this is a privileged handle. */
if (uvc_has_privileges(handle)) { if (uvc_has_privileges(handle))
uvc_queue_enable(&stream->queue, 0); uvc_queue_release(&stream->queue);
uvc_free_buffers(&stream->queue);
}
/* Release the file handle. */ /* Release the file handle. */
uvc_dismiss_privileges(handle); uvc_dismiss_privileges(handle);
......
...@@ -623,9 +623,9 @@ extern struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id); ...@@ -623,9 +623,9 @@ extern struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
/* Video buffers queue management. */ /* Video buffers queue management. */
extern int uvc_queue_init(struct uvc_video_queue *queue, extern int uvc_queue_init(struct uvc_video_queue *queue,
enum v4l2_buf_type type, int drop_corrupted); enum v4l2_buf_type type, int drop_corrupted);
extern void uvc_queue_release(struct uvc_video_queue *queue);
extern int uvc_alloc_buffers(struct uvc_video_queue *queue, extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
struct v4l2_requestbuffers *rb); struct v4l2_requestbuffers *rb);
extern void uvc_free_buffers(struct uvc_video_queue *queue);
extern int uvc_query_buffer(struct uvc_video_queue *queue, extern int uvc_query_buffer(struct uvc_video_queue *queue,
struct v4l2_buffer *v4l2_buf); struct v4l2_buffer *v4l2_buf);
extern int uvc_create_buffers(struct uvc_video_queue *queue, extern int uvc_create_buffers(struct uvc_video_queue *queue,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment