aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-13 15:06:52 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 14:08:48 -0300
commitcb7847249f1b2bad201e38c770ef4401c61c022a (patch)
tree372baa44f45122263ace9ad12211eec4107c932e
parent5e28e00964cdc90dec5ebb4c00dfa2fc1ecf36fa (diff)
V4L/DVB (7559): em28xx: Fills the entire buffer, before getting another one
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 064728f6774..db3bbacb3a7 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -137,6 +137,8 @@ static inline void buffer_filled(struct em28xx *dev,
buf->vb.field_count++;
do_gettimeofday(&buf->vb.ts);
+ dev->isoc_ctl.buf = NULL;
+
list_del(&buf->vb.queue);
wake_up(&buf->vb.done);
}
@@ -269,6 +271,11 @@ static inline int get_next_buf(struct em28xx_dmaqueue *dma_q,
{
struct em28xx *dev = container_of(dma_q, struct em28xx, vidq);
+ /* If the previous buffer were not filled yet, continue */
+ *buf = dev->isoc_ctl.buf;
+ if (*buf)
+ return 1;
+
if (list_empty(&dma_q->active)) {
em28xx_isocdbg("No active queue to serve\n");
return 0;
@@ -276,6 +283,9 @@ static inline int get_next_buf(struct em28xx_dmaqueue *dma_q,
*buf = list_entry(dma_q->active.next, struct em28xx_buffer, vb.queue);
+
+ dev->isoc_ctl.buf = *buf;
+
return 1;
}
@@ -303,13 +313,9 @@ static inline int em28xx_isoc_copy(struct urb *urb)
return 0;
}
- buf = dev->isoc_ctl.buf;
-
- if (!buf) {
- rc = get_next_buf(dma_q, &buf);
- if (rc <= 0)
- return rc;
- }
+ rc = get_next_buf(dma_q, &buf);
+ if (rc <= 0)
+ return rc;
outp = videobuf_to_vmalloc(&buf->vb);
@@ -351,7 +357,6 @@ static inline int em28xx_isoc_copy(struct urb *urb)
rc = get_next_buf(dma_q, &buf);
if (rc <= 0)
return rc;
-
outp = videobuf_to_vmalloc(&buf->vb);
}
@@ -416,7 +421,6 @@ static void em28xx_uninit_isoc(struct em28xx *dev)
em28xx_isocdbg("em28xx: called em28xx_uninit_isoc\n");
dev->isoc_ctl.nfields = -1;
- dev->isoc_ctl.buf = NULL;
for (i = 0; i < dev->isoc_ctl.num_bufs; i++) {
urb = dev->isoc_ctl.urb[i];
if (urb) {
@@ -478,6 +482,7 @@ static int em28xx_prepare_isoc(struct em28xx *dev, int max_packets,
}
dev->isoc_ctl.max_pkt_size = dev->max_pkt_size;
+ dev->isoc_ctl.buf = NULL;
sb_size = max_packets * dev->isoc_ctl.max_pkt_size;