summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/uvc/uvc_queue.c
diff options
context:
space:
mode:
authorLaurent Pinchart2014-10-21 21:19:04 +0200
committerMauro Carvalho Chehab2014-11-25 11:42:01 +0100
commit0da4ab984b1753b160b5fa840ae98b87228ac3dc (patch)
tree0e729c8d972d1e6ce63f32e903b2425ff382645f /drivers/media/usb/uvc/uvc_queue.c
parent[media] uvcvideo: Rename uvc_alloc_buffers to uvc_request_buffers (diff)
downloadkernel-qcow2-linux-0da4ab984b1753b160b5fa840ae98b87228ac3dc.tar.gz
kernel-qcow2-linux-0da4ab984b1753b160b5fa840ae98b87228ac3dc.tar.xz
kernel-qcow2-linux-0da4ab984b1753b160b5fa840ae98b87228ac3dc.zip
[media] uvcvideo: Rename and split uvc_queue_enable to uvc_queue_stream(on|off)
This brings the function name in line with the V4L2 API terminology and allows removing the duplicate queue type check. 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_queue.c')
-rw-r--r--drivers/media/usb/uvc/uvc_queue.c53
1 files changed, 22 insertions, 31 deletions
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c
index 5c11de0df4b6..c295c5c719c8 100644
--- a/drivers/media/usb/uvc/uvc_queue.c
+++ b/drivers/media/usb/uvc/uvc_queue.c
@@ -263,6 +263,28 @@ int uvc_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf,
return ret;
}
+int uvc_queue_streamon(struct uvc_video_queue *queue, enum v4l2_buf_type type)
+{
+ int ret;
+
+ mutex_lock(&queue->mutex);
+ ret = vb2_streamon(&queue->queue, type);
+ mutex_unlock(&queue->mutex);
+
+ return ret;
+}
+
+int uvc_queue_streamoff(struct uvc_video_queue *queue, enum v4l2_buf_type type)
+{
+ int ret;
+
+ mutex_lock(&queue->mutex);
+ ret = vb2_streamoff(&queue->queue, type);
+ mutex_unlock(&queue->mutex);
+
+ return ret;
+}
+
int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma)
{
int ret;
@@ -318,37 +340,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
}
/*
- * Enable or disable the video buffers queue.
- *
- * The queue must be enabled before starting video acquisition and must be
- * disabled after stopping it. This ensures that the video buffers queue
- * state can be properly initialized before buffers are accessed from the
- * interrupt handler.
- *
- * Enabling the video queue returns -EBUSY if the queue is already enabled.
- *
- * Disabling the video queue cancels the queue and removes all buffers from
- * the main queue.
- *
- * This function can't be called from interrupt context. Use
- * uvc_queue_cancel() instead.
- */
-int uvc_queue_enable(struct uvc_video_queue *queue, int enable)
-{
- int ret;
-
- mutex_lock(&queue->mutex);
-
- if (enable)
- ret = vb2_streamon(&queue->queue, queue->queue.type);
- else
- ret = vb2_streamoff(&queue->queue, queue->queue.type);
-
- mutex_unlock(&queue->mutex);
- return ret;
-}
-
-/*
* Cancel the video buffers queue.
*
* Cancelling the queue marks all buffers on the irq queue as erroneous,