[linux-dvb] Patches to fix support for VisionPlus DTV (VP1020) / tuning problem

Steffen Motzer motzersn at tlink.de
Sat Apr 23 19:20:09 CEST 2005


Johannes Stezenbach wrote:

> This code looks strange (before and after your change).
> Why isn't this a simple
> 
>   wait_event_interruptible_timeout(&btv->i2c_queue, btv->i2c_done,
>   				   msecs_to_jiffies(20));

Yes, that's definitely better. Here is the new patch that can be applied 
to kernel 2.6.12-rc3.
-------------- next part --------------
--- bttv-i2c.c.orig	2005-04-23 18:24:07.000000000 +0200
+++ bttv-i2c.c	2005-04-23 18:41:15.000000000 +0200
@@ -130,19 +130,12 @@
 static int
 bttv_i2c_wait_done(struct bttv *btv)
 {
-	DECLARE_WAITQUEUE(wait, current);
 	int rc = 0;
+        int timeout = 0;
 
-	add_wait_queue(&btv->i2c_queue, &wait);
-	if (0 == btv->i2c_done)
-		msleep_interruptible(20);
-	remove_wait_queue(&btv->i2c_queue, &wait);
-
-	if (0 == btv->i2c_done)
-		/* timeout */
-		rc = -EIO;
-	if (btv->i2c_done & BT848_INT_RACK)
-		rc = 1;
+	timeout=wait_event_interruptible_timeout(btv->i2c_queue,btv->i2c_done,20);
+	if (timeout==-ERESTARTSYS) rc = -EIO;
+	if (btv->i2c_done & BT848_INT_RACK) rc = 1;
 	btv->i2c_done = 0;
 	return rc;
 }


More information about the linux-dvb mailing list