]> Pileus Git - ~andy/linux/commitdiff
[media] stk-webcam: implement support for count == 0 when calling REQBUFS
authorHans Verkuil <hans.verkuil@cisco.com>
Sun, 10 Feb 2013 17:37:58 +0000 (14:37 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 5 Mar 2013 17:44:17 +0000 (14:44 -0300)
The spec specifies that setting count to 0 in v4l2_requestbuffers
should result in releasing any streaming resources and the stream
ownership. Implement this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/stkwebcam/stk-webcam.c

index 45d73e2f3e57a2e073635e3814a4e45db193fc48..c43c8d32be40c30e99be96d6fedd5a8fdd3832d9 100644 (file)
@@ -1046,6 +1046,13 @@ static int stk_vidioc_reqbufs(struct file *filp,
        if (is_streaming(dev)
                || (dev->owner && dev->owner != filp))
                return -EBUSY;
+       stk_free_buffers(dev);
+       if (rb->count == 0) {
+               stk_camera_write_reg(dev, 0x0, 0x49); /* turn off the LED */
+               unset_initialised(dev);
+               dev->owner = NULL;
+               return 0;
+       }
        dev->owner = filp;
 
        /*FIXME If they ask for zero, we must stop streaming and free */