summaryrefslogtreecommitdiffstats
path: root/include/linux/delay.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2008-03-04 14:28:45 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-04 16:35:12 -0800
commit5cba6d22e35a05adb28fdea191b232501518c455 (patch)
tree65ebdb01d81cbe218cbdedc6e52f759a1b18cc0a /include/linux/delay.h
parentdaa49ff50a0cd1ddf88019e9afc41e26640ab1c4 (diff)
downloadlinux-stable-5cba6d22e35a05adb28fdea191b232501518c455.tar.gz
linux-stable-5cba6d22e35a05adb28fdea191b232501518c455.tar.bz2
linux-stable-5cba6d22e35a05adb28fdea191b232501518c455.zip
ndelay(): switch to C function to avoid 64-bit division
We should be able to do ndelay(some_u64), but that can cause a call to __divdi3() to be emitted because the ndelay() macros does a divide. Fix it by switching to static inline which will force the u64 arg to be treated as an unsigned long. udelay() takes an unsigned long arg. [bunk@kernel.org: reported m68k build breakage] Cc: Adrian Bunk <bunk@kernel.org> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Cc: Martin Michlmayr <tbm@cyrius.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: Adrian Bunk <bunk@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/delay.h')
-rw-r--r--include/linux/delay.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/delay.h b/include/linux/delay.h
index 17ddb55430ae..54552d21296e 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -7,6 +7,8 @@
* Delay routines, using a pre-computed "loops_per_jiffy" value.
*/
+#include <linux/kernel.h>
+
extern unsigned long loops_per_jiffy;
#include <asm/delay.h>
@@ -32,7 +34,11 @@ extern unsigned long loops_per_jiffy;
#endif
#ifndef ndelay
-#define ndelay(x) udelay(((x)+999)/1000)
+static inline void ndelay(unsigned long x)
+{
+ udelay(DIV_ROUND_UP(x, 1000));
+}
+#define ndelay(x) ndelay(x)
#endif
void calibrate_delay(void);