The patch number 9800 was added via Andy Walls <awa...@radix.net> to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel If anyone has any objections, please let us know by sending a message to: v4l-dvb-maintai...@linuxtv.org ------ From: Andy Walls <awa...@radix.net> cx18: Eliminate q_io from stream buffer handling Eliminate q_io from stream buffer handling in anticipation of upcoming changes in buffer handling. q_io was a holdover from ivtv and it's function in cx18 was trivial and not necessary. We just push things back onto the front of q_full now, instead of maintaining a 1 buffer q_io queue. Priority: normal Signed-off-by: Andy Walls <awa...@radix.net> --- linux/drivers/media/video/cx18/cx18-driver.h | 1 linux/drivers/media/video/cx18/cx18-fileops.c | 9 +------- linux/drivers/media/video/cx18/cx18-queue.c | 10 +++++---- linux/drivers/media/video/cx18/cx18-queue.h | 19 ++++++++++++++++-- linux/drivers/media/video/cx18/cx18-streams.c | 1 5 files changed, 25 insertions(+), 15 deletions(-) diff -r 402de62fe6a6 -r 64bb638eeb28 linux/drivers/media/video/cx18/cx18-driver.h --- a/linux/drivers/media/video/cx18/cx18-driver.h Mon Dec 08 19:16:05 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-driver.h Thu Nov 27 22:04:21 2008 -0500 @@ -290,7 +290,6 @@ struct cx18_stream { /* Buffer Queues */ struct cx18_queue q_free; /* free buffers */ struct cx18_queue q_full; /* full buffers */ - struct cx18_queue q_io; /* waiting for I/O */ /* DVB / Digital Transport */ struct cx18_dvb dvb; diff -r 402de62fe6a6 -r 64bb638eeb28 linux/drivers/media/video/cx18/cx18-fileops.c --- a/linux/drivers/media/video/cx18/cx18-fileops.c Mon Dec 08 19:16:05 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-fileops.c Thu Nov 27 22:04:21 2008 -0500 @@ -233,11 +233,6 @@ static struct cx18_buffer *cx18_get_buff return buf; } - /* do we have leftover data? */ - buf = cx18_dequeue(s, &s->q_io); - if (buf) - return buf; - /* do we have new data? */ buf = cx18_dequeue(s, &s->q_full); if (buf) { @@ -413,7 +408,7 @@ static ssize_t cx18_read(struct cx18_str cx->enc_mem, 1, buf->id, s->buf_size); } else - cx18_enqueue(s, buf, &s->q_io); + cx18_push(s, buf, &s->q_full); } else if (buf->readpos == buf->bytesused) { int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; @@ -557,7 +552,7 @@ unsigned int cx18_v4l2_enc_poll(struct f CX18_DEBUG_HI_FILE("Encoder poll\n"); poll_wait(filp, &s->waitq, wait); - if (atomic_read(&s->q_full.buffers) || atomic_read(&s->q_io.buffers)) + if (atomic_read(&s->q_full.buffers)) return POLLIN | POLLRDNORM; if (eof) return POLLHUP; diff -r 402de62fe6a6 -r 64bb638eeb28 linux/drivers/media/video/cx18/cx18-queue.c --- a/linux/drivers/media/video/cx18/cx18-queue.c Mon Dec 08 19:16:05 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-queue.c Thu Nov 27 22:04:21 2008 -0500 @@ -42,8 +42,8 @@ void cx18_queue_init(struct cx18_queue * q->bytesused = 0; } -void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, - struct cx18_queue *q) +void _cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, + struct cx18_queue *q, int to_front) { /* clear the buffer if it is going to be enqueued to the free queue */ if (q == &s->q_free) { @@ -53,7 +53,10 @@ void cx18_enqueue(struct cx18_stream *s, buf->skipped = 0; } mutex_lock(&s->qlock); - list_add_tail(&buf->list, &q->list); + if (to_front) + list_add(&buf->list, &q->list); /* LIFO */ + else + list_add_tail(&buf->list, &q->list); /* FIFO */ atomic_inc(&q->buffers); q->bytesused += buf->bytesused - buf->readpos; mutex_unlock(&s->qlock); @@ -159,7 +162,6 @@ static void cx18_queue_flush(struct cx18 void cx18_flush_queues(struct cx18_stream *s) { - cx18_queue_flush(s, &s->q_io); cx18_queue_flush(s, &s->q_full); } diff -r 402de62fe6a6 -r 64bb638eeb28 linux/drivers/media/video/cx18/cx18-queue.h --- a/linux/drivers/media/video/cx18/cx18-queue.h Mon Dec 08 19:16:05 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-queue.h Thu Nov 27 22:04:21 2008 -0500 @@ -43,9 +43,24 @@ void cx18_buf_swap(struct cx18_buffer *b void cx18_buf_swap(struct cx18_buffer *buf); /* cx18_queue utility functions */ +void _cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, + struct cx18_queue *q, int to_front); + +static inline +void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, + struct cx18_queue *q) +{ + _cx18_enqueue(s, buf, q, 0); /* FIFO */ +} + +static inline +void cx18_push(struct cx18_stream *s, struct cx18_buffer *buf, + struct cx18_queue *q) +{ + _cx18_enqueue(s, buf, q, 1); /* LIFO */ +} + 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_get_buf(struct cx18_stream *s, u32 id, u32 bytesused); diff -r 402de62fe6a6 -r 64bb638eeb28 linux/drivers/media/video/cx18/cx18-streams.c --- a/linux/drivers/media/video/cx18/cx18-streams.c Mon Dec 08 19:16:05 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-streams.c Thu Nov 27 22:04:21 2008 -0500 @@ -138,7 +138,6 @@ static void cx18_stream_init(struct cx18 s->id = -1; cx18_queue_init(&s->q_free); cx18_queue_init(&s->q_full); - cx18_queue_init(&s->q_io); } static int cx18_prep_dev(struct cx18 *cx, int type) --- Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/64bb638eeb28e444e6d2cd817d8e321e7b162257 _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits