From 4e83fde765064cc2c6efa0842162165192bdd0ed Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Wed, 3 Sep 2008 16:47:50 -0300 Subject: [PATCH] --- yaml --- r: 109527 b: refs/heads/master c: 0058717a1ef0c87deeccbe0a3b17def173fee9a9 h: refs/heads/master i: 109525: a00359d02989af0cec38d74c65dfa7eb99c5d23e 109523: 9eda3d42d3b4b508c6092e83add5d77a40ae1ef2 109519: 7864b69667f9df60583a9d9413252ccf5fc3dc8e v: v3 --- [refs] | 2 +- trunk/drivers/media/video/cx18/cx18-irq.c | 2 +- trunk/drivers/media/video/cx18/cx18-queue.c | 23 ++++++++++++--------- trunk/drivers/media/video/cx18/cx18-queue.h | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 465030a5430d..e17331fd4c24 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 46f2c21cfdb1a829a9a23e23562ffa66b007dc48 +refs/heads/master: 0058717a1ef0c87deeccbe0a3b17def173fee9a9 diff --git a/trunk/drivers/media/video/cx18/cx18-irq.c b/trunk/drivers/media/video/cx18/cx18-irq.c index 25114a5cbd57..ab218315c84b 100644 --- a/trunk/drivers/media/video/cx18/cx18-irq.c +++ b/trunk/drivers/media/video/cx18/cx18-irq.c @@ -61,7 +61,7 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_mailbox *mb) CX18_WARN("Ack struct = %d for %s\n", mb->args[2], s->name); id = read_enc(off); - buf = cx18_queue_find_buf(s, id, read_enc(off + 4)); + buf = cx18_queue_get_buf_irq(s, id, read_enc(off + 4)); CX18_DEBUG_HI_DMA("DMA DONE for %s (buffer %d)\n", s->name, id); if (buf) { cx18_buf_sync_for_cpu(s, buf); diff --git a/trunk/drivers/media/video/cx18/cx18-queue.c b/trunk/drivers/media/video/cx18/cx18-queue.c index 6990b77c6200..8a4dd821fd91 100644 --- a/trunk/drivers/media/video/cx18/cx18-queue.c +++ b/trunk/drivers/media/video/cx18/cx18-queue.c @@ -78,12 +78,13 @@ struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q) return buf; } -struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, +struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id, u32 bytesused) { struct cx18 *cx = s->cx; struct list_head *p; + spin_lock(&s->qlock); list_for_each(p, &s->q_free.list) { struct cx18_buffer *buf = list_entry(p, struct cx18_buffer, list); @@ -92,17 +93,19 @@ struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, continue; buf->bytesused = bytesused; /* the transport buffers are handled differently, - so there is no need to move them to the full queue */ - if (s->type == CX18_ENC_STREAM_TYPE_TS) - return buf; - s->q_free.buffers--; - s->q_free.length -= s->buf_size; - s->q_full.buffers++; - s->q_full.length += s->buf_size; - s->q_full.bytesused += buf->bytesused; - list_move_tail(&buf->list, &s->q_full.list); + they are not moved to the full queue */ + if (s->type != CX18_ENC_STREAM_TYPE_TS) { + s->q_free.buffers--; + s->q_free.length -= s->buf_size; + s->q_full.buffers++; + s->q_full.length += s->buf_size; + s->q_full.bytesused += buf->bytesused; + list_move_tail(&buf->list, &s->q_full.list); + } + spin_unlock(&s->qlock); return buf; } + spin_unlock(&s->qlock); CX18_ERR("Cannot find buffer %d for stream %s\n", id, s->name); return NULL; } diff --git a/trunk/drivers/media/video/cx18/cx18-queue.h b/trunk/drivers/media/video/cx18/cx18-queue.h index 91423b9863a4..7f93bb13c09f 100644 --- a/trunk/drivers/media/video/cx18/cx18-queue.h +++ b/trunk/drivers/media/video/cx18/cx18-queue.h @@ -46,7 +46,7 @@ void cx18_queue_init(struct cx18_queue *q); void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, struct cx18_queue *q); struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); -struct cx18_buffer *cx18_queue_find_buf(struct cx18_stream *s, u32 id, +struct cx18_buffer *cx18_queue_get_buf_irq(struct cx18_stream *s, u32 id, u32 bytesused); void cx18_flush_queues(struct cx18_stream *s);