mirror of
https://github.com/torvalds/linux.git
synced 2024-09-21 23:43:02 +00:00
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>
This commit is contained in:
parent
daa49ff50a
commit
5cba6d22e3
|
@ -7,6 +7,8 @@
|
||||||
* Delay routines, using a pre-computed "loops_per_jiffy" value.
|
* Delay routines, using a pre-computed "loops_per_jiffy" value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
|
||||||
extern unsigned long loops_per_jiffy;
|
extern unsigned long loops_per_jiffy;
|
||||||
|
|
||||||
#include <asm/delay.h>
|
#include <asm/delay.h>
|
||||||
|
@ -32,7 +34,11 @@ extern unsigned long loops_per_jiffy;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ndelay
|
#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
|
#endif
|
||||||
|
|
||||||
void calibrate_delay(void);
|
void calibrate_delay(void);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user