public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix dst i2c read/write timeout failure.
@ 2005-05-04 20:44 Manu Abraham
  2005-05-04 20:57 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Manu Abraham @ 2005-05-04 20:44 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, greg, js, kraxel

Hi,

Attached is a patch to bttv which fixes the following problems.


Affected cards and problems:
~~~~~~~~~~~~~~~~~~~~~~~~
o VP-1020 (200103A) Tuning problems, device detection.
o VP-1020 (DST-MOT) Errors during tuning, device detection fails in a while.
o VP-1030 (DST-CI) Tuning sometimes fails after CI commands.
o VP-2031 (DCT-CI) Tuning problems


The timeout happens before the actual timeout occured in the MCU
on the board, and hence the problems.


Changes: (bttv-i2c.diff)
~~~~~~~~~~~~~~~~~~~~~~~~
o Changed the custom wait queue to wait_event_interruptible_timeout()
      - Suggestion by Johannes Stezenbach.

o Fixed the wait queue timeout problem
      - This fixes the timeout problem on various cards.
      - This problem was visible as many
          * Cannot tune to channels, when signal levels are very low.
          * app_info does not work in some conditions for CI based cards
      - Smaller values worked good for newer cards, but the older cards
suffered, settled down to the worst case values that could happen in any
eventuality.


Signed-off-by: Manu Abraham <manu@kromtek.com>


Index: linux-2.6.12-rc3/drivers/media/video/bttv-i2c.c
========================================
--- linux-2.6.12-rc3.orig/drivers/media/video/bttv-i2c.c	2005-05-03
16:04:28.000000000 +0400
+++ linux-2.6.12-rc3/drivers/media/video/bttv-i2c.c	2005-05-05
00:01:00.000000000 +0400
@@ -29,6 +29,7 @@
   #include <linux/moduleparam.h>
   #include <linux/init.h>
   #include <linux/delay.h>
+#include <linux/jiffies.h>
   #include <asm/io.h>

   #include "bttvp.h"
