diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2005-11-05 02:02:54 +0900 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2005-11-07 18:05:39 +0000 |
commit | a0f08209c685b4f7dccaf013da74e0e80986c477 (patch) | |
tree | 4226fd9fc00daa4db855ba5df0e12e990f55efe6 /include/asm-mips/delay.h | |
parent | 53c2df2f4ebbc1d8231ca7cc13ac5381230888b1 (diff) | |
download | linux-a0f08209c685b4f7dccaf013da74e0e80986c477.tar.gz linux-a0f08209c685b4f7dccaf013da74e0e80986c477.tar.bz2 linux-a0f08209c685b4f7dccaf013da74e0e80986c477.zip |
Define MAX_UDELAY_MS
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>
Diffstat (limited to 'include/asm-mips/delay.h')
-rw-r--r-- | include/asm-mips/delay.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h index 85435a8d4e52..48d00cccdafa 100644 --- a/include/asm-mips/delay.h +++ b/include/asm-mips/delay.h @@ -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 */ |