[PATCH] uml: Delay loop cleanups

This patch cleans up the delay implementations a bit, makes the loops
unoptimizable, and exports __udelay and __const_udelay.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Jeff Dike and committed by Linus Torvalds 060e3522 13479d52

+27 -22
+12 -4
arch/um/sys-i386/delay.c
··· 1 - #include "linux/delay.h" 2 - #include "asm/param.h" 3 4 void __delay(unsigned long time) 5 { ··· 22 int i, n; 23 24 n = (loops_per_jiffy * HZ * usecs) / MILLION; 25 - for(i=0;i<n;i++) ; 26 } 27 28 void __const_udelay(unsigned long usecs) 29 { 30 int i, n; 31 32 n = (loops_per_jiffy * HZ * usecs) / MILLION; 33 - for(i=0;i<n;i++) ; 34 }
··· 1 + #include <linux/module.h> 2 + #include <linux/kernel.h> 3 + #include <linux/delay.h> 4 + #include <asm/param.h> 5 6 void __delay(unsigned long time) 7 { ··· 20 int i, n; 21 22 n = (loops_per_jiffy * HZ * usecs) / MILLION; 23 + for(i=0;i<n;i++) 24 + cpu_relax(); 25 } 26 + 27 + EXPORT_SYMBOL(__udelay); 28 29 void __const_udelay(unsigned long usecs) 30 { 31 int i, n; 32 33 n = (loops_per_jiffy * HZ * usecs) / MILLION; 34 + for(i=0;i<n;i++) 35 + cpu_relax(); 36 } 37 + 38 + EXPORT_SYMBOL(__const_udelay);
+15 -18
arch/um/sys-x86_64/delay.c
··· 5 * Licensed under the GPL 6 */ 7 8 - #include "linux/delay.h" 9 - #include "asm/processor.h" 10 - #include "asm/param.h" 11 12 void __delay(unsigned long loops) 13 { 14 unsigned long i; 15 16 - for(i = 0; i < loops; i++) ; 17 } 18 19 void __udelay(unsigned long usecs) 20 { 21 - int i, n; 22 23 n = (loops_per_jiffy * HZ * usecs) / MILLION; 24 - for(i=0;i<n;i++) ; 25 } 26 27 void __const_udelay(unsigned long usecs) 28 { 29 - int i, n; 30 31 n = (loops_per_jiffy * HZ * usecs) / MILLION; 32 - for(i=0;i<n;i++) ; 33 } 34 35 - /* 36 - * Overrides for Emacs so that we follow Linus's tabbing style. 37 - * Emacs will notice this stuff at the end of the file and automatically 38 - * adjust the settings for this buffer only. This must remain at the end 39 - * of the file. 40 - * --------------------------------------------------------------------------- 41 - * Local variables: 42 - * c-file-style: "linux" 43 - * End: 44 - */
··· 5 * Licensed under the GPL 6 */ 7 8 + #include <linux/module.h> 9 + #include <linux/delay.h> 10 + #include <asm/processor.h> 11 + #include <asm/param.h> 12 13 void __delay(unsigned long loops) 14 { 15 unsigned long i; 16 17 + for(i = 0; i < loops; i++) 18 + cpu_relax(); 19 } 20 21 void __udelay(unsigned long usecs) 22 { 23 + unsigned long i, n; 24 25 n = (loops_per_jiffy * HZ * usecs) / MILLION; 26 + for(i=0;i<n;i++) 27 + cpu_relax(); 28 } 29 + 30 + EXPORT_SYMBOL(__udelay); 31 32 void __const_udelay(unsigned long usecs) 33 { 34 + unsigned long i, n; 35 36 n = (loops_per_jiffy * HZ * usecs) / MILLION; 37 + for(i=0;i<n;i++) 38 + cpu_relax(); 39 } 40 41 + EXPORT_SYMBOL(__const_udelay);