diff options
Diffstat (limited to 'include/asm-mips/delay.h')
-rw-r--r-- | include/asm-mips/delay.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h index a606dbee0412..48d00cccdafa 100644 --- a/include/asm-mips/delay.h +++ b/include/asm-mips/delay.h @@ -12,11 +12,9 @@ #include <linux/config.h> #include <linux/param.h> - +#include <linux/smp.h> #include <asm/compiler.h> -extern unsigned long loops_per_jiffy; - static inline void __delay(unsigned long loops) { if (sizeof(long) == 4) @@ -82,12 +80,17 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj) __delay(usecs); } -#ifdef CONFIG_SMP #define __udelay_val cpu_data[smp_processor_id()].udelay_val -#else -#define __udelay_val loops_per_jiffy -#endif #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 */ |