From: Atsushi Nemoto Date: Fri, 4 Nov 2005 17:02:54 +0000 (+0900) Subject: Define MAX_UDELAY_MS X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a0f08209c685b4f7dccaf013da74e0e80986c477;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Ralf Baechle --- 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 */