Reduce get_current() to the asm-generic implementation where possible to remove duplicate cases. Note that this will lose the const attribute on get_current() for ARM and MN10300. This will be added back in a later patch for all architectures. Signed-off-by: David Howells <dhowells@xxxxxxxxxx> --- arch/alpha/include/asm/current.h | 10 +--------- arch/arm/include/asm/current.h | 16 +--------------- arch/avr32/include/asm/current.h | 16 +--------------- arch/cris/include/asm/current.h | 16 +--------------- arch/h8300/include/asm/current.h | 26 +------------------------- arch/m32r/include/asm/current.h | 16 +--------------- arch/m68k/include/asm/current.h | 13 ++----------- arch/mn10300/include/asm/current.h | 8 +------- arch/parisc/include/asm/current.h | 16 +--------------- arch/sparc/include/asm/current.h | 7 +------ arch/xtensa/include/asm/current.h | 13 +------------ 11 files changed, 12 insertions(+), 145 deletions(-) diff --git a/arch/alpha/include/asm/current.h b/arch/alpha/include/asm/current.h index 094d285..4c51401 100644 --- a/arch/alpha/include/asm/current.h +++ b/arch/alpha/include/asm/current.h @@ -1,9 +1 @@ -#ifndef _ALPHA_CURRENT_H -#define _ALPHA_CURRENT_H - -#include <linux/thread_info.h> - -#define get_current() (current_thread_info()->task) -#define current get_current() - -#endif /* _ALPHA_CURRENT_H */ +#include <asm-generic/current.h> diff --git a/arch/arm/include/asm/current.h b/arch/arm/include/asm/current.h index 75d21e2..4c51401 100644 --- a/arch/arm/include/asm/current.h +++ b/arch/arm/include/asm/current.h @@ -1,15 +1 @@ -#ifndef _ASMARM_CURRENT_H -#define _ASMARM_CURRENT_H - -#include <linux/thread_info.h> - -static inline struct task_struct *get_current(void) __attribute_const__; - -static inline struct task_struct *get_current(void) -{ - return current_thread_info()->task; -} - -#define current (get_current()) - -#endif /* _ASMARM_CURRENT_H */ +#include <asm-generic/current.h> diff --git a/arch/avr32/include/asm/current.h b/arch/avr32/include/asm/current.h index c7b0549..4c51401 100644 --- a/arch/avr32/include/asm/current.h +++ b/arch/avr32/include/asm/current.h @@ -1,15 +1 @@ -#ifndef __ASM_AVR32_CURRENT_H -#define __ASM_AVR32_CURRENT_H - -#include <linux/thread_info.h> - -struct task_struct; - -inline static struct task_struct * get_current(void) -{ - return current_thread_info()->task; -} - -#define current get_current() - -#endif /* __ASM_AVR32_CURRENT_H */ +#include <asm-generic/current.h> diff --git a/arch/cris/include/asm/current.h b/arch/cris/include/asm/current.h index 5f5c0ef..4c51401 100644 --- a/arch/cris/include/asm/current.h +++ b/arch/cris/include/asm/current.h @@ -1,15 +1 @@ -#ifndef _CRIS_CURRENT_H -#define _CRIS_CURRENT_H - -#include <linux/thread_info.h> - -struct task_struct; - -static inline struct task_struct * get_current(void) -{ - return current_thread_info()->task; -} - -#define current get_current() - -#endif /* !(_CRIS_CURRENT_H) */ +#include <asm-generic/current.h> diff --git a/arch/h8300/include/asm/current.h b/arch/h8300/include/asm/current.h index 57d74ee..4c51401 100644 --- a/arch/h8300/include/asm/current.h +++ b/arch/h8300/include/asm/current.h @@ -1,25 +1 @@ -#ifndef _H8300_CURRENT_H -#define _H8300_CURRENT_H -/* - * current.h - * (C) Copyright 2000, Lineo, David McCullough <davidm@xxxxxxxxx> - * (C) Copyright 2002, Greg Ungerer (gerg@xxxxxxxxxxxx) - * - * rather than dedicate a register (as the m68k source does), we - * just keep a global, we should probably just change it all to be - * current and lose _current_task. - */ - -#include <linux/thread_info.h> -#include <asm/thread_info.h> - -struct task_struct; - -static inline struct task_struct *get_current(void) -{ - return(current_thread_info()->task); -} - -#define current get_current() - -#endif /* _H8300_CURRENT_H */ +#include <asm-generic/current.h> diff --git a/arch/m32r/include/asm/current.h b/arch/m32r/include/asm/current.h index 7859d86..4c51401 100644 --- a/arch/m32r/include/asm/current.h +++ b/arch/m32r/include/asm/current.h @@ -1,15 +1 @@ -#ifndef _ASM_M32R_CURRENT_H -#define _ASM_M32R_CURRENT_H - -#include <linux/thread_info.h> - -struct task_struct; - -static __inline__ struct task_struct *get_current(void) -{ - return current_thread_info()->task; -} - -#define current (get_current()) - -#endif /* _ASM_M32R_CURRENT_H */ +#include <asm-generic/current.h> diff --git a/arch/m68k/include/asm/current.h b/arch/m68k/include/asm/current.h index 91fcc53..e279667 100644 --- a/arch/m68k/include/asm/current.h +++ b/arch/m68k/include/asm/current.h @@ -12,17 +12,8 @@ register struct task_struct *current __asm__("%a2"); * just keep a global, we should probably just change it all to be * current and lose _current_task. */ -#include <linux/thread_info.h> +#include <asm-generic/current.h> -struct task_struct; - -static inline struct task_struct *get_current(void) -{ - return(current_thread_info()->task); -} - -#define current get_current() - -#endif /* CONFNIG_MMU */ +#endif /* CONFIG_MMU */ #endif /* !(_M68K_CURRENT_H) */ diff --git a/arch/mn10300/include/asm/current.h b/arch/mn10300/include/asm/current.h index ca6027d..c1ee370 100644 --- a/arch/mn10300/include/asm/current.h +++ b/arch/mn10300/include/asm/current.h @@ -25,13 +25,7 @@ register struct task_struct *const current asm("e2") __attribute__((used)); extern struct task_struct *__current; #else -static inline __attribute__((const)) -struct task_struct *get_current(void) -{ - return current_thread_info()->task; -} - -#define current get_current() +#include <asm-generic/current.h> #endif #endif /* _ASM_CURRENT_H */ diff --git a/arch/parisc/include/asm/current.h b/arch/parisc/include/asm/current.h index 0fb9338..4c51401 100644 --- a/arch/parisc/include/asm/current.h +++ b/arch/parisc/include/asm/current.h @@ -1,15 +1 @@ -#ifndef _PARISC_CURRENT_H -#define _PARISC_CURRENT_H - -#include <linux/thread_info.h> - -struct task_struct; - -static inline struct task_struct * get_current(void) -{ - return current_thread_info()->task; -} - -#define current get_current() - -#endif /* !(_PARISC_CURRENT_H) */ +#include <asm-generic/current.h> diff --git a/arch/sparc/include/asm/current.h b/arch/sparc/include/asm/current.h index 10a0df5..f04fd6c 100644 --- a/arch/sparc/include/asm/current.h +++ b/arch/sparc/include/asm/current.h @@ -23,12 +23,7 @@ register struct task_struct *current asm("g4"); * Two stage process (inline + #define) for type-checking. * We also obfuscate get_current() to check if anyone used that by mistake. */ -struct task_struct; -static inline struct task_struct *__get_current(void) -{ - return current_thread_info()->task; -} -#define current __get_current() +#include <asm-generic/current.h> #endif #endif /* !(_SPARC_CURRENT_H) */ diff --git a/arch/xtensa/include/asm/current.h b/arch/xtensa/include/asm/current.h index 8d1eb5d..c3398ce 100644 --- a/arch/xtensa/include/asm/current.h +++ b/arch/xtensa/include/asm/current.h @@ -12,18 +12,7 @@ #define _XTENSA_CURRENT_H #ifndef __ASSEMBLY__ - -#include <linux/thread_info.h> - -struct task_struct; - -static inline struct task_struct *get_current(void) -{ - return current_thread_info()->task; -} - -#define current get_current() - +#include <asm-generic/current.h> #else #define CURRENT_SHIFT 13 -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html