Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] delay: implement ndelay

Implement ndelay() on s390 as well.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

+20 -3
+5 -3
arch/s390/include/asm/delay.h
··· 14 14 #ifndef _S390_DELAY_H 15 15 #define _S390_DELAY_H 16 16 17 - extern void __udelay(unsigned long long usecs); 18 - extern void udelay_simple(unsigned long long usecs); 19 - extern void __delay(unsigned long loops); 17 + void __ndelay(unsigned long long nsecs); 18 + void __udelay(unsigned long long usecs); 19 + void udelay_simple(unsigned long long usecs); 20 + void __delay(unsigned long loops); 20 21 22 + #define ndelay(n) __ndelay((unsigned long long) (n)) 21 23 #define udelay(n) __udelay((unsigned long long) (n)) 22 24 #define mdelay(n) __udelay((unsigned long long) (n) * 1000) 23 25
+15
arch/s390/lib/delay.c
··· 12 12 #include <linux/module.h> 13 13 #include <linux/irqflags.h> 14 14 #include <linux/interrupt.h> 15 + #include <asm/div64.h> 15 16 16 17 void __delay(unsigned long loops) 17 18 { ··· 117 116 while (get_clock() < end) 118 117 cpu_relax(); 119 118 } 119 + 120 + void __ndelay(unsigned long long nsecs) 121 + { 122 + u64 end; 123 + 124 + nsecs <<= 9; 125 + do_div(nsecs, 125); 126 + end = get_clock() + nsecs; 127 + if (nsecs & ~0xfffUL) 128 + __udelay(nsecs >> 12); 129 + while (get_clock() < end) 130 + barrier(); 131 + } 132 + EXPORT_SYMBOL(__ndelay);