all-arch delay patch
Subsystems (6)
PATCH 1/1 all-arch delay patch
This one is for review only by arch maintainers.
Run tested on i386.
# size vmlinux.org vmlinux.delay text data bss dec hex filename 4345737 1607102 259296 6212135 5eca27 vmlinux.org 4345296 1604470 259296 6209062 5ebe26 vmlinux.delay
If someone from non-i386 land with a bit of time to spare wants to test it, that will be appreciated.
Add #include <linux/delay.h> if you will get undefined refs to [mun]delay(). (I already did in two files IIRC).
Vojtech, I did not read your mail when I worked on the patch, thus your ndelay() concerns are not addressed.
find.out.bz2 has some less boring cases of delays grepped from kernel source. Selected gems are:
aic79xx_osm.h:ahd_delay(long usec)
{
/*
* udelay on Linux can have problems for
* multi-millisecond waits. Wait at most
* 1024us per call.
*/
while (usec > 0) {
udelay(usec % 1024);
usec -= 1024;
}
}arch/i386/kernel/traps.c:
outb(reason, 0x61);
i = 2000;
while (--i) udelay(1000);
reason &= ~8;
outb(reason, 0x61);sound/oss/ad1889.c:
//now 100ms
/* #define WAIT_10MS() schedule_timeout(HZ/10) */
#define WAIT_10MS() do { int __i; for (__i = 0; __i < 100; __i++) udelay(1000); } while(0)
drivers/isdn/hisax/hisax.h:
#define HZDELAY(jiffs) {int tout = jiffs; while (tout--) udelay(1000000/HZ);}
drivers/scsi/u14-34f.c:
while ((jiffies - time) < HZ && limit++ < 20000) udelay(100L);
...
while ((jiffies - time) < (10 * HZ) && limit++ < 200000) udelay(100L);
sound/isa/es18xx.c:
udelay(100000);
drivers/scsi/aha152x.c:
mdelay(10000);
--
vda
arch/alpha/lib/udelay.c +4 -4
@@ -32,24 +32,24 @@ __delay(int loops) : "=&r" (tmp), "=r" (loops) : "1"(loops)); }#ifdef CONFIG_SMP #define LPJ cpu_data[smp_processor_id()].loops_per_jiffy#else #define LPJ loops_per_jiffy#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
@@ -54,21 +54,20 @@ extern void fp_enter(void);* These symbols will never change their calling convention... */ EXPORT_SYMBOL_ALIAS (kern_fp_enter,fp_enter);EXPORT_SYMBOL_ALIAS (fp_printk,printk);EXPORT_SYMBOL_ALIAS (fp_send_sig,send_sig);EXPORT_SYMBOL (__backtrace);/* platform dependent support */ EXPORT_SYMBOL (__udelay); -EXPORT_SYMBOL (__const_udelay);/* networking */ EXPORT_SYMBOL (csum_partial);EXPORT_SYMBOL (csum_partial_copy_nocheck);EXPORT_SYMBOL (__csum_ipv6_magic);/* io */ #ifndef __raw_readsbEXPORT_SYMBOL (__raw_readsb);#endif
arch/arm/lib/delay.S +1 -1
@@ -13,21 +13,21 @@ LC0: .word loops_per_jiffy /* * 0 <= r0 <= 2000 */ 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 mov r2, r2, lsr #11 @ max = 0x0003ffff mul r0, r2, r0 @ max = 2^32-1 movs r0, r0, lsr #6 RETINSTR(moveq,pc,lr) /* * loops = (r0 * 0x10c6 * 100 * loops_per_jiffy) / 2^32
arch/i386/kernel/i386_ksyms.c +0 -1
@@ -84,21 +84,20 @@ EXPORT_SYMBOL(apm_info);EXPORT_SYMBOL (__down_failed);EXPORT_SYMBOL (__down_failed_interruptible);EXPORT_SYMBOL (__down_failed_trylock);EXPORT_SYMBOL (__up_wakeup);/* Networking helper routines. */ 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);EXPORT_SYMBOL (__get_user_4);EXPORT_SYMBOL (__put_user_1);EXPORT_SYMBOL (__put_user_2);EXPORT_SYMBOL (__put_user_4);EXPORT_SYMBOL (__put_user_8);
arch/i386/kernel/i8259.c +1 -0
@@ -4,20 +4,21 @@#include <linux/sched.h> #include <linux/ioport.h> #include <linux/interrupt.h> #include <linux/slab.h> #include <linux/random.h> #include <linux/smp_lock.h> #include <linux/init.h> #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> #include <asm/system.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/timer.h> #include <asm/pgtable.h> #include <asm/delay.h> #include <asm/desc.h>
arch/i386/kernel/timers/timer_pit.c +1 -1
@@ -2,21 +2,21 @@* This code largely moved from arch/i386/kernel/time.c. * See comments there for proper credits. */ #include <linux/spinlock.h> #include <linux/module.h> #include <linux/device.h> #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> #include <asm/io.h> #include <asm/arch_hooks.h> extern spinlock_t i8259A_lock;extern spinlock_t i8253_lock;#include "do_timer.h" #include "io_ports.h"
arch/i386/lib/delay.c +1 -1
@@ -21,21 +21,21 @@#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 ; __asm__("mull %0" :"=d" (xloops),"=&a" (d0) :"1" (xloops),"0" (cpu_data[_smp_processor_id ()].loops_per_jiffy * (HZ /4 )));__delay (++xloops); }void __udelay (unsigned long usecs)
arch/m32r/kernel/m32r_ksyms.c +0 -1
@@ -37,21 +37,20 @@ EXPORT_SYMBOL(disable_irq_nosync);EXPORT_SYMBOL (kernel_thread);EXPORT_SYMBOL (__down);EXPORT_SYMBOL (__down_interruptible);EXPORT_SYMBOL (__up);EXPORT_SYMBOL (__down_trylock);/* Networking helper routines. */ /* Delay loops */ EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (__delay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__get_user_1);EXPORT_SYMBOL (__get_user_2);EXPORT_SYMBOL (__get_user_4);EXPORT_SYMBOL (strpbrk);EXPORT_SYMBOL (strstr);EXPORT_SYMBOL (strncpy_from_user);EXPORT_SYMBOL (__strncpy_from_user);
arch/m32r/lib/delay.c +1 -1
@@ -51,21 +51,21 @@ void __delay(unsigned long loops)"addi %0, #-1 \n\t" "bgtz %0, 1b \n\t" " .fillinsn \n\t" "2: \n\t" : "+r" (loops) : "r" (0) );#endif } -void __const_udelay (unsigned long xloops) +static void __const_udelay (unsigned long xloops) {#if defined(CONFIG_ISA_M32R2 ) && defined(CONFIG_ISA_DSP_LEVEL2 )/* * loops [1] = (xloops >> 32) [sec] * loops_per_jiffy [1/jiffy] * * HZ [jiffy/sec] * = (xloops >> 32) [sec] * (loops_per_jiffy * HZ) [1/sec] * = (((xloops * loops_per_jiffy) >> 32) * HZ) [1] * * NOTE: * - '[]' depicts variable's dimension in the above equation.
arch/m68knommu/lib/delay.c +55 -3
72 lines not on this page · raw message
arch/sh/kernel/sh_ksyms.c +0 -1
@@ -70,21 +70,20 @@ EXPORT_SYMBOL(boot_cpu_data);EXPORT_SYMBOL (get_vm_area);#endif /* semaphore exports */ EXPORT_SYMBOL (__up);EXPORT_SYMBOL (__down);EXPORT_SYMBOL (__down_interruptible);EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (__ndelay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__div64_32);#define DECLARE_EXPORT (name) extern void name(void);EXPORT_SYMBOL(name)/* These symbols are generated by the compiler itself */ DECLARE_EXPORT (__udivsi3);DECLARE_EXPORT (__udivdi3);DECLARE_EXPORT (__sdivsi3);DECLARE_EXPORT (__ashrdi3);
arch/sh/lib/delay.c +1 -1
@@ -12,21 +12,21 @@ void __delay(unsigned long loops) __asm__ __volatile__("tst %0, %0\n\t" "1:\t" "bf/s 1b\n\t" " dt %0" :"=r" (loops) :"0" (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" :"=r" (xloops) :"0" (xloops),"r" (cpu_data[_smp_processor_id ()].loops_per_jiffy) :"macl" ,"mach" );__delay (xloops *HZ ); }void __udelay (unsigned long usecs)
arch/sh64/lib/udelay.c +4 -15
@@ -29,32 +29,21 @@ void __delay(int loops)long long dummy; __asm__ __volatile__("gettr tr0, %1\n\t" "pta $+4, tr0\n\t" "addi %0, -1, %0\n\t" "bne %0, r63, tr0\n\t" "ptabs %1, tr0\n\t" :"=r" (loops),"=r" (dummy) :"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
@@ -1789,40 +1789,40 @@ fpload: ldd [%o0 + 0x50], %f20 ldd [%o0 + 0x58], %f22 ldd [%o0 + 0x60], %f24 ldd [%o0 + 0x68], %f26 ldd [%o0 + 0x70], %f28 ldd [%o0 + 0x78], %f30 ld [%o1], %fsr 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 mov 0x1ad, %o1 ! 2**32 / (1 000 000 000 / HZ) call .umul mov %i1, %o1 ! udelay_val 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 call .umul or %o1, %lo(0x10c6), %o1 ! 2**32 / 1 000 000 call .umul mov %i1, %o1 ! udelay_val call .umul mov HZ, %o0 ! >>32 earlier for wider range
arch/sparc/kernel/sparc_ksyms.c +2 -2
@@ -157,22 +157,22 @@ EXPORT_SYMBOL(synchronize_irq);/* Misc SMP information */ EXPORT_SYMBOL (__cpu_number_map);EXPORT_SYMBOL (__cpu_logical_map);/* CPU online map and active count. */ 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);#ifdef CONFIG_SUN_AUXIO EXPORT_SYMBOL (set_auxio);EXPORT_SYMBOL (get_auxio);#endif EXPORT_SYMBOL (request_fast_irq);EXPORT_SYMBOL (io_remap_page_range);EXPORT_SYMBOL (io_remap_pfn_range);
arch/sparc64/kernel/sparc64_ksyms.c +0 -1
@@ -393,21 +393,20 @@ EXPORT_SYMBOL(__ret_efault);/* No version information on these, as gcc produces such symbols. */ EXPORT_SYMBOL (memcmp);EXPORT_SYMBOL (memcpy);EXPORT_SYMBOL (memset);EXPORT_SYMBOL (memmove);EXPORT_SYMBOL (strncmp);/* Delay routines. */ EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (__ndelay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__delay);void VISenter (void );/* RAID code needs this */ EXPORT_SYMBOL (VISenter);/* for input/keybdev */ EXPORT_SYMBOL (sun_do_break);EXPORT_SYMBOL (serial_console);EXPORT_SYMBOL (stop_a_enabled);
arch/sparc64/lib/delay.c +1 -1
@@ -20,21 +20,21 @@ void __delay(unsigned long loops) " subcc %0, 1, %0\n" : "=&r" (loops) : "0" (loops) : "cc"); }/* We used to multiply by HZ after shifting down by 32 bits * 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 ; n *= (cpu_data (_smp_processor_id ()).udelay_val * (HZ /4 )); n >>=32 ;__delay (n +1 ); }void __udelay (unsigned long n)
arch/um/sys-i386/delay.c +0 -11
@@ -20,21 +20,10 @@ void __delay(unsigned long time)void __udelay (unsigned long usecs) {int i, n; n = (loops_per_jiffy *HZ * usecs) /MILLION ;for (i=0 ;i<n;i++)cpu_relax (); }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
@@ -10,12 +10,11 @@EXPORT_SYMBOL (__down_failed);EXPORT_SYMBOL (__down_failed_interruptible);EXPORT_SYMBOL (__down_failed_trylock);EXPORT_SYMBOL (__up_wakeup);/* Networking helper routines. */ EXPORT_SYMBOL (csum_partial);/* delay core functions */ -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__udelay);
arch/um/sys-x86_64/delay.c +0 -11
@@ -21,21 +21,10 @@ void __delay(unsigned long loops)void __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 (__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
@@ -66,21 +66,20 @@ EXPORT_SYMBOL(__down_failed);EXPORT_SYMBOL (__down_failed_interruptible);EXPORT_SYMBOL (__down_failed_trylock);EXPORT_SYMBOL (__up_wakeup);/* Networking helper routines. */ EXPORT_SYMBOL (csum_partial_copy_nocheck);EXPORT_SYMBOL (ip_compute_csum);/* Delay loops */ EXPORT_SYMBOL (__udelay);EXPORT_SYMBOL (__ndelay);EXPORT_SYMBOL (__delay); -EXPORT_SYMBOL (__const_udelay);EXPORT_SYMBOL (__get_user_1);EXPORT_SYMBOL (__get_user_2);EXPORT_SYMBOL (__get_user_4);EXPORT_SYMBOL (__get_user_8);EXPORT_SYMBOL (__put_user_1);EXPORT_SYMBOL (__put_user_2);EXPORT_SYMBOL (__put_user_4);EXPORT_SYMBOL (__put_user_8);
arch/x86_64/lib/delay.c +1 -1
@@ -25,21 +25,21 @@ void __delay(unsigned long loops)rdtscl (bclock);do {rep_nop ();rdtscl (now); }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 ); }void __udelay (unsigned long usecs) {__const_udelay (usecs *0x000010c6 );/* 2**32 / 1000000 */ }void __ndelay (unsigned long nsecs)
include/asm-alpha/delay.h +3 -4
@@ -1,10 +1,9 @@#ifndef __ALPHA_DELAY_H#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
@@ -1,42 +1,16 @@/* * Copyright (C) 1995-2004 Russell King * * Delay routines, using a pre-computed "loops_per_second" value. */ #ifndef __ASM_ARM_DELAY_H#define __ASM_ARM_DELAY_Hextern 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
@@ -14,21 +14,21 @@ extern void __delay(int loops);* 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) * * 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) {return a * b / c; }#endif /* defined(_ARM_DELAY_H) */
include/asm-cris/delay.h +1 -1
@@ -6,19 +6,19 @@* * Delay routines, using a pre-computed "loops_per_second" value. */ #include <asm/arch/delay.h> /* Use only for very small delays ( < 1 msec). */ 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); }#endif /* defined(_CRIS_DELAY_H) */
include/asm-frv/delay.h +2 -2
@@ -33,18 +33,18 @@ static inline void __delay(unsigned long/* * 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 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
@@ -20,19 +20,19 @@ extern __inline__ void __delay(unsigned/* * 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 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 );if (usecs)__delay (usecs); }#endif /* _H8300_DELAY_H */
include/asm-i386/delay.h +1 -12
@@ -1,26 +1,15 @@#ifndef _I386_DELAY_H#define _I386_DELAY_H/* * Copyright (C) 1993 Linus Torvalds * * Delay routines calling functions in arch/i386/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 /* defined(_I386_DELAY_H) */
include/asm-m32r/delay.h +1 -12
@@ -2,27 +2,16 @@#define _ASM_M32R_DELAY_H/* $Id$ */ /* * Copyright (C) 1993 Linus Torvalds * * 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
@@ -8,22 +8,20 @@* * Delay routines, using a pre-computed "loops_per_jiffy" value. */ static inline void __delay (unsigned long loops) { __asm__ __volatile__ ("1: subql #1,%0; jcc 1b" :"=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 * short delays. This is a "reasonable" implementation, though (and the * first constant multiplications gets optimized away if the delay is * a constant) */ static inline void __const_udelay (unsigned long xloops) {unsigned long tmp;
@@ -31,24 +29,20 @@ static inline void __const_udelay(unsign __asm__ ("mulul %2,%0:%1" :"=d" (xloops),"=d" (tmp) :"d" (xloops),"1" (loops_per_jiffy));__delay (xloops *HZ ); }static inline void __udelay (unsigned long usecs) {__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) {unsigned long tmp; __asm__ ("mulul %2,%0:%1; divul %3,%0:%1" :"=d" (tmp),"=d" (a) :"d" (b),"d" (c),"1" (a));return a;
include/asm-m68knommu/delay.h +1 -64
77 lines not on this page · raw message
include/asm-mips/delay.h +9 -11
@@ -42,52 +42,50 @@ static inline void __delay(unsigned long* 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) */ -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 ... */ #if defined(CONFIG_MIPS64 ) && (HZ ==128 ) usecs *=0x0008637bd05af6c7UL ;/* 2**64 / (1000000 / HZ) */ #elif defined(CONFIG_MIPS64 ) && (HZ ==1000 ) usecs *=0x004189374BC6A7f0UL ;/* 2**64 / (1000000 / HZ) */ #elif defined(CONFIG_MIPS64 ) usecs *= (0x8000000000000000UL / (500000 /HZ ));#else /* 32-bit junk follows here */ usecs *= (unsigned long ) (((0x8000000000000000ULL / (500000 /HZ )) +0x80000000ULL ) >>32 );#endif if (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
@@ -31,13 +31,11 @@ static __inline__ void __cr16_delay(unsi start =mfctl (16 );while ((mfctl (16 ) - start) < clocks) ; }static __inline__void __udelay (unsigned long usecs) {__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
@@ -43,24 +43,14 @@ extern __inline__ void __udelay(unsigned }extern __inline__void __ndelay (unsigned int x) {unsigned int loops; __asm__("mulhwu %0,%1,%2" :"=r" (loops) :"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
@@ -31,18 +31,18 @@ static inline unsigned long __get_tb(voistatic inline void __delay (unsigned long loops) {unsigned long start =__get_tb ();while ((__get_tb ()-start) < loops)__HMT_low ();__HMT_medium ();__barrier (); } -static inline void udelay (unsigned long usecs) +static inline void __udelay (unsigned long usecs) {unsigned long loops = tb_ticks_per_usec * usecs;__delay (loops); }#endif /* _PPC64_DELAY_H */
include/asm-s390/delay.h +0 -2
@@ -10,13 +10,11 @@* * Delay routines calling functions in arch/s390/lib/delay.c */ #ifndef _S390_DELAY_H#define _S390_DELAY_Hextern 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
@@ -1,27 +1,15 @@#ifndef __ASM_SH_DELAY_H#define __ASM_SH_DELAY_H/* * Copyright (C) 1993 Linus Torvalds * * 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
@@ -1,11 +1,10 @@#ifndef __ASM_SH64_DELAY_H#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
@@ -14,22 +14,22 @@ extern __inline__ void __delay(unsigned { __asm__ __volatile__("cmp %0, 0\n\t" "1: bne 1b\n\t" "subcc %0, 1, %0\n" :"=&r" (loops) :"0" (loops) :"cc" ); }/* 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
@@ -10,29 +10,17 @@#ifndef __SPARC64_DELAY_H#define __SPARC64_DELAY_H#include <linux/config.h> #include <linux/param.h> #include <asm/cpudata.h> #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__ */ #endif /* defined(__SPARC64_DELAY_H) */
include/asm-v850/delay.h +1 -1
@@ -26,21 +26,21 @@ extern __inline__ void __delay(unsigned/* * 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 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; full_loops = ((usecs *HZ ) /1000000 ) * loops_per_jiffy; usecs %= (1000000 /HZ ); part_loops = (usecs *HZ * loops_per_jiffy) /1000000 ;__delay (full_loops + part_loops); }
include/asm-x86_64/delay.h +1 -12
@@ -1,27 +1,16 @@#ifndef _X8664_DELAY_H#define _X8664_DELAY_H/* * Copyright (C) 1993 Linus Torvalds * * 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 +44 -23
90 lines not on this page · raw message
kernel/timer.c +57 -1
119 lines not on this page · raw message