diff mbox

videobuf and streaming I/O questions

Message ID 201002141422.48362.hverkuil@xs4all.nl (mailing list archive)
State RFC
Headers show

Commit Message

Hans Verkuil Feb. 14, 2010, 1:22 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index bb0a1c8..10cb0ec 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -40,6 +40,8 @@  MODULE_LICENSE("GPL");
 	if (debug >= level) 					\
 	printk(KERN_DEBUG "vbuf: " fmt , ## arg); } while (0)
 
+static int __videobuf_streamoff(struct videobuf_queue *q);
+
 /* --------------------------------------------------------------------- */
 
 #define CALL(q, f, arg...)						\
@@ -395,11 +397,6 @@  int videobuf_reqbufs(struct videobuf_queue *q,
 	unsigned int size, count;
 	int retval;
 
-	if (req->count < 1) {
-		dprintk(1, "reqbufs: count invalid (%d)\n", req->count);
-		return -EINVAL;
-	}
-
 	if (req->memory != V4L2_MEMORY_MMAP     &&
 	    req->memory != V4L2_MEMORY_USERPTR  &&
 	    req->memory != V4L2_MEMORY_OVERLAY) {
@@ -414,6 +411,12 @@  int videobuf_reqbufs(struct videobuf_queue *q,
 		goto done;
 	}
 
+	if (req->count == 0) {
+		__videobuf_streamoff(q);
+		retval = 0;
+		goto done;
+	}
+
 	if (q->streaming) {
 		dprintk(1, "reqbufs: streaming already exists\n");
 		retval = -EBUSY;