diff options
author | Andy Walls <awalls@radix.net> | 2008-12-14 19:05:36 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:39:08 -0500 |
commit | f6b181ac3bda7aab227e9ee3148bc9b7f1889c57 (patch) | |
tree | 1d4c3d1e0f4b17d469af7c46141b45f41853c2d2 /drivers/media/video/cx18/cx18-queue.c | |
parent | aafc77066f4cc8b6de4af1a7d643c9646e19bad9 (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/cx18-queue.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-queue.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c index 2c58b0c478c0..8d9441e88c4e 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 | } |