aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-13 14:06:52 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:08:48 -0400
commitcb7847249f1b2bad201e38c770ef4401c61c022a (patch)
tree372baa44f45122263ace9ad12211eec4107c932e /drivers/media/video/em28xx/em28xx-video.c
parent5e28e00964cdc90dec5ebb4c00dfa2fc1ecf36fa (diff)
V4L/DVB (7559): em28xx: Fills the entire buffer, before getting another one
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-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 064728f67740..db3bbacb3a77 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,
137 buf->vb.field_count++; 137 buf->vb.field_count++;
138 do_gettimeofday(&buf->vb.ts); 138 do_gettimeofday(&buf->vb.ts);
139 139
140 dev->isoc_ctl.buf = NULL;
141
140 list_del(&buf->vb.queue); 142 list_del(&buf->vb.queue);
141 wake_up(&buf->vb.done); 143 wake_up(&buf->vb.done);
142} 144}
@@ -269,6 +271,11 @@ static inline int get_next_buf(struct em28xx_dmaqueue *dma_q,
269{ 271{
270 struct em28xx *dev = container_of(dma_q, struct em28xx, vidq); 272 struct em28xx *dev = container_of(dma_q, struct em28xx, vidq);
271 273
274 /* If the previous buffer were not filled yet, continue */
275 *buf = dev->isoc_ctl.buf;
276 if (*buf)
277 return 1;
278
272 if (list_empty(&dma_q->active)) { 279 if (list_empty(&dma_q->active)) {
273 em28xx_isocdbg("No active queue to serve\n"); 280 em28xx_isocdbg("No active queue to serve\n");
274 return 0; 281 return 0;
@@ -276,6 +283,9 @@ static inline int get_next_buf(struct em28xx_dmaqueue *dma_q,
276 283
277 *buf = list_entry(dma_q->active.next, struct em28xx_buffer, vb.queue); 284 *buf = list_entry(dma_q->active.next, struct em28xx_buffer, vb.queue);
278 285
286
287 dev->isoc_ctl.buf = *buf;
288
279 return 1; 289 return 1;
280} 290}
281 291
@@ -303,13 +313,9 @@ static inline int em28xx_isoc_copy(struct urb *urb)
303 return 0; 313 return 0;
304 } 314 }
305 315
306 buf = dev->isoc_ctl.buf; 316 rc = get_next_buf(dma_q, &buf);
307 317 if (rc <= 0)
308 if (!buf) { 318 return rc;
309 rc = get_next_buf(dma_q, &buf);
310 if (rc <= 0)
311 return rc;
312 }
313 319
314 outp = videobuf_to_vmalloc(&buf->vb); 320 outp = videobuf_to_vmalloc(&buf->vb);
315 321
@@ -351,7 +357,6 @@ static inline int em28xx_isoc_copy(struct urb *urb)
351 rc = get_next_buf(dma_q, &buf); 357 rc = get_next_buf(dma_q, &buf);
352 if (rc <= 0) 358 if (rc <= 0)
353 return rc; 359 return rc;
354
355 outp = videobuf_to_vmalloc(&buf->vb); 360 outp = videobuf_to_vmalloc(&buf->vb);
356 } 361 }
357 362
@@ -416,7 +421,6 @@ static void em28xx_uninit_isoc(struct em28xx *dev)
416 em28xx_isocdbg("em28xx: called em28xx_uninit_isoc\n"); 421 em28xx_isocdbg("em28xx: called em28xx_uninit_isoc\n");
417 422
418 dev->isoc_ctl.nfields = -1; 423 dev->isoc_ctl.nfields = -1;
419 dev->isoc_ctl.buf = NULL;
420 for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { 424 for (i = 0; i < dev->isoc_ctl.num_bufs; i++) {
421 urb = dev->isoc_ctl.urb[i]; 425 urb = dev->isoc_ctl.urb[i];
422 if (urb) { 426 if (urb) {
@@ -478,6 +482,7 @@ static int em28xx_prepare_isoc(struct em28xx *dev, int max_packets,
478 } 482 }
479 483
480 dev->isoc_ctl.max_pkt_size = dev->max_pkt_size; 484 dev->isoc_ctl.max_pkt_size = dev->max_pkt_size;
485 dev->isoc_ctl.buf = NULL;
481 486
482 sb_size = max_packets * dev->isoc_ctl.max_pkt_size; 487 sb_size = max_packets * dev->isoc_ctl.max_pkt_size;
483 488