diff options
author | Jeff Dike <jdike@addtoit.com> | 2005-05-20 16:59:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-20 18:48:17 -0400 |
commit | 060e352236ece3325a684c72817fbacdac597574 (patch) | |
tree | 32d573bfa99e31a5318eda247246261fdd13cd3e /arch | |
parent | 13479d52c7a61a18900d7f36730b7d3b43723d97 (diff) |
[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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/sys-i386/delay.c | 16 | ||||
-rw-r--r-- | arch/um/sys-x86_64/delay.c | 33 |
2 files changed, 27 insertions, 22 deletions
diff --git a/arch/um/sys-i386/delay.c b/arch/um/sys-i386/delay.c index e9892eef51ce..2c11b9770e8b 100644 --- a/arch/um/sys-i386/delay.c +++ b/arch/um/sys-i386/delay.c | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "linux/delay.h" | 1 | #include <linux/module.h> |
2 | #include "asm/param.h" | 2 | #include <linux/kernel.h> |
3 | #include <linux/delay.h> | ||
4 | #include <asm/param.h> | ||
3 | 5 | ||
4 | void __delay(unsigned long time) | 6 | void __delay(unsigned long time) |
5 | { | 7 | { |
@@ -20,13 +22,19 @@ void __udelay(unsigned long usecs) | |||
20 | int i, n; | 22 | int i, n; |
21 | 23 | ||
22 | n = (loops_per_jiffy * HZ * usecs) / MILLION; | 24 | n = (loops_per_jiffy * HZ * usecs) / MILLION; |
23 | for(i=0;i<n;i++) ; | 25 | for(i=0;i<n;i++) |
26 | cpu_relax(); | ||
24 | } | 27 | } |
25 | 28 | ||
29 | EXPORT_SYMBOL(__udelay); | ||
30 | |||
26 | void __const_udelay(unsigned long usecs) | 31 | void __const_udelay(unsigned long usecs) |
27 | { | 32 | { |
28 | int i, n; | 33 | int i, n; |
29 | 34 | ||
30 | n = (loops_per_jiffy * HZ * usecs) / MILLION; | 35 | n = (loops_per_jiffy * HZ * usecs) / MILLION; |
31 | for(i=0;i<n;i++) ; | 36 | for(i=0;i<n;i++) |
37 | cpu_relax(); | ||
32 | } | 38 | } |
39 | |||
40 | EXPORT_SYMBOL(__const_udelay); | ||
diff --git a/arch/um/sys-x86_64/delay.c b/arch/um/sys-x86_64/delay.c index 651332aeec22..137f4446b439 100644 --- a/arch/um/sys-x86_64/delay.c +++ b/arch/um/sys-x86_64/delay.c | |||
@@ -5,40 +5,37 @@ | |||
5 | * Licensed under the GPL | 5 | * Licensed under the GPL |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "linux/delay.h" | 8 | #include <linux/module.h> |
9 | #include "asm/processor.h" | 9 | #include <linux/delay.h> |
10 | #include "asm/param.h" | 10 | #include <asm/processor.h> |
11 | #include <asm/param.h> | ||
11 | 12 | ||
12 | void __delay(unsigned long loops) | 13 | void __delay(unsigned long loops) |
13 | { | 14 | { |
14 | unsigned long i; | 15 | unsigned long i; |
15 | 16 | ||
16 | for(i = 0; i < loops; i++) ; | 17 | for(i = 0; i < loops; i++) |
18 | cpu_relax(); | ||
17 | } | 19 | } |
18 | 20 | ||
19 | void __udelay(unsigned long usecs) | 21 | void __udelay(unsigned long usecs) |
20 | { | 22 | { |
21 | int i, n; | 23 | unsigned long i, n; |
22 | 24 | ||
23 | n = (loops_per_jiffy * HZ * usecs) / MILLION; | 25 | n = (loops_per_jiffy * HZ * usecs) / MILLION; |
24 | for(i=0;i<n;i++) ; | 26 | for(i=0;i<n;i++) |
27 | cpu_relax(); | ||
25 | } | 28 | } |
26 | 29 | ||
30 | EXPORT_SYMBOL(__udelay); | ||
31 | |||
27 | void __const_udelay(unsigned long usecs) | 32 | void __const_udelay(unsigned long usecs) |
28 | { | 33 | { |
29 | int i, n; | 34 | unsigned long i, n; |
30 | 35 | ||
31 | n = (loops_per_jiffy * HZ * usecs) / MILLION; | 36 | n = (loops_per_jiffy * HZ * usecs) / MILLION; |
32 | for(i=0;i<n;i++) ; | 37 | for(i=0;i<n;i++) |
38 | cpu_relax(); | ||
33 | } | 39 | } |
34 | 40 | ||
35 | /* | 41 | EXPORT_SYMBOL(__const_udelay); |
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 | */ | ||