all-arch delay functions take 2
Subsystems (6)
PATCH 1/1 all-arch delay functions take 2
Hi folks,
This patch makes mdelay/udelay/ndelay calls as small as possible (just a function call), uses macros which do compile-time checks on delay duration if parameter is a constant, otherwise check is done at run time to prevent udelay(-1) disasters.
arch-specific __[un]delay has guaranteed upper limit on their argument (helps a lot if you write hand optimized assembly divide-by-multiply and are worried of overflows).
Arches other than i386 were minimally modified and were not tested.
i386 ndelay was 15% off scale:
__const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
That's rounded up from 4.295!
We are doing much better now.
ndelay calibration is added. ndelay internally subtracts it's own latency from its argument. On my 2GHz Athlon it is 34 ns. You
need to measure it first somehow, tho (default ndelay_offset=0). I have a TSC-based measurement function included, experimentally called after "Freeing unused kernel memory:"
+ if (cpu_has_tsc)
+ calibrate_ndelay_offset();
Run tested on i386 arch.
--
vda
arch/alpha/lib/udelay.c +4 -4
@@ -39,17 +39,17 @@ __delay(int loops)#endif void -udelay (unsigned long usecs) +__udelay (unsigned long usecs) { usecs *= (((unsigned long )HZ <<32 ) /1000000 ) *LPJ ;__delay ((long )usecs >>32 ); } -EXPORT_SYMBOL (udelay); +EXPORT_SYMBOL (__udelay);void -ndelay (unsigned long nsecs) +__ndelay (unsigned long nsecs) { nsecs *= (((unsigned long )HZ <<32 ) /1000000000 ) *LPJ ;__delay ((long )nsecs >>32 ); } -EXPORT_SYMBOL (ndelay); +EXPORT_SYMBOL (__ndelay);
arch/arm/kernel/armksyms.c +0 -1
@@ -61,7 +61,6 @@ EXPORT_SYMBOL(__backtrace);/* platform dependent support */ EXPORT_SYMBOL (__udelay); -EXPORT_SYMBOL (__const_udelay);/* networking */ EXPORT_SYMBOL (csum_partial);
arch/arm/lib/delay.S +1 -1
@@ -20,7 +20,7 @@ ENTRY(__udelay) mov r2, #0x6800 orr r2, r2, #0x00db mul r0, r2, r0 -ENTRY(__const_udelay) @ 0 <= r0 <= 0x01ffffff + @ 0 <= r0 <= 0x01ffffff ldr r2, LC0 ldr r2, [r2] @ max = 0x0fffffff mov r0, r0, lsr #11 @ max = 0x00003fff
arch/arm26/kernel/armksyms.c +1 -1
@@ -100,7 +100,7 @@ EXPORT_SYMBOL(kd_mksound);/* platform dependent support */ EXPORT_SYMBOL (dump_thread);EXPORT_SYMBOL (dump_fpu); -EXPORT_SYMBOL (udelay); +EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (kernel_thread);EXPORT_SYMBOL (system_rev);EXPORT_SYMBOL (system_serial_low);
arch/i386/kernel/i386_ksyms.c +0 -2
@@ -90,8 +90,6 @@ EXPORT_SYMBOL(csum_partial_copy_generic)/* Delay loops */ EXPORT_SYMBOL (__ndelay);EXPORT_SYMBOL (__udelay); -EXPORT_SYMBOL (__delay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__get_user_1);EXPORT_SYMBOL (__get_user_2);
arch/i386/kernel/i8259.c +1 -0
@@ -11,6 +11,7 @@#include <linux/kernel_stat.h> #include <linux/sysdev.h> #include <linux/bitops.h> +#include <linux/delay.h> #include <asm/8253pit.h> #include <asm/atomic.h>
arch/i386/kernel/timers/timer_pit.c +1 -1
@@ -9,7 +9,7 @@#include <linux/irq.h> #include <linux/sysdev.h> #include <linux/timex.h> -#include <asm/delay.h> +#include <linux/delay.h> #include <asm/mpspec.h> #include <asm/timer.h> #include <asm/smp.h>
arch/i386/lib/delay.c +14 -12
@@ -21,29 +21,31 @@#include <asm/smp.h> #endif -extern struct timer_opts * timer; - -void __delay (unsigned long loops) -{ - cur_timer->delay (loops); -} - -inline void __const_udelay (unsigned long xloops) +static inline void __const_udelay (unsigned long xloops) {int d0; - xloops *=4 ; +/* on entry: xloops = 2**32 * secs * HZ/4. +* loops_needed = secs * loops_per_sec = +* 2**32 * secs * loops_per_jiffy*HZ / 2**32 = +* 2**32 * secs*HZ/4 * loops_per_jiffy*4 / 2**32 +*/ __asm__("mull %0" :"=d" (xloops),"=&a" (d0) - :"1" (xloops),"0" (cpu_data[_smp_processor_id ()].loops_per_jiffy * (HZ /4 ))); + :"1" (xloops),"0" (cpu_data[_smp_processor_id ()].loops_per_jiffy *4 ));__delay (++xloops); } +/* usecs is guaranteed <= 1024 */ void __udelay (unsigned long usecs) { -__const_udelay (usecs *0x000010c7 );/* 2**32 / 1000000 (rounded up) */ +/* 2**32 * usecs = ? secs: */ +/* 4295 = 2**32 / 1000000 (4294.967 , rounded up) */ +__const_udelay (usecs * (4295 *HZ /4 )); } +/* nsecs is guaranteed <= 64*1024 */ void __ndelay (unsigned long nsecs) { -__const_udelay (nsecs *0x00005 );/* 2**32 / 1000000000 (rounded up) */ +/* 2**32 * nsecs == ? secs */ +__const_udelay (nsecs * (4295 *HZ /4 /1000 )); }
arch/i386/mm/init.c +2 -0
@@ -679,6 +679,8 @@ void free_initmem(void) totalram_pages++; }printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n" , (__init_end - __init_begin) >>10 ); +if (cpu_has_tsc) +calibrate_ndelay_offset (); }#ifdef CONFIG_BLK_DEV_INITRD
arch/m32r/kernel/m32r_ksyms.c +0 -1
@@ -44,7 +44,6 @@ EXPORT_SYMBOL(__down_trylock);/* Delay loops */ EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (__delay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__get_user_1);EXPORT_SYMBOL (__get_user_2);
arch/m32r/lib/delay.c +1 -1
@@ -58,7 +58,7 @@ void __delay(unsigned long loops)#endif } -void __const_udelay (unsigned long xloops) +static void __const_udelay (unsigned long xloops) {#if defined(CONFIG_ISA_M32R2 ) && defined(CONFIG_ISA_DSP_LEVEL2 )/*
arch/m68knommu/lib/delay.c +55 -3
65 lines not on this page · raw message
arch/sh/kernel/sh_ksyms.c +0 -1
@@ -77,7 +77,6 @@ EXPORT_SYMBOL(__down_interruptible);EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (__ndelay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__div64_32);
arch/sh/lib/delay.c +1 -1
@@ -19,7 +19,7 @@ void __delay(unsigned long loops) : "t"); } -inline void __const_udelay (unsigned long xloops) +static inline void __const_udelay (unsigned long xloops) { __asm__("dmulu.l %0, %2\n\t" "sts mach, %0"
arch/sh64/lib/udelay.c +4 -15
@@ -36,25 +36,14 @@ void __delay(int loops) :"0"(loops)); } -void __udelay (unsigned long long usecs,unsigned long lpj) +void __udelay (unsigned long long usecs) { - usecs *= (((unsigned long long )HZ <<32 ) /1000000 ) * lpj; + usecs *= (((unsigned long long )HZ <<32 ) /1000000 ) * loops_per_jiffy;__delay ((long long ) usecs >>32 ); } -void __ndelay (unsigned long long nsecs,unsigned long lpj) +void __ndelay (unsigned long long nsecs) { - nsecs *= (((unsigned long long )HZ <<32 ) /1000000000 ) * lpj; + nsecs *= (((unsigned long long )HZ <<32 ) /1000000000 ) * loops_per_jiffy;__delay ((long long ) nsecs >>32 ); } - -void udelay (unsigned long usecs) -{ -__udelay (usecs, loops_per_jiffy); -} - -void ndelay (unsigned long nsecs) -{ -__ndelay (nsecs, loops_per_jiffy); -} -
arch/sparc/kernel/entry.S +5 -5
@@ -1796,15 +1796,15 @@ fpload: retl nop - /* __ndelay and __udelay take two arguments: + /* ___ndelay and ___udelay take two arguments: * 0 - nsecs or usecs to delay * 1 - per_cpu udelay_val (loops per jiffy) * * Note that ndelay gives HZ times higher resolution but has a 10ms * limit. udelay can handle up to 1s. */ - .globl __ndelay -__ndelay: + .globl ___ndelay +___ndelay: save %sp, -STACKFRAME_SZ, %sp mov %i0, %o0 call .umul
@@ -1814,8 +1814,8 @@ __ndelay: ba delay_continue mov %o1, %o0 ! >>32 later for better resolution - .globl __udelay -__udelay: + .globl ___udelay +___udelay: save %sp, -STACKFRAME_SZ, %sp mov %i0, %o0 sethi %hi(0x10c6), %o1
arch/sparc/kernel/sparc_ksyms.c +2 -2
@@ -164,8 +164,8 @@ EXPORT_SYMBOL(cpu_online_map);EXPORT_SYMBOL (phys_cpu_present_map);#endif -EXPORT_SYMBOL (__udelay); -EXPORT_SYMBOL (__ndelay); +EXPORT_SYMBOL (___udelay); +EXPORT_SYMBOL (___ndelay);EXPORT_SYMBOL (rtc_lock);EXPORT_SYMBOL (mostek_lock);EXPORT_SYMBOL (mstk48t02_regs);
arch/sparc64/kernel/sparc64_ksyms.c +0 -1
@@ -400,7 +400,6 @@ EXPORT_SYMBOL(strncmp);/* Delay routines. */ EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (__ndelay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__delay);void VISenter (void );
arch/sparc64/lib/delay.c +1 -1
@@ -27,7 +27,7 @@ void __delay(unsigned long loops)* but that runs into problems for higher values of HZ and * slow cpus. */ -void __const_udelay (unsigned long n) +static void __const_udelay (unsigned long n) { n *=4 ;
arch/um/sys-i386/delay.c +0 -11
@@ -27,14 +27,3 @@ void __udelay(unsigned long usecs) }EXPORT_SYMBOL (__udelay); - -void __const_udelay (unsigned long usecs) -{ -int i, n; - - n = (loops_per_jiffy *HZ * usecs) /MILLION ; -for (i=0 ;i<n;i++) -cpu_relax (); -} - -EXPORT_SYMBOL (__const_udelay);
arch/um/sys-i386/ksyms.c +0 -1
@@ -17,5 +17,4 @@ EXPORT_SYMBOL(__up_wakeup);EXPORT_SYMBOL (csum_partial);/* delay core functions */ -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__udelay);
arch/um/sys-x86_64/delay.c +0 -11
@@ -28,14 +28,3 @@ void __udelay(unsigned long usecs) }EXPORT_SYMBOL (__udelay); - -void __const_udelay (unsigned long usecs) -{ -unsigned long i, n; - - n = (loops_per_jiffy *HZ * usecs) /MILLION ; -for (i=0 ;i<n;i++) -cpu_relax (); -} - -EXPORT_SYMBOL (__const_udelay);
arch/x86_64/kernel/x8664_ksyms.c +0 -1
@@ -73,7 +73,6 @@ EXPORT_SYMBOL(ip_compute_csum);EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (__ndelay);EXPORT_SYMBOL (__delay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__get_user_1);EXPORT_SYMBOL (__get_user_2);
arch/x86_64/lib/delay.c +1 -1
@@ -32,7 +32,7 @@ void __delay(unsigned long loops)while ((now-bclock) < loops); } -inline void __const_udelay (unsigned long xloops) +static inline void __const_udelay (unsigned long xloops) {__delay (((xloops * cpu_data[_smp_processor_id ()].loops_per_jiffy) >>32 ) *HZ ); }
include/asm-alpha/delay.h +3 -4
@@ -2,9 +2,8 @@#define __ALPHA_DELAY_Hextern void __delay (int loops); -extern void udelay (unsigned long usecs); - -extern void ndelay (unsigned long nsecs); -#define ndelay ndelay +extern void __udelay (unsigned long usecs); +extern void __ndelay (unsigned long nsecs); +#define __ndelay (n) __ndelay(n)#endif /* defined(__ALPHA_DELAY_H) */
include/asm-arm/delay.h +0 -26
@@ -8,35 +8,9 @@extern void __delay (int loops); -/* -* This function intentionally does not exist; if you see references to -* it, it means that you're calling udelay() with an out of range value. -* -* With currently imposed limits, this means that we support a max delay -* of 2000us and 671 bogomips -*/ -extern void __bad_udelay (void ); - -/* -* division by multiplication: you don't have to worry about -* loss of precision. -* -* Use only for very small delays ( < 1 msec). Should probably use a -* lookup table, really, as the multiplications take much too long with -* short delays. This is a "reasonable" implementation, though (and the -* first constant multiplications gets optimized away if the delay is -* a constant) -*/ extern void __udelay (unsigned long usecs); -extern void __const_udelay (unsigned long );#define MAX_UDELAY_MS 2 - -#define udelay (n) \ - (__builtin_constant_p(n) ? \ - ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ - __const_udelay((n) * 0x68dbul)) : \ - __udelay(n))#endif /* defined(_ARM_DELAY_H) */
include/asm-arm26/delay.h +1 -1
@@ -21,7 +21,7 @@ extern void __delay(int loops);* * FIXME - lets improve it then... */ -extern void udelay (unsigned long usecs); +extern void __udelay (unsigned long usecs);static inline unsigned long muldiv (unsigned long a,unsigned long b,unsigned long c) {
include/asm-cris/delay.h +1 -1
@@ -13,7 +13,7 @@extern unsigned long loops_per_usec;/* arch/cris/mm/init.c */ -extern __inline__void udelay (unsigned long usecs) +extern __inline__void __udelay (unsigned long usecs) {__delay (usecs * loops_per_usec); }
include/asm-frv/delay.h +2 -2
@@ -40,11 +40,11 @@ static inline void __delay(unsigned longextern unsigned long loops_per_jiffy; -static inline void udelay (unsigned long usecs) +static inline void __udelay (unsigned long usecs) {__delay (usecs * __delay_loops_MHz); } -#define ndelay (n) udelay((n) * 5) +//BOGUS! #define ndelay(n) udelay((n) * 5) #endif /* _ASM_DELAY_H */
include/asm-h8300/delay.h +1 -1
@@ -27,7 +27,7 @@ extern __inline__ void __delay(unsignedextern unsigned long loops_per_jiffy; -extern __inline__void udelay (unsigned long usecs) +extern __inline__void __udelay (unsigned long usecs) { usecs *=4295 ;/* 2**32 / 1000000 */ usecs /= (loops_per_jiffy*HZ );
include/asm-i386/delay.h +9 -12
@@ -6,21 +6,18 @@* * Delay routines calling functions in arch/i386/lib/delay.c */ - -extern void __bad_udelay (void ); -extern void __bad_ndelay (void ); +#include "timer.h" /* cur_timer */ +extern void __udelay (unsigned long usecs);extern void __ndelay (unsigned long nsecs); -extern void __const_udelay (unsigned long usecs); -extern void __delay (unsigned long loops); +#define __ndelay (n) __ndelay(n) + +//extern struct timer_opts* timer; -#define udelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ - __udelay(n)) - -#define ndelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ - __ndelay(n)) +static inline void __delay (unsigned long loops) +{ + cur_timer->delay (loops); +}#endif /* defined(_I386_DELAY_H) */
include/asm-m32r/delay.h +1 -12
@@ -9,20 +9,9 @@* Delay routines calling functions in arch/m32r/lib/delay.c */ -extern void __bad_udelay (void ); -extern void __bad_ndelay (void ); -extern void __udelay (unsigned long usecs);extern void __ndelay (unsigned long nsecs); -extern void __const_udelay (unsigned long usecs); +#define __ndelay (n) __ndelay(n)extern void __delay (unsigned long loops); - -#define udelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ - __udelay(n)) - -#define ndelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ - __ndelay(n))#endif /* _ASM_M32R_DELAY_H */
include/asm-m68k/delay.h +0 -6
@@ -15,8 +15,6 @@ static inline void __delay(unsigned long : "=d" (loops) : "0" (loops)); } -extern void __bad_udelay (void ); -/* * Use only for very small delays ( < 1 msec). Should probably use a * lookup table, really, as the multiplications take much too long with
@@ -38,10 +36,6 @@ static inline void __udelay(unsigned lon {__const_udelay (usecs *4295 );/* 2**32 / 1000000 */ } - -#define udelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 4295)) : \ - __udelay(n))static inline unsigned long muldiv (unsigned long a,unsigned long b,unsigned long c)
include/asm-m68knommu/delay.h +1 -64
70 lines not on this page · raw message
include/asm-mips/delay.h +9 -11
@@ -49,10 +49,16 @@ static inline void __delay(unsigned long* a constant) */ -static inline void __udelay (unsigned long usecs,unsigned long lpj) +static inline void __udelay (unsigned long usecs) {unsigned long lo; +#ifdef CONFIG_SMP +unsigned long loops_per_jiffy = cpu_data[smp_processor_id ()].udelay_val; +#else +/* using global one */ +#endif +/* * The common rates of 1000 and 128 are rounded wrongly by the * catchall case for 64-bit. Excessive precission? Probably ...
@@ -71,23 +77,15 @@ static inline void __udelay(unsigned lonif (sizeof (long ) ==4 ) __asm__("multu\t%2, %3" :"=h" (usecs),"=l" (lo) - :"r" (usecs),"r" (lpj) + :"r" (usecs),"r" (loops_per_jiffy) : GCC_REG_ACCUM);else if (sizeof (long ) ==8 ) __asm__("dmultu\t%2, %3" :"=h" (usecs),"=l" (lo) - :"r" (usecs),"r" (lpj) + :"r" (usecs),"r" (loops_per_jiffy) : GCC_REG_ACCUM); __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)#endif /* _ASM_DELAY_H */
include/asm-parisc/delay.h +0 -2
@@ -38,6 +38,4 @@ static __inline__ void __udelay(unsigned __cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL)); } -#define udelay (n) __udelay(n) -#endif /* defined(_PARISC_DELAY_H) */
include/asm-ppc/delay.h +1 -11
@@ -50,17 +50,7 @@ extern __inline__ void __ndelay(unsigned "r" (x), "r" (loops_per_jiffy * 5));__delay (loops); } - -extern void __bad_udelay (void );/* deliberately undefined */ -extern void __bad_ndelay (void );/* deliberately undefined */ - -#define udelay (n) (__builtin_constant_p(n)? \ - ((n) > __MAX_UDELAY? __bad_udelay(): __udelay((n) * (19 * HZ))) : \ - __udelay((n) * (19 * HZ))) - -#define ndelay (n) (__builtin_constant_p(n)? \ - ((n) > __MAX_NDELAY? __bad_ndelay(): __ndelay((n) * HZ)) : \ - __ndelay((n) * HZ)) +#define __ndelay (n) __ndelay(n)#endif /* defined(_PPC_DELAY_H) */ #endif /* __KERNEL__ */
include/asm-ppc64/delay.h +1 -1
@@ -38,7 +38,7 @@ static inline void __delay(unsigned long__barrier (); } -static inline void udelay (unsigned long usecs) +static inline void __udelay (unsigned long usecs) {unsigned long loops = tb_ticks_per_usec * usecs;
include/asm-s390/delay.h +0 -2
@@ -17,6 +17,4 @@extern void __udelay (unsigned long usecs);extern void __delay (unsigned long loops); -#define udelay (n) __udelay(n) -#endif /* defined(_S390_DELAY_H) */
include/asm-sh/delay.h +1 -13
@@ -7,21 +7,9 @@* Delay routines calling functions in arch/sh/lib/delay.c */ -extern void __bad_udelay (void ); -extern void __bad_ndelay (void ); -extern void __udelay (unsigned long usecs);extern void __ndelay (unsigned long nsecs); -extern void __const_udelay (unsigned long usecs); +#define __ndelay (n) __ndelay(n)extern void __delay (unsigned long loops); - -#define udelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \ - __udelay(n)) - - -#define ndelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ - __ndelay(n))#endif /* __ASM_SH_DELAY_H */
include/asm-sh64/delay.h +3 -4
@@ -2,10 +2,9 @@#define __ASM_SH64_DELAY_Hextern void __delay (int loops); -extern void __udelay (unsigned long long usecs,unsigned long lpj); -extern void __ndelay (unsigned long long nsecs,unsigned long lpj); -extern void udelay (unsigned long usecs); -extern void ndelay (unsigned long nsecs); +extern void __udelay (unsigned long long usecs); +extern void __ndelay (unsigned long long nsecs); +#define __ndelay (n) __ndelay(n)#endif /* __ASM_SH64_DELAY_H */
include/asm-sparc/delay.h +4 -4
@@ -21,15 +21,15 @@ extern __inline__ void __delay(unsigned }/* This is too messy with inline asm on the Sparc. */ -extern void __udelay (unsigned long usecs,unsigned long lpj); -extern void __ndelay (unsigned long nsecs,unsigned long lpj); +extern void ___udelay (unsigned long usecs,unsigned long lpj); +extern void ___ndelay (unsigned long nsecs,unsigned long lpj);#ifdef CONFIG_SMP #define __udelay_val cpu_data(smp_processor_id()).udelay_val#else /* SMP */ #define __udelay_val loops_per_jiffy#endif /* SMP */ -#define udelay (__usecs) __udelay(__usecs, __udelay_val) -#define ndelay (__nsecs) __ndelay(__nsecs, __udelay_val) +#define __udelay (__usecs) ___udelay(__usecs, __udelay_val) +#define __ndelay (__nsecs) ___ndelay(__nsecs, __udelay_val)#endif /* defined(__SPARC_DELAY_H) */
include/asm-sparc64/delay.h +1 -13
@@ -17,21 +17,9 @@#ifndef __ASSEMBLY__ -extern void __bad_udelay (void ); -extern void __bad_ndelay (void ); -extern void __udelay (unsigned long usecs);extern void __ndelay (unsigned long nsecs); -extern void __const_udelay (unsigned long usecs); -extern void __delay (unsigned long loops); - -#define udelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ - __udelay(n)) - -#define ndelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ - __ndelay(n)) +#define __ndelay (n) __ndelay(n)#endif /* !__ASSEMBLY__ */
include/asm-v850/delay.h +1 -1
@@ -33,7 +33,7 @@ extern __inline__ void __delay(unsignedextern unsigned long loops_per_jiffy; -extern __inline__void udelay (unsigned long usecs) +extern __inline__void __udelay (unsigned long usecs) { registerunsigned long full_loops, part_loops;
include/asm-x86_64/delay.h +1 -12
@@ -7,21 +7,10 @@* Delay routines calling functions in arch/x86_64/lib/delay.c */ -extern void __bad_udelay (void ); -extern void __bad_ndelay (void );extern void __udelay (unsigned long usecs);extern void __ndelay (unsigned long usecs); -extern void __const_udelay (unsigned long usecs); +#define __ndelay (n) __ndelay(n)extern void __delay (unsigned long loops); - -#define udelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \ - __udelay(n)) - -#define ndelay (n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ - __ndelay(n)) -#endif /* defined(_X8664_DELAY_H) */
include/linux/delay.h +46 -23
89 lines not on this page · raw message
kernel/timer.c +118 -1
138 lines not on this page · raw message
Quoted 8 lines · Denis Vlasenko
Hi folks,
This patch makes mdelay/udelay/ndelay calls as small as possible (just a function call), uses macros which do compile-time checks on delay duration if parameter is a constant, otherwise check is done at run time to prevent udelay(-1) disasters.
[snip]
include/asm-frv/delay.h static inline void __delay(unsigned long · line 48
Quoted 4 lines
include/asm-frv/delay.h +1
-1-#define ndelay (n) udelay((n) * 5) +//BOGUS! #define ndelay(n) udelay((n) * 5)
If it's bogus, why not just remove it instead of leaving it in as a comment (and a C++ style comment at that) ?
[snip]
Quoted 1 line
+//extern struct timer_opts* timer;
Why add this at all if you are just going to comment it out anyway?
Signature · 3 lines
Jesper Juhl <[email protected]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html
Quoted 9 lines · Jesper Juhl
Quoted 8 lines · Denis Vlasenko
Hi folks,
This patch makes mdelay/udelay/ndelay calls as small as possible (just a function call), uses macros which do compile-time checks on delay duration if parameter is a constant, otherwise check is done at run time to prevent udelay(-1) disasters.
Quoted 8 lines
[snip]
include/asm-frv/delay.h static inline void __delay(unsigned long · line 48
Quoted 4 lines
include/asm-frv/delay.h +1
-1-#define ndelay (n) udelay((n) * 5) +//BOGUS! #define ndelay(n) udelay((n) * 5) If it's bogus, why not just remove it instead of leaving it in as a comment (and a C++ style comment at that) ?
I wanted to draw attention of someone who knows what's going on. Can be removed altogether instead.
Quoted 4 lines
[snip]
Quoted 1 line
+//extern struct timer_opts* timer;
Why add this at all if you are just going to comment it out anyway?
Sorry, this is a leftover meant to be deleted.
--
vda