Move most arches to asm-generic/current.h
Subsystems (7)
PATCH v2 1/1 Move most arches to asm-generic/current.h
Make get_current() into a static inline function in the generic version of current.h so we match what almost every architecture is doing. This allows us to move most of the arches over to this generic header instead of redefining the same thing over and over in each asm directory.
Signed-off-by Stephen Boyd <[email protected]>
Acked-by Marc Gauthier <[email protected]>
Acked-by David S. Miller <[email protected]>
---
Changes since v1:
* Fixed generic-y vs header-y
arch/alpha/include/asm/Kbuild | 2 ++ arch/alpha/include/asm/current.h | 9 --------- arch/arm/include/asm/current.h | 9 +-------- arch/avr32/include/asm/Kbuild | 2 ++ arch/avr32/include/asm/current.h | 15 --------------- arch/cris/include/asm/Kbuild | 2 ++ arch/cris/include/asm/current.h | 15 --------------- arch/h8300/include/asm/current.h | 26 +------------------------- arch/m32r/include/asm/Kbuild | 2 ++ arch/m32r/include/asm/current.h | 15 --------------- arch/m68k/include/asm/current.h | 18 ++---------------- arch/mn10300/include/asm/current.h | 8 +------- arch/parisc/include/asm/Kbuild | 2 ++ arch/parisc/include/asm/current.h | 15 --------------- arch/sparc/include/asm/current.h | 16 +++------------- arch/tile/include/asm/current.h | 10 +--------- arch/xtensa/include/asm/current.h | 11 +---------- include/asm-generic/current.h | 9 ++++++++- 18 files changed, 28 insertions(+), 158 deletions(-) delete mode 100644 arch/alpha/include/asm/current.h delete mode 100644 arch/avr32/include/asm/current.h delete mode 100644 arch/cris/include/asm/current.h delete mode 100644 arch/m32r/include/asm/current.h delete mode 100644 arch/parisc/include/asm/current.h
arch/alpha/include/asm/Kbuild +2 -0
@@ -1,5 +1,7 @@ include include/asm-generic/Kbuild.asm +generic-y += current.h + header-y += compiler.h header-y += console.h header-y += fpu.h
arch/alpha/include/asm/current.h deleted +0 -9
@@ -1,9 +0,0 @@ -#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 */
arch/arm/include/asm/current.h +1 -8
@@ -1,15 +1,8 @@#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()) +#include <asm-generic/current.h> #endif /* _ASMARM_CURRENT_H */
arch/avr32/include/asm/Kbuild +2 -0
@@ -1,3 +1,5 @@ include include/asm-generic/Kbuild.asm +generic-y += current.h + header-y += cachectl.h
arch/avr32/include/asm/current.h deleted +0 -15
@@ -1,15 +0,0 @@ -#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 */
arch/cris/include/asm/Kbuild +2 -0
@@ -1,5 +1,7 @@ include include/asm-generic/Kbuild.asm +generic-y += current.h + header-y += arch-v10/ header-y += arch-v32/
arch/cris/include/asm/current.h deleted +0 -15
@@ -1,15 +0,0 @@ -#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) */
arch/h8300/include/asm/current.h +1 -25
@@ -1,25 +1 @@ -#ifndef _H8300_CURRENT_H -#define _H8300_CURRENT_H -/* -* current.h -* (C) Copyright 2000, Lineo, David McCullough <[email protected]> -* (C) Copyright 2002, Greg Ungerer ([email protected]) -* -* 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>
arch/m32r/include/asm/Kbuild +2 -0
@@ -1 +1,3 @@ include include/asm-generic/Kbuild.asm + +generic-y += current.h
arch/m32r/include/asm/current.h deleted +0 -15
@@ -1,15 +0,0 @@ -#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 */
arch/m68k/include/asm/current.h +2 -16
@@ -7,22 +7,8 @@ register struct task_struct *current __asm__("%a2");#else -/* -* 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-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) */
arch/mn10300/include/asm/current.h +1 -7
@@ -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 */
arch/parisc/include/asm/Kbuild +2 -0
@@ -1,3 +1,5 @@ include include/asm-generic/Kbuild.asm +generic-y += current.h + header-y += pdc.h
arch/parisc/include/asm/current.h deleted +0 -15
@@ -1,15 +0,0 @@ -#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) */
arch/sparc/include/asm/current.h +3 -13
@@ -11,24 +11,14 @@#ifndef _SPARC_CURRENT_H#define _SPARC_CURRENT_H -#include <linux/thread_info.h> -#ifdef CONFIG_SPARC64 +#include <linux/thread_info.h> registerstruct task_struct *current asm("g4" );#endif #ifdef CONFIG_SPARC32 -/* We might want to consider using %g4 like sparc64 to shave a few cycles. -* -* 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() +/* We might want to consider using %g4 like sparc64 to shave a few cycles. */ +#include <asm-generic/current.h> #endif #endif /* !(_SPARC_CURRENT_H) */
arch/tile/include/asm/current.h +1 -9
@@ -15,15 +15,7 @@#ifndef _ASM_TILE_CURRENT_H#define _ASM_TILE_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() +#include <asm-generic/current.h> /* Return a usable "task_struct" pointer even if the real one is corrupt. */ struct task_struct *validate_current (void );
arch/xtensa/include/asm/current.h +1 -10
@@ -13,16 +13,7 @@#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
include/asm-generic/current.h +8 -1
@@ -1,9 +1,16 @@#ifndef __ASM_GENERIC_CURRENT_H#define __ASM_GENERIC_CURRENT_H +#include <linux/compiler.h> #include <linux/thread_info.h> -#define get_current () (current_thread_info()->task) +struct task_struct ; + +static __always_inline struct task_struct *get_current(void) +{ +return current_thread_info ()->task; +} +#define current get_current()#endif /* __ASM_GENERIC_CURRENT_H */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.