diff options
author | Andy Walls <awalls@radix.net> | 2008-11-27 22:04:21 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:38:28 -0500 |
commit | b80e1074c734416987486b7b76b6479faa73f1e2 (patch) | |
tree | 4f1432c4755b9aa686dd8764a24e404eaa3a550e /drivers | |
parent | be2c6db122467c6b6b55d93dd08d89cb2ee7821c (diff) |
V4L/DVB (9800): 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.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/cx18/cx18-driver.h | 1 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-fileops.c | 9 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-queue.c | 10 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-queue.h | 19 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-streams.c | 1 |
5 files changed, 25 insertions, 15 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index 94c196a91295..f88d82348293 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h | |||
@@ -290,7 +290,6 @@ struct cx18_stream { | |||
290 | /* Buffer Queues */ | 290 | /* Buffer Queues */ |
291 | struct cx18_queue q_free; /* free buffers */ | 291 | struct cx18_queue q_free; /* free buffers */ |
292 | struct cx18_queue q_full; /* full buffers */ | 292 | struct cx18_queue q_full; /* full buffers */ |
293 | struct cx18_queue q_io; /* waiting for I/O */ | ||
294 | 293 | ||
295 | /* DVB / Digital Transport */ | 294 | /* DVB / Digital Transport */ |
296 | struct cx18_dvb dvb; | 295 | struct cx18_dvb dvb; |
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c index 2c8117510fb4..504a1f9edec6 100644 --- a/drivers/media/video/cx18/cx18-fileops.c +++ b/drivers/media/video/cx18/cx18-fileops.c | |||
@@ -195,11 +195,6 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block, | |||
195 | return buf; | 195 | return buf; |
196 | } | 196 | } |
197 | 197 | ||
198 | /* do we have leftover data? */ | ||
199 | buf = cx18_dequeue(s, &s->q_io); | ||
200 | if (buf) | ||
201 | return buf; | ||
202 | |||
203 | /* do we have new data? */ | 198 | /* do we have new data? */ |
204 | buf = cx18_dequeue(s, &s->q_full); | 199 | buf = cx18_dequeue(s, &s->q_full); |
205 | if (buf) { | 200 | if (buf) { |
@@ -375,7 +370,7 @@ static ssize_t cx18_read(struct cx18_stream *s, char __user *ubuf, | |||
375 | cx->enc_mem, | 370 | cx->enc_mem, |
376 | 1, buf->id, s->buf_size); | 371 | 1, buf->id, s->buf_size); |
377 | } else | 372 | } else |
378 | cx18_enqueue(s, buf, &s->q_io); | 373 | cx18_push(s, buf, &s->q_full); |
379 | } else if (buf->readpos == buf->bytesused) { | 374 | } else if (buf->readpos == buf->bytesused) { |
380 | int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; | 375 | int idx = cx->vbi.inserted_frame % CX18_VBI_FRAMES; |
381 | 376 | ||
@@ -519,7 +514,7 @@ unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait) | |||
519 | CX18_DEBUG_HI_FILE("Encoder poll\n"); | 514 | CX18_DEBUG_HI_FILE("Encoder poll\n"); |
520 | poll_wait(filp, &s->waitq, wait); | 515 | poll_wait(filp, &s->waitq, wait); |
521 | 516 | ||
522 | if (atomic_read(&s->q_full.buffers) || atomic_read(&s->q_io.buffers)) | 517 | if (atomic_read(&s->q_full.buffers)) |
523 | return POLLIN | POLLRDNORM; | 518 | return POLLIN | POLLRDNORM; |
524 | if (eof) | 519 | if (eof) |
525 | return POLLHUP; | 520 | return POLLHUP; |
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c index 7b09c9a3ee8f..fdfc83ee3d4e 100644 --- a/drivers/media/video/cx18/cx18-queue.c +++ b/drivers/media/video/cx18/cx18-queue.c | |||
@@ -42,8 +42,8 @@ void cx18_queue_init(struct cx18_queue *q) | |||
42 | q->bytesused = 0; | 42 | q->bytesused = 0; |
43 | } | 43 | } |
44 | 44 | ||
45 | void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, | 45 | void _cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, |
46 | struct cx18_queue *q) | 46 | struct cx18_queue *q, int to_front) |
47 | { | 47 | { |
48 | /* clear the buffer if it is going to be enqueued to the free queue */ | 48 | /* clear the buffer if it is going to be enqueued to the free queue */ |
49 | if (q == &s->q_free) { | 49 | if (q == &s->q_free) { |
@@ -53,7 +53,10 @@ void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, | |||
53 | buf->skipped = 0; | 53 | buf->skipped = 0; |
54 | } | 54 | } |
55 | mutex_lock(&s->qlock); | 55 | mutex_lock(&s->qlock); |
56 | list_add_tail(&buf->list, &q->list); | 56 | if (to_front) |
57 | list_add(&buf->list, &q->list); /* LIFO */ | ||
58 | else | ||
59 | list_add_tail(&buf->list, &q->list); /* FIFO */ | ||
57 | atomic_inc(&q->buffers); | 60 | atomic_inc(&q->buffers); |
58 | q->bytesused += buf->bytesused - buf->readpos; | 61 | q->bytesused += buf->bytesused - buf->readpos; |
59 | mutex_unlock(&s->qlock); | 62 | mutex_unlock(&s->qlock); |
@@ -159,7 +162,6 @@ static void cx18_queue_flush(struct cx18_stream *s, struct cx18_queue *q) | |||
159 | 162 | ||
160 | void cx18_flush_queues(struct cx18_stream *s) | 163 | void cx18_flush_queues(struct cx18_stream *s) |
161 | { | 164 | { |
162 | cx18_queue_flush(s, &s->q_io); | ||
163 | cx18_queue_flush(s, &s->q_full); | 165 | cx18_queue_flush(s, &s->q_full); |
164 | } | 166 | } |
165 | 167 | ||
diff --git a/drivers/media/video/cx18/cx18-queue.h b/drivers/media/video/cx18/cx18-queue.h index ff50a2b7e5bc..d184e55ce624 100644 --- a/drivers/media/video/cx18/cx18-queue.h +++ b/drivers/media/video/cx18/cx18-queue.h | |||
@@ -43,9 +43,24 @@ static inline void cx18_buf_sync_for_device(struct cx18_stream *s, | |||
43 | void cx18_buf_swap(struct cx18_buffer *buf); | 43 | void cx18_buf_swap(struct cx18_buffer *buf); |
44 | 44 | ||
45 | /* cx18_queue utility functions */ | 45 | /* cx18_queue utility functions */ |
46 | void cx18_queue_init(struct cx18_queue *q); | 46 | void _cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, |
47 | struct cx18_queue *q, int to_front); | ||
48 | |||
49 | static inline | ||
47 | void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, | 50 | void cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf, |
48 | struct cx18_queue *q); | 51 | struct cx18_queue *q) |
52 | { | ||
53 | _cx18_enqueue(s, buf, q, 0); /* FIFO */ | ||
54 | } | ||
55 | |||
56 | static inline | ||
57 | void cx18_push(struct cx18_stream *s, struct cx18_buffer *buf, | ||
58 | struct cx18_queue *q) | ||
59 | { | ||
60 | _cx18_enqueue(s, buf, q, 1); /* LIFO */ | ||
61 | } | ||
62 | |||
63 | void cx18_queue_init(struct cx18_queue *q); | ||
49 | struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); | 64 | struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q); |
50 | struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id, | 65 | struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id, |
51 | u32 bytesused); | 66 | u32 bytesused); |
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 8c8e92b20c7b..a1cf434f7975 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -138,7 +138,6 @@ static void cx18_stream_init(struct cx18 *cx, int type) | |||
138 | s->id = -1; | 138 | s->id = -1; |
139 | cx18_queue_init(&s->q_free); | 139 | cx18_queue_init(&s->q_free); |
140 | cx18_queue_init(&s->q_full); | 140 | cx18_queue_init(&s->q_full); |
141 | cx18_queue_init(&s->q_io); | ||
142 | } | 141 | } |
143 | 142 | ||
144 | static int cx18_prep_dev(struct cx18 *cx, int type) | 143 | static int cx18_prep_dev(struct cx18 *cx, int type) |