summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/videobuf-core.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-26 14:52:53 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-26 14:52:53 -0300
commitb0426b9d38d42bfbcf51adbb88581be51dac0b8a (patch)
tree8fbcdd431975e8ccc43fcfdf589012a5d8a3c13e /linux/drivers/media/video/videobuf-core.c
parentae47015663cf986f5d338ede4c50f1513d7ae2e7 (diff)
downloadmediapointer-dvb-s2-b0426b9d38d42bfbcf51adbb88581be51dac0b8a.tar.gz
mediapointer-dvb-s2-b0426b9d38d42bfbcf51adbb88581be51dac0b8a.tar.bz2
videobuf-core: backport brandon's patch
From: Mauro Carvalho Chehab <mchehab@infradead.org> I and Brandon did similar patches. As Brandon patch where older, I've preserved his patch at -git. However, the patches weren't equal. kernel-sync: Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/videobuf-core.c')
-rw-r--r--linux/drivers/media/video/videobuf-core.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/linux/drivers/media/video/videobuf-core.c b/linux/drivers/media/video/videobuf-core.c
index 367f150a9..6e82dbb65 100644
--- a/linux/drivers/media/video/videobuf-core.c
+++ b/linux/drivers/media/video/videobuf-core.c
@@ -131,12 +131,12 @@ void videobuf_queue_core_init(struct videobuf_queue *q,
BUG_ON(!q->ops->buf_queue);
BUG_ON(!q->ops->buf_release);
+ /* Lock is mandatory for queue_cancel to work */
+ BUG_ON(!irqlock);
+
/* Having implementations for abstract methods are mandatory */
BUG_ON(!q->int_ops);
- /* Having irqlock is mandatory */
- BUG_ON(!q->irqlock);
-
mutex_init(&q->vb_lock);
init_waitqueue_head(&q->wait);
INIT_LIST_HEAD(&q->stream);
@@ -759,7 +759,6 @@ static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q,
spin_lock_irqsave(q->irqlock, flags);
q->ops->buf_queue(q, q->read_buf);
spin_unlock_irqrestore(q->irqlock, flags);
-
retval = videobuf_waiton(q->read_buf, 0, 0);
if (0 == retval) {
CALL(q, sync, q, q->read_buf);
@@ -820,6 +819,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q,
q->read_buf = NULL;
goto done;
}
+
spin_lock_irqsave(q->irqlock, flags);
q->ops->buf_queue(q, q->read_buf);
spin_unlock_irqrestore(q->irqlock, flags);
@@ -889,12 +889,10 @@ static int __videobuf_read_start(struct videobuf_queue *q)
return err;
list_add_tail(&q->bufs[i]->stream, &q->stream);
}
-
spin_lock_irqsave(q->irqlock, flags);
for (i = 0; i < count; i++)
q->ops->buf_queue(q, q->bufs[i]);
spin_unlock_irqrestore(q->irqlock, flags);
-
q->reading = 1;
return 0;
}
@@ -1006,11 +1004,9 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q,
if (q->read_off == q->read_buf->size) {
list_add_tail(&q->read_buf->stream,
&q->stream);
-
spin_lock_irqsave(q->irqlock, flags);
q->ops->buf_queue(q, q->read_buf);
spin_unlock_irqrestore(q->irqlock, flags);
-
q->read_buf = NULL;
}
if (retval < 0)