aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-09-26 07:47:38 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-20 23:06:14 -0400
commitee6869afc922a9849979e49bb3bbcad794872fcb (patch)
tree2266050d01da694d04b533a6509873888327108b /include/media
parentc29fcff3daafbf46d64a543c1950bbd206ad8c1c (diff)
V4L/DVB: v4l2: add core serialization lock
Drivers can optionally set a pointer to a mutex in struct video_device. The core will use that to lock before calling open, read, write, unlocked_ioctl, poll, mmap or release. Updated the documentation as well and ensure that v4l2-event knows about the lock: it will unlock it before doing a blocking wait on an event and relock it afterwards. Ensure that the 'video_is_registered' check is done when the lock is held: a typical disconnect will take the lock as well before unregistering the device nodes, so to prevent race conditions the video_is_registered check should also be done with the lock held. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-dev.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index ba236ff35c8a..15802a067a12 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -94,6 +94,9 @@ struct video_device
94 94
95 /* ioctl callbacks */ 95 /* ioctl callbacks */
96 const struct v4l2_ioctl_ops *ioctl_ops; 96 const struct v4l2_ioctl_ops *ioctl_ops;
97
98 /* serialization lock */
99 struct mutex *lock;
97}; 100};
98 101
99/* dev to video-device */ 102/* dev to video-device */