diff options
author | Andy Walls <awalls@radix.net> | 2009-11-11 00:57:16 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 18:41:53 -0200 |
commit | ad689d54f979233c024c25a2221f4fd6f56543fe (patch) | |
tree | d28f3cb3958b387362c562c83ae5966e0a8874d9 | |
parent | 127ce5f0adcca71eeeed2386ed4742ea6363a063 (diff) |
V4L/DVB (13433): cx18: Remove duplicate list traversal when processing incoming MDLs
Update the incoming MDL's buffers' bytesused and sync the buffers for the cpu
in one pass instead of two.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/cx18/cx18-queue.c | 27 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-queue.h | 13 |
2 files changed, 8 insertions, 32 deletions
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c index f2d539f6bdf..63304823cef 100644 --- a/drivers/media/video/cx18/cx18-queue.c +++ b/drivers/media/video/cx18/cx18-queue.c @@ -100,8 +100,8 @@ struct cx18_mdl *cx18_dequeue(struct cx18_stream *s, struct cx18_queue *q) return mdl; } -static void _cx18_mdl_set_buf_bytesused(struct cx18_stream *s, - struct cx18_mdl *mdl) +static void _cx18_mdl_update_bufs_for_cpu(struct cx18_stream *s, + struct cx18_mdl *mdl) { struct cx18_buffer *buf; u32 buf_size = s->buf_size; @@ -116,11 +116,12 @@ static void _cx18_mdl_set_buf_bytesused(struct cx18_stream *s, buf->bytesused = bytesused; bytesused = 0; } + cx18_buf_sync_for_cpu(s, buf); } } -static inline void cx18_mdl_set_buf_bytesused(struct cx18_stream *s, - struct cx18_mdl *mdl) +static inline void cx18_mdl_update_bufs_for_cpu(struct cx18_stream *s, + struct cx18_mdl *mdl) { struct cx18_buffer *buf; @@ -129,8 +130,9 @@ static inline void cx18_mdl_set_buf_bytesused(struct cx18_stream *s, list); buf->bytesused = mdl->bytesused; buf->readpos = 0; + cx18_buf_sync_for_cpu(s, buf); } else { - _cx18_mdl_set_buf_bytesused(s, mdl); + _cx18_mdl_update_bufs_for_cpu(s, mdl); } } @@ -191,8 +193,7 @@ struct cx18_mdl *cx18_queue_get_mdl(struct cx18_stream *s, u32 id, ret->bytesused = bytesused; ret->skipped = 0; /* 0'ed readpos, m_flags & curr_buf when mdl went on q_busy */ - cx18_mdl_set_buf_bytesused(s, ret); - cx18_mdl_sync_for_cpu(s, ret); + cx18_mdl_update_bufs_for_cpu(s, ret); if (s->type != CX18_ENC_STREAM_TYPE_TS) set_bit(CX18_F_M_NEED_SWAP, &ret->m_flags); } @@ -331,18 +332,6 @@ void cx18_load_queues(struct cx18_stream *s) } } -void _cx18_mdl_sync_for_cpu(struct cx18_stream *s, struct cx18_mdl *mdl) -{ - int dma = s->dma; - u32 buf_size = s->buf_size; - struct pci_dev *pci_dev = s->cx->pci_dev; - struct cx18_buffer *buf; - - list_for_each_entry(buf, &mdl->buf_list, list) - pci_dma_sync_single_for_cpu(pci_dev, buf->dma_handle, - buf_size, dma); -} - void _cx18_mdl_sync_for_device(struct cx18_stream *s, struct cx18_mdl *mdl) { int dma = s->dma; diff --git a/drivers/media/video/cx18/cx18-queue.h b/drivers/media/video/cx18/cx18-queue.h index 96747e5e7c3..88a6d34ad3b 100644 --- a/drivers/media/video/cx18/cx18-queue.h +++ b/drivers/media/video/cx18/cx18-queue.h @@ -33,19 +33,6 @@ static inline void cx18_buf_sync_for_cpu(struct cx18_stream *s, s->buf_size, s->dma); } -void _cx18_mdl_sync_for_cpu(struct cx18_stream *s, struct cx18_mdl *mdl); - -static inline void cx18_mdl_sync_for_cpu(struct cx18_stream *s, - struct cx18_mdl *mdl) -{ - if (list_is_singular(&mdl->buf_list)) - cx18_buf_sync_for_cpu(s, list_first_entry(&mdl->buf_list, - struct cx18_buffer, - list)); - else - _cx18_mdl_sync_for_cpu(s, mdl); -} - static inline void cx18_buf_sync_for_device(struct cx18_stream *s, struct cx18_buffer *buf) { |