diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-05-09 04:43:12 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-14 09:21:59 -0300 |
commit | ceede9fa8939e40ad0ddb4ad1355f45c6f1d3478 (patch) | |
tree | 201155f368f69a4875b523f899aed80226fe8822 /drivers/media/video/pwc/pwc.h | |
parent | a67e17221429c0322e543ae4bf0b25259c3416a5 (diff) |
[media] pwc: Fix locking
My last locking rework for pwc mistakenly assumed that videbuf2 does its
own locking, but it does not! This patch fixes the missing locking by
moving over the the video_device lock, and introducing a separate lock
for the videobuf2_queue.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pwc/pwc.h')
-rw-r--r-- | drivers/media/video/pwc/pwc.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index e4d4d711dd1..d6b5b216b9d 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -221,9 +221,17 @@ struct pwc_device struct video_device vdev; struct v4l2_device v4l2_dev; - /* Pointer to our usb_device, may be NULL after unplug */ - struct usb_device *udev; - struct mutex udevlock; + /* videobuf2 queue and queued buffers list */ + struct vb2_queue vb_queue; + struct list_head queued_bufs; + spinlock_t queued_bufs_lock; /* Protects queued_bufs */ + + /* Note if taking both locks v4l2_lock must always be locked first! */ + struct mutex v4l2_lock; /* Protects everything else */ + struct mutex vb_queue_lock; /* Protects vb_queue and capt_file */ + + /* Pointer to our usb_device, will be NULL after unplug */ + struct usb_device *udev; /* Both mutexes most be hold when setting! */ /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ int type; @@ -232,7 +240,6 @@ struct pwc_device /*** Video data ***/ struct file *capt_file; /* file doing video capture */ - struct mutex capt_file_lock; int vendpoint; /* video isoc endpoint */ int vcinterface; /* video control interface */ int valternate; /* alternate interface needed */ @@ -251,12 +258,6 @@ struct pwc_device unsigned char *ctrl_buf; struct urb *urbs[MAX_ISO_BUFS]; - char iso_init; - - /* videobuf2 queue and queued buffers list */ - struct vb2_queue vb_queue; - struct list_head queued_bufs; - spinlock_t queued_bufs_lock; /* * Frame currently being filled, this only gets touched by the |