Skip to content

Commit

Permalink
V4L/DVB (13427): cx18: Rename struct cx18_queue.buffers to struct cx1…
Browse files Browse the repository at this point in the history
…8_queue.depth

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Andy Walls authored and Mauro Carvalho Chehab committed Dec 5, 2009
1 parent f0076e6 commit c37b11b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion drivers/media/video/cx18/cx18-driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ struct cx18_buffer {

struct cx18_queue {
struct list_head list;
atomic_t buffers;
atomic_t depth;
u32 bytesused;
spinlock_t lock;
};
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/cx18/cx18-fileops.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static struct cx18_buffer *cx18_get_buffer(struct cx18_stream *s, int non_block,
prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE);
/* New buffers might have become available before we were added
to the waitqueue */
if (!atomic_read(&s->q_full.buffers))
if (!atomic_read(&s->q_full.depth))
schedule();
finish_wait(&s->waitq, &wait);
if (signal_pending(current)) {
Expand Down Expand Up @@ -543,7 +543,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))
if (atomic_read(&s->q_full.depth))
return POLLIN | POLLRDNORM;
if (eof)
return POLLHUP;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/cx18/cx18-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ static int cx18_log_status(struct file *file, void *fh)
continue;
CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n",
s->name, s->s_flags,
atomic_read(&s->q_full.buffers) * 100 / s->buffers,
atomic_read(&s->q_full.depth) * 100 / s->buffers,
(s->buffers * s->buf_size) / 1024, s->buffers);
}
CX18_INFO("Read MPEG/VBI: %lld/%lld bytes\n",
Expand Down
16 changes: 8 additions & 8 deletions drivers/media/video/cx18/cx18-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void cx18_buf_swap(struct cx18_buffer *buf)
void cx18_queue_init(struct cx18_queue *q)
{
INIT_LIST_HEAD(&q->list);
atomic_set(&q->buffers, 0);
atomic_set(&q->depth, 0);
q->bytesused = 0;
}

Expand All @@ -55,7 +55,7 @@ struct cx18_queue *_cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf,

/* q_busy is restricted to a max buffer count imposed by firmware */
if (q == &s->q_busy &&
atomic_read(&q->buffers) >= CX18_MAX_FW_MDLS_PER_STREAM)
atomic_read(&q->depth) >= CX18_MAX_FW_MDLS_PER_STREAM)
q = &s->q_free;

spin_lock(&q->lock);
Expand All @@ -65,7 +65,7 @@ struct cx18_queue *_cx18_enqueue(struct cx18_stream *s, struct cx18_buffer *buf,
else
list_add_tail(&buf->list, &q->list); /* FIFO */
q->bytesused += buf->bytesused - buf->readpos;
atomic_inc(&q->buffers);
atomic_inc(&q->depth);

spin_unlock(&q->lock);
return q;
Expand All @@ -81,7 +81,7 @@ struct cx18_buffer *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q)
list_del_init(&buf->list);
q->bytesused -= buf->bytesused - buf->readpos;
buf->skipped = 0;
atomic_dec(&q->buffers);
atomic_dec(&q->depth);
}
spin_unlock(&q->lock);
return buf;
Expand Down Expand Up @@ -113,15 +113,15 @@ struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id,
*/
if (buf->id != id) {
buf->skipped++;
if (buf->skipped >= atomic_read(&s->q_busy.buffers)-1) {
if (buf->skipped >= atomic_read(&s->q_busy.depth)-1) {
/* buffer must have fallen out of rotation */
CX18_WARN("Skipped %s, buffer %d, %d "
"times - it must have dropped out of "
"rotation\n", s->name, buf->id,
buf->skipped);
/* Sweep it up to put it back into rotation */
list_move_tail(&buf->list, &sweep_up);
atomic_dec(&s->q_busy.buffers);
atomic_dec(&s->q_busy.depth);
}
continue;
}
Expand All @@ -130,7 +130,7 @@ struct cx18_buffer *cx18_queue_get_buf(struct cx18_stream *s, u32 id,
* will have to put it back on a queue later.
*/
list_del_init(&buf->list);
atomic_dec(&s->q_busy.buffers);
atomic_dec(&s->q_busy.depth);
ret = buf;
break;
}
Expand Down Expand Up @@ -170,7 +170,7 @@ static void cx18_queue_flush(struct cx18_stream *s, struct cx18_queue *q)
buf = list_first_entry(&q->list, struct cx18_buffer, list);
list_move_tail(&buf->list, &s->q_free.list);
buf->bytesused = buf->readpos = buf->b_flags = buf->skipped = 0;
atomic_inc(&s->q_free.buffers);
atomic_inc(&s->q_free.depth);
}
cx18_queue_init(q);
spin_unlock(&q->lock);
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/cx18/cx18-streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ void _cx18_stream_load_fw_queue(struct cx18_stream *s)
struct cx18_queue *q;
struct cx18_buffer *buf;

if (atomic_read(&s->q_free.buffers) == 0 ||
atomic_read(&s->q_busy.buffers) >= CX18_MAX_FW_MDLS_PER_STREAM)
if (atomic_read(&s->q_free.depth) == 0 ||
atomic_read(&s->q_busy.depth) >= CX18_MAX_FW_MDLS_PER_STREAM)
return;

/* Move from q_free to q_busy notifying the firmware, until the limit */
Expand All @@ -480,7 +480,7 @@ void _cx18_stream_load_fw_queue(struct cx18_stream *s)
if (buf == NULL)
break;
q = _cx18_stream_put_buf_fw(s, buf);
} while (atomic_read(&s->q_busy.buffers) < CX18_MAX_FW_MDLS_PER_STREAM
} while (atomic_read(&s->q_busy.depth) < CX18_MAX_FW_MDLS_PER_STREAM
&& q == &s->q_busy);
}

Expand Down

0 comments on commit c37b11b

Please sign in to comment.