Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 92650
b: refs/heads/master
c: dbecb44
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Apr 24, 2008
1 parent 47d2b2d commit 23fabc0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0cf4daee31d88086cf3508d1d8d1f4e451c27906
refs/heads/master: dbecb44c11d9517d604240b53581951ac4e3b5e6
35 changes: 26 additions & 9 deletions trunk/drivers/media/video/em28xx/em28xx-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,39 @@ static inline int get_next_buf(struct em28xx_dmaqueue *dma_q,
struct em28xx_buffer **buf)
{
struct em28xx *dev = container_of(dma_q, struct em28xx, vidq);
char *outp;

/* If the previous buffer were not filled yet, continue */
if (list_empty(&dma_q->active)) {
em28xx_isocdbg("No active queue to serve\n");
dev->isoc_ctl.buf = NULL;
return 0;
}

/* Check if the last buffer were fully filled */
*buf = dev->isoc_ctl.buf;

/* Nobody is waiting on this buffer - discards */
if (*buf && !waitqueue_active(&(*buf)->vb.done)) {
dev->isoc_ctl.buf = NULL;
*buf = NULL;
}

/* Returns the last buffer, to be filled with remaining data */
if (*buf)
return 1;

if (list_empty(&dma_q->active)) {
/* Get the next buffer */
*buf = list_entry(dma_q->active.next, struct em28xx_buffer, vb.queue);

/* Nobody is waiting on the next buffer. returns */
if (!*buf || !waitqueue_active(&(*buf)->vb.done)) {
em28xx_isocdbg("No active queue to serve\n");
return 0;
}

*buf = list_entry(dma_q->active.next, struct em28xx_buffer, vb.queue);

/* Cleans up buffer - Usefull for testing for frame/URB loss */
outp = videobuf_to_vmalloc(&(*buf)->vb);
memset(outp, 0, (*buf)->vb.size);

dev->isoc_ctl.buf = *buf;

Expand Down Expand Up @@ -387,12 +407,11 @@ static void em28xx_irq_callback(struct urb *urb)
struct em28xx_dmaqueue *dma_q = urb->context;
struct em28xx *dev = container_of(dma_q, struct em28xx, vidq);
int rc, i;
unsigned long flags;

spin_lock_irqsave(&dev->slock, flags);

/* Copy data from URB */
spin_lock(&dev->slock);
rc = em28xx_isoc_copy(urb);
spin_unlock(&dev->slock);

/* Reset urb buffers */
for (i = 0; i < urb->number_of_packets; i++) {
Expand All @@ -406,8 +425,6 @@ static void em28xx_irq_callback(struct urb *urb)
em28xx_err("urb resubmit failed (error=%i)\n",
urb->status);
}

spin_unlock_irqrestore(&dev->slock, flags);
}

/*
Expand Down

0 comments on commit 23fabc0

Please sign in to comment.