From b83bba24a29c44b696b5977e3874bc07b13dc3c0 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 13 Oct 2014 10:11:35 -0300 Subject: [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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_driver.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'drivers/media/usb/uvc/uvc_driver.c') diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 30163432a711..ab1e2fd0a599 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1734,6 +1734,11 @@ static int uvc_register_video(struct uvc_device *dev, struct video_device *vdev; int ret; + /* Initialize the video buffers queue. */ + ret = uvc_queue_init(&stream->queue, stream->type, !uvc_no_drop_param); + if (ret) + return ret; + /* Initialize the streaming interface with default streaming * parameters. */ @@ -2008,14 +2013,13 @@ static int __uvc_resume(struct usb_interface *intf, int reset) { struct uvc_device *dev = usb_get_intfdata(intf); struct uvc_streaming *stream; + int ret = 0; uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n", intf->cur_altsetting->desc.bInterfaceNumber); if (intf->cur_altsetting->desc.bInterfaceSubClass == UVC_SC_VIDEOCONTROL) { - int ret = 0; - if (reset) { ret = uvc_ctrl_restore_values(dev); if (ret < 0) @@ -2031,8 +2035,12 @@ static int __uvc_resume(struct usb_interface *intf, int reset) } list_for_each_entry(stream, &dev->streams, list) { - if (stream->intf == intf) - return uvc_video_resume(stream, reset); + if (stream->intf == intf) { + ret = uvc_video_resume(stream, reset); + if (ret < 0) + uvc_queue_enable(&stream->queue, 0); + return ret; + } } uvc_trace(UVC_TRACE_SUSPEND, "Resume: video streaming USB interface " -- cgit