]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Define MAX_UDELAY_MS
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Fri, 4 Nov 2005 17:02:54 +0000 (02:02 +0900)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 7 Nov 2005 18:05:39 +0000 (18:05 +0000)
If HZ was 1000, mdelay(2) cause overflow on multiplication in
__udelay.  We should define MAX_UDELAY_MS properly to prevent this.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
include/asm-mips/delay.h

index 85435a8d4e52d4287f2328a2cff093437ccbae96..48d00cccdafa9a5f490b47c1407a7ce14fa0a1a0 100644 (file)
@@ -84,4 +84,13 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
 
 #define udelay(usecs) __udelay((usecs),__udelay_val)
 
+/* make sure "usecs *= ..." in udelay do not overflow. */
+#if HZ >= 1000
+#define MAX_UDELAY_MS  1
+#elif HZ <= 200
+#define MAX_UDELAY_MS  5
+#else
+#define MAX_UDELAY_MS  (1000 / HZ)
+#endif
+
 #endif /* _ASM_DELAY_H */