aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-12-14 19:05:36 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:39:08 -0500
commitf6b181ac3bda7aab227e9ee3148bc9b7f1889c57 (patch)
tree1d4c3d1e0f4b17d469af7c46141b45f41853c2d2 /drivers/media/video/cx18
parentaafc77066f4cc8b6de4af1a7d643c9646e19bad9 (diff)
V4L/DVB (9893): cx18: Convert some list manipulations to emphasize entries not lists
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r--drivers/media/video/cx18/cx18-queue.c14
-rw-r--r--drivers/media/video/cx18/cx18-streams.c4
2 files changed, 7 insertions, 11 deletions
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c
index 2c58b0c478c..8d9441e88c4 100644
--- a/drivers/media/video/cx18/cx18-queue.c
+++ b/drivers/media/video/cx18/cx18-queue.c
@@ -77,8 +77,8 @@ struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q)
77 77
78 mutex_lock(&s->qlock); 78 mutex_lock(&s->qlock);
79 if (!list_empty(&q->list)) { 79 if (!list_empty(&q->list)) {
80 buf = list_entry(q->list.next, struct cx18_buffer, list); 80 buf = list_first_entry(&q->list, struct cx18_buffer, list);
81 list_del_init(q->list.next); 81 list_del_init(&buf->list);
82 q->bytesused -= buf->bytesused - buf->readpos; 82 q->bytesused -= buf->bytesused - buf->readpos;
83 buf->skipped = 0; 83 buf->skipped = 0;
84 atomic_dec(&q->buffers); 84 atomic_dec(&q->buffers);
@@ -92,13 +92,11 @@ struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id,
92{ 92{
93 struct cx18 *cx = s->cx; 93 struct cx18 *cx = s->cx;
94 struct cx18_buffer *buf; 94 struct cx18_buffer *buf;
95 struct cx18_buffer *tmp;
95 struct cx18_buffer *ret = NULL; 96 struct cx18_buffer *ret = NULL;
96 struct list_head *p, *t;
97 97
98 mutex_lock(&s->qlock); 98 mutex_lock(&s->qlock);
99 list_for_each_safe(p, t, &s->q_busy.list) { 99 list_for_each_entry_safe(buf, tmp, &s->q_busy.list, list) {
100 buf = list_entry(p, struct cx18_buffer, list);
101
102 if (buf->id != id) { 100 if (buf->id != id) {
103 buf->skipped++; 101 buf->skipped++;
104 if (buf->skipped >= atomic_read(&s->q_busy.buffers)-1) { 102 if (buf->skipped >= atomic_read(&s->q_busy.buffers)-1) {
@@ -152,8 +150,8 @@ static void cx18_queue_flush(struct cx18_stream *s, struct cx18_queue *q)
152 150
153 mutex_lock(&s->qlock); 151 mutex_lock(&s->qlock);
154 while (!list_empty(&q->list)) { 152 while (!list_empty(&q->list)) {
155 buf = list_entry(q->list.next, struct cx18_buffer, list); 153 buf = list_first_entry(&q->list, struct cx18_buffer, list);
156 list_move_tail(q->list.next, &s->q_free.list); 154 list_move_tail(&buf->list, &s->q_free.list);
157 buf->bytesused = buf->readpos = buf->b_flags = buf->skipped = 0; 155 buf->bytesused = buf->readpos = buf->b_flags = buf->skipped = 0;
158 atomic_inc(&s->q_free.buffers); 156 atomic_inc(&s->q_free.buffers);
159 } 157 }
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 8fc655d3ced..600a5fcac3d 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -442,7 +442,6 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
442{ 442{
443 u32 data[MAX_MB_ARGUMENTS]; 443 u32 data[MAX_MB_ARGUMENTS];
444 struct cx18 *cx = s->cx; 444 struct cx18 *cx = s->cx;
445 struct list_head *p;
446 struct cx18_buffer *buf; 445 struct cx18_buffer *buf;
447 int ts = 0; 446 int ts = 0;
448 int captype = 0; 447 int captype = 0;
@@ -529,8 +528,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
529 /* Init all the cpu_mdls for this stream */ 528 /* Init all the cpu_mdls for this stream */
530 cx18_flush_queues(s); 529 cx18_flush_queues(s);
531 mutex_lock(&s->qlock); 530 mutex_lock(&s->qlock);
532 list_for_each(p, &s->q_free.list) { 531 list_for_each_entry(buf, &s->q_free.list, list) {
533 buf = list_entry(p, struct cx18_buffer, list);
534 cx18_writel(cx, buf->dma_handle, 532 cx18_writel(cx, buf->dma_handle,
535 &cx->scb->cpu_mdl[buf->id].paddr); 533 &cx->scb->cpu_mdl[buf->id].paddr);
536 cx18_writel(cx, s->buf_size, &cx->scb->cpu_mdl[buf->id].length); 534 cx18_writel(cx, s->buf_size, &cx->scb->cpu_mdl[buf->id].length);