From: Hans Verkuil <hans.verk...@cisco.com>

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.verk...@cisco.com>
Tested-by: Arvydas Sidorenko <asi...@gmail.com>
---
 drivers/media/usb/stkwebcam/stk-webcam.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c 
b/drivers/media/usb/stkwebcam/stk-webcam.c
index 0b25448..5aeef83 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -1008,6 +1008,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 */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to