Commit a0f08209 authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

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: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 53c2df2f
...@@ -84,4 +84,13 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj) ...@@ -84,4 +84,13 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
#define udelay(usecs) __udelay((usecs),__udelay_val) #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 */ #endif /* _ASM_DELAY_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment