
From: Jeff Dike <jdike@addtoit.com>

Move the i386 __delay to sys-i386 and add an implementation for x86_64.
Also get rid of the definition of um_udelay_t.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/um/kernel/time_kern.c      |   19 ++-----------------
 25-akpm/arch/um/sys-i386/Makefile       |    2 +-
 25-akpm/arch/um/sys-i386/delay.c        |   14 ++++++++++++++
 25-akpm/arch/um/sys-x86_64/Makefile     |    2 +-
 25-akpm/arch/um/sys-x86_64/delay.c      |   26 ++++++++++++++++++++++++++
 25-akpm/include/asm-um/archparam-i386.h |    4 ----
 25-akpm/include/asm-um/archparam-ppc.h  |    4 ----
 7 files changed, 44 insertions(+), 27 deletions(-)

diff -puN arch/um/kernel/time_kern.c~uml-separate-out-the-time-code arch/um/kernel/time_kern.c
--- 25/arch/um/kernel/time_kern.c~uml-separate-out-the-time-code	2005-01-09 23:44:10.115625680 -0800
+++ 25-akpm/arch/um/kernel/time_kern.c	2005-01-09 23:44:10.127623856 -0800
@@ -136,22 +136,7 @@ long um_stime(int * tptr)
 	return 0;
 }
 
-/* XXX Needs to be moved under sys-i386 */
-void __delay(um_udelay_t time)
-{
-	/* Stolen from the i386 __loop_delay */
-	int d0;
-	__asm__ __volatile__(
-		"\tjmp 1f\n"
-		".align 16\n"
-		"1:\tjmp 2f\n"
-		".align 16\n"
-		"2:\tdecl %0\n\tjns 2b"
-		:"=&a" (d0)
-		:"0" (time));
-}
-
-void __udelay(um_udelay_t usecs)
+void __udelay(unsigned long usecs)
 {
 	int i, n;
 
@@ -159,7 +144,7 @@ void __udelay(um_udelay_t usecs)
 	for(i=0;i<n;i++) ;
 }
 
-void __const_udelay(um_udelay_t usecs)
+void __const_udelay(unsigned long usecs)
 {
 	int i, n;
 
diff -puN arch/um/sys-i386/delay.c~uml-separate-out-the-time-code arch/um/sys-i386/delay.c
--- 25/arch/um/sys-i386/delay.c~uml-separate-out-the-time-code	2005-01-09 23:44:10.116625528 -0800
+++ 25-akpm/arch/um/sys-i386/delay.c	2005-01-09 23:44:10.127623856 -0800
@@ -0,0 +1,14 @@
+void __delay(unsigned long time)
+{
+	/* Stolen from the i386 __loop_delay */
+	int d0;
+	__asm__ __volatile__(
+		"\tjmp 1f\n"
+		".align 16\n"
+		"1:\tjmp 2f\n"
+		".align 16\n"
+		"2:\tdecl %0\n\tjns 2b"
+		:"=&a" (d0)
+		:"0" (time));
+}
+
diff -puN arch/um/sys-i386/Makefile~uml-separate-out-the-time-code arch/um/sys-i386/Makefile
--- 25/arch/um/sys-i386/Makefile~uml-separate-out-the-time-code	2005-01-09 23:44:10.117625376 -0800
+++ 25-akpm/arch/um/sys-i386/Makefile	2005-01-09 23:44:10.127623856 -0800
@@ -1,4 +1,4 @@
-obj-y = bitops.o bugs.o checksum.o fault.o ksyms.o ldt.o ptrace.o \
+obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
 	ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o
 
 obj-$(CONFIG_HIGHMEM) += highmem.o
diff -puN arch/um/sys-x86_64/delay.c~uml-separate-out-the-time-code arch/um/sys-x86_64/delay.c
--- 25/arch/um/sys-x86_64/delay.c~uml-separate-out-the-time-code	2005-01-09 23:44:10.119625072 -0800
+++ 25-akpm/arch/um/sys-x86_64/delay.c	2005-01-09 23:44:10.128623704 -0800
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003 PathScale, Inc.
+ * Copied from arch/x86_64
+ *
+ * Licensed under the GPL
+ */
+
+#include "asm/processor.h"
+
+void __delay(unsigned long loops)
+{
+	unsigned long i;
+
+	for(i = 0; i < loops; i++) ;
+}
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only.  This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
diff -puN arch/um/sys-x86_64/Makefile~uml-separate-out-the-time-code arch/um/sys-x86_64/Makefile
--- 25/arch/um/sys-x86_64/Makefile~uml-separate-out-the-time-code	2005-01-09 23:44:10.120624920 -0800
+++ 25-akpm/arch/um/sys-x86_64/Makefile	2005-01-09 23:44:10.128623704 -0800
@@ -4,7 +4,7 @@
 # Licensed under the GPL
 #
 
-lib-y = bitops.o bugs.o csum-partial.o fault.o mem.o memcpy.o \
+lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \
 	ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \
 	syscalls.o sysrq.o thunk.o
 
diff -puN include/asm-um/archparam-i386.h~uml-separate-out-the-time-code include/asm-um/archparam-i386.h
--- 25/include/asm-um/archparam-i386.h~uml-separate-out-the-time-code	2005-01-09 23:44:10.122624616 -0800
+++ 25-akpm/include/asm-um/archparam-i386.h	2005-01-09 23:44:10.128623704 -0800
@@ -136,10 +136,6 @@ if ( vsyscall_ehdr ) {							      \
 #define R_386_GOTPC	10
 #define R_386_NUM	11
 
-/********* Bits for asm-um/delay.h **********/
-
-typedef unsigned long um_udelay_t;
-
 /********* Nothing for asm-um/hardirq.h **********/
 
 /********* Nothing for asm-um/hw_irq.h **********/
diff -puN include/asm-um/archparam-ppc.h~uml-separate-out-the-time-code include/asm-um/archparam-ppc.h
--- 25/include/asm-um/archparam-ppc.h~uml-separate-out-the-time-code	2005-01-09 23:44:10.123624464 -0800
+++ 25-akpm/include/asm-um/archparam-ppc.h	2005-01-09 23:44:10.129623552 -0800
@@ -21,10 +21,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_N
 #define ELF_DATA        ELFDATA2MSB
 #define ELF_ARCH	EM_PPC
 
-/********* Bits for asm-um/delay.h **********/
-
-typedef unsigned int um_udelay_t;
-
 /********* Bits for asm-um/hw_irq.h **********/
 
 struct hw_interrupt_type;
_
