diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-10-13 10:11:35 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-11-25 08:39:14 -0200 |
commit | b83bba24a29c44b696b5977e3874bc07b13dc3c0 (patch) | |
tree | 0379cb6f3b164dc253713c14e9246d7acee5af43 /drivers/media/usb/uvc/uvc_v4l2.c | |
parent | aa3d17df6470338223f7ae6893647453e8f8e98e (diff) | |
download | linux-next-b83bba24a29c44b696b5977e3874bc07b13dc3c0.tar.gz |
[media] uvcvideo: Separate video and queue enable/disable operations
In order to make use of the vb2 queue start/stop_streaming operations
the video and queue enable/disable operations need to be split, as the
vb2 queue will need to enable and disable video instead of the other way
around.
Also move buffer queue disable outside of uvc_video_resume() to remove
all queue disable operations out of uvc_video.c.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/uvc/uvc_v4l2.c')
-rw-r--r-- | drivers/media/usb/uvc/uvc_v4l2.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index a16fe2167976..e8bf4f149a26 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -532,6 +532,7 @@ static int uvc_v4l2_release(struct file *file) /* Only free resources if this is a privileged handle. */ if (uvc_has_privileges(handle)) { uvc_video_enable(stream, 0); + uvc_queue_enable(&stream->queue, 0); uvc_free_buffers(&stream->queue); } @@ -766,7 +767,15 @@ static int uvc_ioctl_streamon(struct file *file, void *fh, return -EBUSY; mutex_lock(&stream->mutex); + ret = uvc_queue_enable(&stream->queue, 1); + if (ret < 0) + goto done; + ret = uvc_video_enable(stream, 1); + if (ret < 0) + uvc_queue_enable(&stream->queue, 0); + +done: mutex_unlock(&stream->mutex); return ret; @@ -777,7 +786,6 @@ static int uvc_ioctl_streamoff(struct file *file, void *fh, { struct uvc_fh *handle = fh; struct uvc_streaming *stream = handle->stream; - int ret; if (type != stream->type) return -EINVAL; @@ -786,10 +794,11 @@ static int uvc_ioctl_streamoff(struct file *file, void *fh, return -EBUSY; mutex_lock(&stream->mutex); - ret = uvc_video_enable(stream, 0); + uvc_video_enable(stream, 0); + uvc_queue_enable(&stream->queue, 0); mutex_unlock(&stream->mutex); - return ret; + return 0; } static int uvc_ioctl_enum_input(struct file *file, void *fh, |