summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-11-27 22:04:21 -0500
committerAndy Walls <awalls@radix.net>2008-11-27 22:04:21 -0500
commitda0e5a7cc6dc76cf99879f3ee26a2256c67e4cde (patch)
treeca5d9d473a23457763992d05509da26093a67bbf /linux/drivers/media
parenta015d228d3c58d1377600c5a06914a06e4e6be36 (diff)
downloadmediapointer-dvb-s2-da0e5a7cc6dc76cf99879f3ee26a2256c67e4cde.tar.gz
mediapointer-dvb-s2-da0e5a7cc6dc76cf99879f3ee26a2256c67e4cde.tar.bz2
cx18: Eliminate q_io from stream buffer handling
From: Andy Walls <awalls@radix.net> 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 <awalls@radix.net>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/cx18/cx18-driver.h1
-rw-r--r--linux/drivers/media/video/cx18/cx18-fileops.c9
-rw-r--r--linux/drivers/media/video/cx18/cx18-queue.c10
-rw-r--r--linux/drivers/media/video/cx18/cx18-queue.h19
-rw-r--r--linux/drivers/media/video/cx18/cx18-streams.c1
5 files changed, 25 insertions, 15 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-driver.h b/linux/drivers/media/video/cx18/cx18-driver.h
index 94c196a91..f88d82348 100644
--- a/linux/drivers/media/video/cx18/cx18-driver.h
+++ b/linux/drivers/media/video/cx18/cx18-driver.h
@@ -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 --git a/linux/drivers/media/video/cx18/cx18-fileops.c b/linux/drivers/media/video/cx18/cx18-fileops.c
index 45b5f402e..b298faa59 100644
--- a/linux/drivers/media/video/cx18/cx18-fileops.c
+++ b/linux/drivers/media/video/cx18/cx18-fileops.c
@@ -233,11 +233,6 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block,
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_stream *s, char __user *ubuf,
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 file *filp, poll_table *wait)
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 --git a/linux/drivers/media/video/cx18/cx18-queue.c b/linux/drivers/media/video/cx18/cx18-queue.c
index 7b09c9a3e..fdfc83ee3 100644
--- a/linux/drivers/media/video/cx18/cx18-queue.c
+++ b/linux/drivers/media/video/cx18/cx18-queue.c
@@ -42,8 +42,8 @@ void cx18_queue_init(struct cx18_queue *q)
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, struct cx18_buffer *buf,
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_stream *s, struct cx18_queue *q)
void cx18_flush_queues(struct cx18_stream *s)
{
- cx18_queue_flush(s, &s->q_io);
cx18_queue_flush(s, &s->q_full);
}
diff --git a/linux/drivers/media/video/cx18/cx18-queue.h b/linux/drivers/media/video/cx18/cx18-queue.h
index ff50a2b7e..d184e55ce 100644
--- a/linux/drivers/media/video/cx18/cx18-queue.h
+++ b/linux/drivers/media/video/cx18/cx18-queue.h
@@ -43,9 +43,24 @@ static inline void cx18_buf_sync_for_device(struct cx18_stream *s,
void cx18_buf_swap(struct cx18_buffer *buf);
/* cx18_queue utility functions */
-void cx18_queue_init(struct cx18_queue *q);
+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);
+ 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);
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 --git a/linux/drivers/media/video/cx18/cx18-streams.c b/linux/drivers/media/video/cx18/cx18-streams.c
index f7a7f38d8..67d20b062 100644
--- a/linux/drivers/media/video/cx18/cx18-streams.c
+++ b/linux/drivers/media/video/cx18/cx18-streams.c
@@ -138,7 +138,6 @@ static void cx18_stream_init(struct cx18 *cx, int type)
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)