#ifndef _LINUX_DELAY_H #define _LINUX_DELAY_H /* * Copyright (C) 1993 Linus Torvalds * * Delay routines, using a pre-computed "loops_per_jiffy" value. * * Please note that ndelay(), udelay() and mdelay() may return early for * several reasons: * 1. computed loops_per_jiffy too low (due to the time taken to * execute the timer interrupt.) * 2. cache behaviour affecting the time it takes to execute the * loop function. * 3. CPU clock rate changes. * * Please see this thread: * http://lists.openwall.net/linux-kernel/2011/01/09/56 */ #include <linux/kernel.h> extern unsigned long loops_per_jiffy; #include <asm/delay.h> /* * Using udelay() for intervals greater than a few milliseconds can * risk overflow for high loops_per_jiffy (high bogomips) machines. The * mdelay() provides a wrapper to prevent this. For delays greater * than MAX_UDELAY_MS milliseconds, the wrapper is used. Architecture * specific values can be defined in asm-???/delay.h as an override. * The 2nd mdelay() definition ensures GCC will optimize away the * while loop for the common cases where n <= MAX_UDELAY_MS -- Paul G. */ #ifndef MAX_UDELAY_MS #define MAX_UDELAY_MS 5 #endif #ifndef mdelay #define mdelay(n) (\ (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : \ ({unsigned long __ms=(n); while (__ms--) udelay(1000);})) #endif #ifndef ndelay
static inline void ndelay(unsigned long x) { udelay(DIV_ROUND_UP(x, 1000)); }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 21 | 100.00% | 1 | 100.00% |
Total | 21 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Jeff Garzik | 18 | 100.00% | 1 | 100.00% |
Total | 18 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 36 | 26.87% | 5 | 29.41% |
Andrew Morton | 25 | 18.66% | 1 | 5.88% |
Jeff Garzik | 18 | 13.43% | 1 | 5.88% |
Patrick Pannuto | 12 | 8.96% | 1 | 5.88% |
Linus Torvalds | 11 | 8.21% | 1 | 5.88% |
Maximilian Attems | 9 | 6.72% | 1 | 5.88% |
Greg Kroah-Hartman | 8 | 5.97% | 1 | 5.88% |
David Howells | 6 | 4.48% | 1 | 5.88% |
Alok N Kataria | 5 | 3.73% | 2 | 11.76% |
Anton Blanchard | 2 | 1.49% | 1 | 5.88% |
Benjamin Herrenschmidt | 1 | 0.75% | 1 | 5.88% |
Russell King | 1 | 0.75% | 1 | 5.88% |
Total | 134 | 100.00% | 17 | 100.00% |