diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-02-10 17:37:58 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-05 17:44:17 (GMT) |
commit | 9776e17189d33b0ac9235597460d6a22cf1bc6a7 (patch) | |
tree | cbb7255e0bc5f361aa7e6f0ddd64d9e721e72d1c | |
parent | f81e372a5d11694b86fc35ded379a441c209b920 (diff) | |
download | linux-9776e17189d33b0ac9235597460d6a22cf1bc6a7.tar.xz |
[media] stk-webcam: implement support for count == 0 when calling REQBUFS
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>
-rw-r--r-- | drivers/media/usb/stkwebcam/stk-webcam.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index 45d73e2..c43c8d3 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -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 */ |