summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-01-14 09:33:24 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-01-14 09:33:24 -0200
commit4db7a1b3fa3feca59108bff6bde7f32d141a14f7 (patch)
tree8bb4df0b73ee2d1c9564b4de2a1735539192d4f1
parentb656f853e151861432c6d828b44328711c64cc28 (diff)
downloadmediapointer-dvb-s2-4db7a1b3fa3feca59108bff6bde7f32d141a14f7.tar.gz
mediapointer-dvb-s2-4db7a1b3fa3feca59108bff6bde7f32d141a14f7.tar.bz2
Some fixes at stream waitqueue on vivi
From: Mauro Carvalho Chehab <mchehab@infradead.org> There are several potential troubles on vivi waitqueue code: - Watchdog timer should be reset at every received frame; - Watchdog timer should be reset at the beginning of vivi_thread(); - Checks for errors when creating a newer thread with kernel_thread(); - Wake up vivi_thread() after creating it. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--linux/drivers/media/video/vivi.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c
index 30f70c0a1..155c9a75a 100644
--- a/linux/drivers/media/video/vivi.c
+++ b/linux/drivers/media/video/vivi.c
@@ -492,11 +492,12 @@ static void vivi_thread_tick(struct vivi_dmaqueue *dma_q)
/* Fill buffer */
vivi_fillbuff(dev,buf);
- }
- if (list_empty(&dma_q->active)) {
- del_timer(&dma_q->timeout);
- } else {
- mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT);
+
+ if (list_empty(&dma_q->active)) {
+ del_timer(&dma_q->timeout);
+ } else {
+ mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT);
+ }
}
if (bc != 1)
dprintk(1,"%s: %d buffers handled (should be 1)\n",__FUNCTION__,bc);
@@ -568,6 +569,8 @@ static int vivi_thread(void *data)
#endif
dprintk(1,"thread started\n");
+ mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT);
+
for (;;) {
vivi_sleep(dma_q);
@@ -607,10 +610,18 @@ static int vivi_start_thread(struct vivi_dmaqueue *dma_q)
dma_q->kthread = NULL;
dma_q->notify = &sem;
- kernel_thread(vivi_thread, dma_q, 0);
+
+ if (kernel_thread(vivi_thread, dma_q, 0) < 0) {
+ printk (KERN_ERR "sdim: kernel_thread() failed\n");
+ return -EINVAL;
+ }
+
down(&sem);
dma_q->notify = NULL;
#endif
+ /* Wakes thread */
+ wake_up_interruptible(&dma_q->wq);
+
dprintk(1,"returning from %s\n",__FUNCTION__);
return 0;
}