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>
        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 */