Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / include / linux / delay.h
blob12fc62f588849f919aa1d08d29b08847569c4b55
1 #ifndef _LINUX_DELAY_H
2 #define _LINUX_DELAY_H
4 /*
5 * Copyright (C) 1993 Linus Torvalds
7 * Delay routines, using a pre-computed "loops_per_jiffy" value.
8 */
10 <<<<<<< HEAD:include/linux/delay.h
11 =======
12 #include <linux/kernel.h>
14 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/delay.h
15 extern unsigned long loops_per_jiffy;
17 #include <asm/delay.h>
20 * Using udelay() for intervals greater than a few milliseconds can
21 * risk overflow for high loops_per_jiffy (high bogomips) machines. The
22 * mdelay() provides a wrapper to prevent this. For delays greater
23 * than MAX_UDELAY_MS milliseconds, the wrapper is used. Architecture
24 * specific values can be defined in asm-???/delay.h as an override.
25 * The 2nd mdelay() definition ensures GCC will optimize away the
26 * while loop for the common cases where n <= MAX_UDELAY_MS -- Paul G.
29 #ifndef MAX_UDELAY_MS
30 #define MAX_UDELAY_MS 5
31 #endif
33 #ifndef mdelay
34 #define mdelay(n) (\
35 (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \
36 ({unsigned long __ms=(n); while (__ms--) udelay(1000);}))
37 #endif
39 #ifndef ndelay
40 <<<<<<< HEAD:include/linux/delay.h
41 #define ndelay(x) udelay(((x)+999)/1000)
42 =======
43 static inline void ndelay(unsigned long x)
45 udelay(DIV_ROUND_UP(x, 1000));
47 #define ndelay(x) ndelay(x)
48 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:include/linux/delay.h
49 #endif
51 void calibrate_delay(void);
52 void msleep(unsigned int msecs);
53 unsigned long msleep_interruptible(unsigned int msecs);
55 static inline void ssleep(unsigned int seconds)
57 msleep(seconds * 1000);
60 #endif /* defined(_LINUX_DELAY_H) */