printk(KERN_INFO "%s %s :"fmt, \
dev->name, __func__ , ##arg); } while (0)
-#define BUFFER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
-
/* Limits minimum and default number of buffers */
#define EM28XX_MIN_BUF 4
#define EM28XX_DEF_BUF 8
struct em28xx_dmaqueue *dma_q,
struct em28xx_buffer *buf)
{
- mod_timer(&dma_q->timeout, jiffies + BUFFER_TIMEOUT);
-
/* Advice that buffer was filled */
em28xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i);
buf->vb.state = VIDEOBUF_DONE;
dev->isoc_ctl.num_bufs = 0;
- del_timer(&dev->vidq.timeout);
em28xx_capture_start(dev, 0);
}
return 0;
}
-static void em28xx_vid_timeout(unsigned long data)
-{
- struct em28xx *dev = (struct em28xx *)data;
- struct em28xx_dmaqueue *vidq = &dev->vidq;
- struct em28xx_buffer *buf;
- unsigned long flags;
-
- spin_lock_irqsave(&dev->slock, flags);
-
- list_for_each_entry(buf, vidq->active.next, vb.queue) {
- list_del(&buf->vb.queue);
- buf->vb.state = VIDEOBUF_ERROR;
- wake_up(&buf->vb.done);
- em28xx_videodbg("em28xx/0: [%p/%d] timeout\n",
- buf, buf->vb.i);
- }
- /* Instead of trying to restart, just sets timeout again */
- mod_timer(&vidq->timeout, jiffies + BUFFER_TIMEOUT);
-
- spin_unlock_irqrestore(&dev->slock, flags);
-}
-
/* ------------------------------------------------------------------
Videobuf operations
------------------------------------------------------------------*/
INIT_LIST_HEAD(&dev->vidq.active);
INIT_LIST_HEAD(&dev->vidq.queued);
- dev->vidq.timeout.function = em28xx_vid_timeout;
- dev->vidq.timeout.data = (unsigned long)dev;
- init_timer(&dev->vidq.timeout);
-
if (dev->has_msp34xx) {
/* Send a reset to other chips via gpio */