@@ -130,17 +131,14 @@ static u32 functionality(struct i2c_adap
   static int
   bttv_i2c_wait_done(struct bttv *btv)
   {
-	DECLARE_WAITQUEUE(wait, current);
   	int rc = 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;
+	/* timeout */
+	if (wait_event_interruptible_timeout(btv->i2c_queue,
+		btv->i2c_done, msecs_to_jiffies(85)) == -ERESTARTSYS)
+
+	rc = -EIO;
+	
   	if (btv->i2c_done & BT848_INT_RACK)
   		rc = 1;
   	btv->i2c_done = 0;




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix dst i2c read/write timeout failure.
  2005-05-04 20:44 [PATCH] Fix dst i2c read/write timeout failure Manu Abraham
@ 2005-05-04 20:57 ` Andrew Morton
  2005-05-04 21:27   ` [PATCH] " Manu Abraham
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2005-05-04 20:57 UTC (permalink / raw)
  To: Manu Abraham; +Cc: linux-kernel, greg, js, kraxel

Manu Abraham <manu@kromtek.com> wrote:
>
> User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317)
> 

uh-oh.

> 
> Attached is a patch to bttv which fixes the following problems.

Mozilla space-stuffed it.  Please resend as an attachment.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Re: [PATCH] Fix dst i2c read/write timeout failure.
  2005-05-04 20:57 ` Andrew Morton
@ 2005-05-04 21:27   ` Manu Abraham
  2005-05-04 22:20     ` Randy.Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Manu Abraham @ 2005-05-04 21:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, greg, js, kraxel

[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]

Andrew Morton wrote:
> Manu Abraham <manu@kromtek.com> wrote:
> 
>>User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317)
>>
> 
> 
> uh-oh.
> 
> 
>>Attached is a patch to bttv which fixes the following problems.
> 
> 
> Mozilla space-stuffed it.  Please resend as an attachment.
> 
> 
> 

Oh, i am sorry, resending it ..


Attached is a patch to bttv which fixes the following problems.


Affected cards and problems:
~~~~~~~~~~~~~~~~~~~~~~~~
o VP-1020 (200103A) Tuning problems, device detection.
o VP-1020 (DST-MOT) Errors during tuning, device detection fails in a while.
o VP-1030 (DST-CI) Tuning sometimes fails after CI commands.
o VP-2031 (DCT-CI) Tuning problems


The timeout happens before the actual timeout occured in the MCU
on the board, and hence the problems.


Changes: (bttv-i2c.diff)
~~~~~~~~~~~~~~~~~~~~~~~~
o Changed the custom wait queue to wait_event_interruptible_timeout()
      - Suggestion by Johannes Stezenbach.

o Fixed the wait queue timeout problem
      - This fixes the timeout problem on various cards.
      - This problem was visible as many
          * Cannot tune to channels, when signal levels are very low.
          * app_info does not work in some conditions for CI based cards
      - Smaller values worked good for newer cards, but the older cards
suffered, settled down to the worst case values that could happen in any
eventuality.


Signed-off-by: Manu Abraham <manu@kromtek.com>

[-- Attachment #2: bttv-i2c.diff --]
[-- Type: text/x-patch, Size: 939 bytes --]

--- linux-2.6.12-rc3.orig/drivers/media/video/bttv-i2c.c	2005-05-03 16:04:28.000000000 +0400
+++ linux-2.6.12-rc3/drivers/media/video/bttv-i2c.c	2005-05-05 00:01:00.000000000 +0400
@@ -29,6 +29,7 @@
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/jiffies.h>
 #include <asm/io.h>
 
 #include "bttvp.h"
@@ -130,17 +131,14 @@ static u32 functionality(struct i2c_adap
 static int
 bttv_i2c_wait_done(struct bttv *btv)
 {
-	DECLARE_WAITQUEUE(wait, current);
 	int rc = 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;
+	/* timeout */
+	if (wait_event_interruptible_timeout(btv->i2c_queue, 
+		btv->i2c_done, msecs_to_jiffies(85)) == -ERESTARTSYS)
+
+	rc = -EIO;
+	
 	if (btv->i2c_done & BT848_INT_RACK)
 		rc = 1;
 	btv->i2c_done = 0;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Re: [PATCH] Fix dst i2c read/write timeout failure.
  2005-05-04 21:27   ` [PATCH] " Manu Abraham
@ 2005-05-04 22:20     ` Randy.Dunlap
  2005-05-05 15:00       ` Manu Abraham
  0 siblings, 1 reply; 5+ messages in thread
From: Randy.Dunlap @ 2005-05-04 22:20 UTC (permalink / raw)
  To: Manu Abraham; +Cc: akpm, linux-kernel, greg, js, kraxel

On Thu, 05 May 2005 01:27:34 +0400
Manu Abraham <manu@kromtek.com> wrote:

> 
> Oh, i am sorry, resending it ..
> 
> 
> Attached is a patch to bttv which fixes the following problems.


Has 2 instances of trailing whitespace added (one space, one tab).

You can check for that with one of several available scripts
or with several editors...

---
~Randy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Re: [PATCH] Fix dst i2c read/write timeout failure.
  2005-05-04 22:20     ` Randy.Dunlap
@ 2005-05-05 15:00       ` Manu Abraham
  0 siblings, 0 replies; 5+ messages in thread
From: Manu Abraham @ 2005-05-05 15:00 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: akpm, linux-kernel, greg, js, kraxel

Randy.Dunlap wrote:
> On Thu, 05 May 2005 01:27:34 +0400
> Manu Abraham <manu@kromtek.com> wrote:
> 
> 
>>Oh, i am sorry, resending it ..
>>
>>
>>Attached is a patch to bttv which fixes the following problems.
> 
> 
> 
> Has 2 instances of trailing whitespace added (one space, one tab).
> 
> You can check for that with one of several available scripts
> or with several editors...
> 

Should i cleanup and send again ?


Manu


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-05-05 15:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-04 20:44 [PATCH] Fix dst i2c read/write timeout failure Manu Abraham
2005-05-04 20:57 ` Andrew Morton
2005-05-04 21:27   ` [PATCH] " Manu Abraham
2005-05-04 22:20     ` Randy.Dunlap
2005-05-05 15:00       ` Manu Abraham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox