lkml.org 
[lkml]   [2003]   [Apr]   [6]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
FromPaul Mackerras <>
DateSun, 6 Apr 2003 20:49:41 +1000 (EST)
Subject[PATCH] fix mdelay
The mdelay macro uses a variable called `msec'.  The effect of this is
that the statements msec = 1; mdelay(msec); will spin for an
indeterminate length of time, because you end up with a statement like
this:

	({unsigned long msec=(msec); while (msec--) udelay(1000);}))
and the msec in that statement is uninitialized.  This actually bit me
in sound/ppc/awacs.c.  The patch below changes the name of the loop
variable to __ms, which will hopefully have a lower chance of a
collision.

Please apply.

Paul.

diff -urN linux-2.5/include/linux/delay.h pmac-2.5/include/linux/delay.h
--- linux-2.5/include/linux/delay.h	2003-02-19 18:57:10.000000000 +1100
+++ pmac-2.5/include/linux/delay.h	2003-04-06 18:58:10.000000000 +1000
@@ -31,7 +31,7 @@
 #else
 #define mdelay(n) (\
 	(__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
-	({unsigned long msec=(n); while (msec--) udelay(1000);}))
+	({unsigned long __ms=(n); while (__ms--) udelay(1000);}))
 #endif
 
 #ifndef ndelay
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:34    [W:0.184 / U:0.080 seconds]
©2003-2008 Jasper Spaans