Skip to contentSkip to conversation

tipar char driver: wrong timeout value

PATCH New Romain Lievin 1 participant 1 message Apr 19, 2004 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tipar char driver: wrong timeout value

Hi,

this patch (2.4 & 2.6) fixes a bug about the timeout value. The formula used to calculate jiffies from timeout is wrong.
The new formula is ok and takes care of integer computation/rounding. There is the same bug in the tiglusb.c module which will be fixed by another patch.

Please apply, Romain.
==============================[cut here]================================

drivers/char/tipar.c +1 -1
diff -Naur linux-2.4.26.orig/drivers/char/tipar.c linux-2.4.26/drivers/char/tipar.c
@@ -124,7 +124,7 @@
 
 /* ----- global defines ----------------------------------------------- */
 
-#define START(x) { x=jiffies+HZ/(timeout/10); }
+#define START(x) { x = jiffies + (HZ * timeout) / 10; }
 #define WAIT(x)  { \
   if (time_before((x), jiffies)) return -1; \
   if (need_resched()) schedule(); }

==============================[cut here]================================

drivers/char/tipar.c +1 -1
diff -Naur linux-2.6.5.orig/drivers/char/tipar.c linux-2.6.5/drivers/char/tipar.c
@@ -121,7 +121,7 @@
 
 /* ----- global defines ----------------------------------------------- */
 
-#define START(x) { x=jiffies+HZ/(timeout/10); }
+#define START(x) { x = jiffies + (HZ * timeout) / 10; }
 #define WAIT(x)  { \
   if (time_before((x), jiffies)) return -1; \
   if (need_resched()) schedule(); }

==============================[cut here]================================

Signature · 3 lines
Romain Liévin (roms):         <[email protected]>
Web site:                     http://www.lievin.net
"Linux, y'a moins bien mais c'est plus cher !"