diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-09-20 16:24:30 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:06:14 -0400 |
commit | 97397687886aa8ecd4ec603fab9e70e970c11597 (patch) | |
tree | 339d460b43d2ec7206c9d147d2ad6f8fcbfa3870 /include/media | |
parent | ee6869afc922a9849979e49bb3bbcad794872fcb (diff) |
V4L/DVB: videobuf: prepare to make locking optional in videobuf
Currently videobuf uses the vb_lock mutex to lock its data structures.
But this locking will (optionally) move into the v4l2 core, which means
that in that case vb_lock shouldn't be used since the external lock is already
held.
Prepare for this by adding a pointer to such an external mutex and
don't lock if that pointer is set.
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/videobuf-core.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index f2c41cebf453..f5eb2cbf3002 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h | |||
@@ -139,6 +139,7 @@ struct videobuf_qtype_ops { | |||
139 | 139 | ||
140 | struct videobuf_queue { | 140 | struct videobuf_queue { |
141 | struct mutex vb_lock; | 141 | struct mutex vb_lock; |
142 | struct mutex *ext_lock; | ||
142 | spinlock_t *irqlock; | 143 | spinlock_t *irqlock; |
143 | struct device *dev; | 144 | struct device *dev; |
144 | 145 | ||
@@ -167,6 +168,18 @@ struct videobuf_queue { | |||
167 | void *priv_data; | 168 | void *priv_data; |
168 | }; | 169 | }; |
169 | 170 | ||
171 | static inline void videobuf_queue_lock(struct videobuf_queue *q) | ||
172 | { | ||
173 | if (!q->ext_lock) | ||
174 | mutex_lock(&q->vb_lock); | ||
175 | } | ||
176 | |||
177 | static inline void videobuf_queue_unlock(struct videobuf_queue *q) | ||
178 | { | ||
179 | if (!q->ext_lock) | ||
180 | mutex_unlock(&q->vb_lock); | ||
181 | } | ||
182 | |||
170 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); | 183 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); |
171 | int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, | 184 | int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, |
172 | struct v4l2_framebuffer *fbuf); | 185 | struct v4l2_framebuffer *fbuf); |