From: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>

From: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
      Jeff Dike <jdike@addtoit.com>

Currently there are two distinct definitions of current_thread_info (which has
its usual meaning) and current_thread (which is the same thing); so define the
second to be the first (for UML compatibility).  If needed, a search & replace
\<current_thread\> to current_thread_info and removing current_thread can be
done (that would be a separate, low-priority patch, however).

Also, since the involved headers include each other very deeply, we must fix
somehow this recursive inclusion or things won't compile.

Jeff Dike noted that this can be done easily, since the nasty chain of
includes can be broken by eliminating an include of current.h, and implemented
this.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/asm-um/current.h        |   13 ++++---------
 25-akpm/include/asm-um/ptrace-generic.h |    2 --
 25-akpm/include/asm-um/thread_info.h    |    1 +
 3 files changed, 5 insertions(+), 11 deletions(-)

diff -puN include/asm-um/current.h~uml-no-duplicate-current_thread-definition include/asm-um/current.h
--- 25/include/asm-um/current.h~uml-no-duplicate-current_thread-definition	2004-11-03 19:27:53.108716744 -0800
+++ 25-akpm/include/asm-um/current.h	2004-11-03 19:27:53.115715680 -0800
@@ -8,18 +8,13 @@
 
 #ifndef __ASSEMBLY__
 
-struct thread_info;
-
-#include "linux/config.h"
 #include "asm/page.h"
+#include "linux/thread_info.h"
 
-#define CURRENT_THREAD(dummy) (((unsigned long) &dummy) & \
-			        (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER))
-
-#define current_thread \
-	({ int dummy; ((struct thread_info *) CURRENT_THREAD(dummy)); })
+#define current (current_thread_info()->task)
 
-#define current (current_thread->task)
+/*Backward compatibility - it's used inside arch/um.*/
+#define current_thread current_thread_info()
 
 #endif /* __ASSEMBLY__ */
 
diff -puN include/asm-um/ptrace-generic.h~uml-no-duplicate-current_thread-definition include/asm-um/ptrace-generic.h
--- 25/include/asm-um/ptrace-generic.h~uml-no-duplicate-current_thread-definition	2004-11-03 19:27:53.109716592 -0800
+++ 25-akpm/include/asm-um/ptrace-generic.h	2004-11-03 19:27:53.115715680 -0800
@@ -10,8 +10,6 @@
 
 #include "linux/config.h"
 
-#include "asm/current.h"
-
 #define pt_regs pt_regs_subarch
 #define show_regs show_regs_subarch
 
diff -puN include/asm-um/thread_info.h~uml-no-duplicate-current_thread-definition include/asm-um/thread_info.h
--- 25/include/asm-um/thread_info.h~uml-no-duplicate-current_thread-definition	2004-11-03 19:27:53.111716288 -0800
+++ 25-akpm/include/asm-um/thread_info.h	2004-11-03 19:27:53.116715528 -0800
@@ -8,6 +8,7 @@
 
 #ifndef __ASSEMBLY__
 
+#include <linux/config.h>
 #include <asm/processor.h>
 #include <asm/types.h>
 
_