diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-02-17 11:44:06 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-03-02 23:05:23 +0300 |
commit | d8e96c4bf6e3cdb6580381fdad2bfd93fae36ff1 (patch) | |
tree | 33cda874ad792de10143f65311dce360f4244260 /drivers/usb/gadget/function/uvc_v4l2.c | |
parent | 2e1328dd5a8fd1fa98bf8fca49c5e6df61797a99 (diff) | |
download | linux-d8e96c4bf6e3cdb6580381fdad2bfd93fae36ff1.tar.xz |
[media] uvc gadget: switch to v4l2 core locking
Switch this driver over to the V4L2 core locking mechanism in preparation
for switching to unlocked_ioctl. Suggested by Laurent Pinchart.
This patch introduces a new mutex at the struct uvc_video level and
drops the old mutex at the queue level. The new lock is now used for all
ioctl locking and in the release file operation (the driver always has
to take care of locking in file operations, the core only serializes
ioctls).
Note that the mmap and get_unmapped_area file operations no longer take
a lock. Commit f035eb4e976ef5a059e30bc91cfd310ff030a7d3 fixed a AB-BA
deadlock by moving all the locking down into vb2, so the mmap and
get_unmapped_area file operations should no longer do any locking before
calling into vb2.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/usb/gadget/function/uvc_v4l2.c')
-rw-r--r-- | drivers/usb/gadget/function/uvc_v4l2.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c index 5aad7fededa5..0bd696510cf8 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -14,7 +14,6 @@ #include <linux/device.h> #include <linux/errno.h> #include <linux/list.h> -#include <linux/mutex.h> #include <linux/videodev2.h> #include <linux/vmalloc.h> #include <linux/wait.h> @@ -311,8 +310,10 @@ uvc_v4l2_release(struct file *file) uvc_function_disconnect(uvc); + mutex_lock(&video->mutex); uvcg_video_enable(video, 0); uvcg_free_buffers(&video->queue); + mutex_unlock(&video->mutex); file->private_data = NULL; v4l2_fh_del(&handle->vfh); |