Move most arches to asm-generic/current.h
Subsystems (7)
PATCH 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.
--- arch/alpha/include/asm/Kbuild | 1 + arch/alpha/include/asm/current.h | 9 --------- arch/arm/include/asm/current.h | 9 +-------- arch/avr32/include/asm/Kbuild | 1 + arch/avr32/include/asm/current.h | 15 --------------- arch/cris/include/asm/Kbuild | 1 + 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 | 1 + 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, 24 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 +1 -0
@@ -2,6 +2,7 @@ include include/asm-generic/Kbuild.asm header-y += compiler.h header-y += console.h +header-y += current.h header-y += fpu.h header-y += gentrap.h header-y += pal.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 +1 -0
@@ -1,3 +1,4 @@ include include/asm-generic/Kbuild.asm header-y += cachectl.h +header-y += current.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 +1 -0
@@ -3,6 +3,7 @@ include include/asm-generic/Kbuild.asm header-y += arch-v10/ header-y += arch-v32/ +header-y += current.h header-y += ethernet.h header-y += etraxgpio.h header-y += rs485.h
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 + +header-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 +1 -0
@@ -1,3 +1,4 @@ include include/asm-generic/Kbuild.asm +header-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.
From: Stephen Boyd <[email protected]>
Date: Mon, 23 Apr 2012 20:18:29 -0700
Quoted 8 lines
Make
get_current()into a static inline function in the generic version ofcurrent.hso 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]>
For sparc bits:
Quoted 14 lines · Stephen Boyd
Make
get_current()into a static inline function in the generic version ofcurrent.hso 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]>---
arch/alpha/include/asm/Kbuild +0
-0
arch/alpha/include/asm/Kbuild include include/asm-generic/Kbuild.asm · line 5
Quoted 4 lines
arch/alpha/include/asm/Kbuild +1
-0@@ -2,6 +2,7 @@ include include/asm-generic/Kbuild.asm header-y += compiler.h header-y += console.h +header-y += current.h
Oops. This should be generic-y not header-y.
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.
Quoted 8 lines · Stephen Boyd
Make
get_current()into a static inline function in the generic version ofcurrent.hso 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]>
Quoted 8 lines · Stephen Boyd
Make
get_current()into a static inline function in the generic version ofcurrent.hso 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]>
For tile:
Signature · 2 lines
Chris Metcalf, Tilera Corp. http://www.tilera.com
Quoted 12 lines · Stephen Boyd
include/asm-generic/current.h +1
-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)
include/asm-generic/current.h line 16
Quoted 10 lines
include/asm-generic/current.h +7
-0+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 */
Does this need to be an inline function rather than a macro? I think I remember having trouble with header file dependencies when I tried making it an inline function initially and I don't know if those have been resolved.
I realize that the macro is ugly, but if you don't mind keeping it, that would be the safer option in terms of breaking some architecture in the process. If course if you can prove that all architectures using the generic implementation can use the inline function, I'm all for the change.
Aside from this, I very much like your patch.
Arnd
Quoted 28 lines · Arnd Bergmann
Quoted 12 lines · Stephen Boyd
include/asm-generic/current.h +1
-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)include/asm-generic/current.h line 16
Quoted 10 lines
include/asm-generic/current.h +7
-0+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 */ Does this need to be an inline function rather than a macro? I think I remember having trouble with header file dependencies when I tried making it an inline function initially and I don't know if those have been resolved.
Quoted 6 lines
I realize that the macro is ugly, but if you don't mind keeping it, that would be the safer option in terms of breaking some architecture in the process. If course if you can prove that all architectures using the generic implementation can use the inline function, I'm all for the change.
I admit I haven't compile tested this on all the affected architectures. Looking at the architectures that are migrated here I don't see any that are defining get_current() as a macro except for alpha. Should I drop alpha from the patch? Or would it be easier if someone threw this into linux-next and see if it blows up?
In the meantime I can scrounge around for those kernel.org cross-compilers and see if I can compile alpha.
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.
Arnd Bergmann
maintainerQuoted 8 lines · Stephen Boyd
I admit I haven't compile tested this on all the affected architectures. Looking at the architectures that are migrated here I don't see any that are defining
get_current()as a macro except for alpha. Should I drop alpha from the patch? Or would it be easier if someone threw this into linux-next and see if it blows up?In the meantime I can scrounge around for those kernel.org cross-compilers and see if I can compile alpha.
I'd say either get an Ack from the Alpha maintainers or drop that hunk from your patch.
Arnd
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Stephen Boyd
I admit I haven't compile tested this on all the affected architectures. Looking at the architectures that are migrated here I don't see any that are defining
get_current()as a macro except for alpha. Should I drop alpha from the patch? Or would it be easier if someone threw this into linux-next and see if it blows up?
Quoted 5 lines
Quoted 2 lines
In the meantime I can scrounge around for those kernel.org cross-compilers and see if I can compile alpha.
I'd say either get an Ack from the Alpha maintainers or drop that hunk from your patch.
Ok. Alpha maintainers, do you see any problem with a static inline function for get_current() instead of the current macro? My compile of alpha with the kernel.org 4.6.3 compilers doesn't show any new build failures than what is already there:
LD .tmp_vmlinux1drivers/built-in.o: In function `ide_set_disk_chs':
drivers/ide/ide.c:269:(.text+0x732a8): relocation truncated to fit: GPREL16 against .sbss' drivers/ide/ide.c:269:(.text+0x732b0): relocation truncated to fit: GPREL16 against .sbss' drivers/ide/ide.c:267:(.text+0x73310): relocation truncated to fit: GPREL16 against .sbss' drivers/ide/ide.c:267:(.text+0x73318): relocation truncated to fit: GPREL16 against .sbss' drivers/built-in.o: In function `ide_dev_apply_params':
drivers/ide/ide.c:299:(.text+0x73714): relocation truncated to fit: GPREL16 against .sbss' drivers/ide/ide.c:303:(.text+0x73724): relocation truncated to fit: GPREL16 against .sbss' drivers/ide/ide.c:308:(.text+0x73734): relocation truncated to fit: GPREL16 against .sbss' drivers/ide/ide.c:315:(.text+0x73744): relocation truncated to fit: GPREL16 against .sbss' drivers/built-in.o: In function `unexpected_intr':
drivers/ide/ide-io.c:734:(.text+0x74dfc): relocation truncated to fit: GPREL16 against .sbss' drivers/ide/ide-io.c:736:(.text+0x74e00): relocation truncated to fit: GPREL16 against .sbss' drivers/ide/ide-io.c:734:(.text+0x74e10): additional relocation overflows omitted from the output make[1]: *** [.tmp_vmlinux1] Error 1
make: *** [sub-make] Error 2
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.
Matt Turner
maintainerQuoted 29 lines · Stephen Boyd
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Stephen Boyd
I admit I haven't compile tested this on all the affected architectures. Looking at the architectures that are migrated here I don't see any that are defining
get_current()as a macro except for alpha. Should I drop alpha from the patch? Or would it be easier if someone threw this into linux-next and see if it blows up?Quoted 5 lines
Quoted 2 lines
In the meantime I can scrounge around for those kernel.org cross-compilers and see if I can compile alpha.
I'd say either get an Ack from the Alpha maintainers or drop that hunk from your patch.
Ok. Alpha maintainers, do you see any problem with a static inline function for
get_current()instead of the current macro? My compile of alpha with the kernel.org 4.6.3 compilers doesn't show any new build failures than what is already there:LD .tmp_vmlinux1
drivers/built-in.o: In function `ide_set_disk_chs':
drivers/ide/ide.c:269:(.text+0x732a8): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide.c:269:(.text+0x732b0): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide.c:267:(.text+0x73310): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide.c:267:(.text+0x73318): relocation truncated to fit: GPREL16 against.sbss'drivers/built-in.o: In function `ide_dev_apply_params':
drivers/ide/ide.c:299:(.text+0x73714): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide.c:303:(.text+0x73724): relocation truncated to fit: GPREL16 against.sbss'
Quoted 8 lines
drivers/ide/ide.c:308:(.text+0x73734): relocation truncated to fit: GPREL16 against
.sbss' drivers/ide/ide.c:315:(.text+0x73744): relocation truncated to fit: GPREL16 against.sbss'drivers/built-in.o: In function `unexpected_intr':
drivers/ide/ide-io.c:734:(.text+0x74dfc): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide-io.c:736:(.text+0x74e00): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide-io.c:734:(.text+0x74e10): additional relocation overflows omitted from the output make[1]: *** [.tmp_vmlinux1] Error 1
make: *** [sub-make] Error 2
I'll take a look later this week.
The relocation truncated to fit: GPREL16 against ... error is caused by the kernel being too large and compiling with -msmall-data. We've really got to do something about this -- this happens way too often to way too many people.
Matt
Arnd Bergmann
maintainerQuoted 13 lines · Stephen Boyd
My compile of
alpha with the kernel.org 4.6.3 compilers doesn't show any new build failures than what is already there:LD .tmp_vmlinux1
drivers/built-in.o: In function `ide_set_disk_chs':
drivers/ide/ide.c:269:(.text+0x732a8): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide.c:269:(.text+0x732b0): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide.c:267:(.text+0x73310): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide.c:267:(.text+0x73318): relocation truncated to fit: GPREL16 against.sbss'drivers/built-in.o: In function `ide_dev_apply_params':
drivers/ide/ide.c:299:(.text+0x73714): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide.c:303:(.text+0x73724): relocation truncated to fit: GPREL16 against.sbss'
Quoted 9 lines
drivers/ide/ide.c:308:(.text+0x73734): relocation truncated to fit: GPREL16 against
.sbss' drivers/ide/ide.c:315:(.text+0x73744): relocation truncated to fit: GPREL16 against.sbss'drivers/built-in.o: In function `unexpected_intr':
drivers/ide/ide-io.c:734:(.text+0x74dfc): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide-io.c:736:(.text+0x74e00): relocation truncated to fit: GPREL16 against.sbss' drivers/ide/ide-io.c:734:(.text+0x74e10): additional relocation overflows omitted from the output make[1]: *** [.tmp_vmlinux1] Error 1
make: *** [sub-make] Error 2
Ok, if you were hitting the problem that I remember, you would not get anything to build at all.
Arnd
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.
---
This stalled last round. Resending to collect more acks from arch maintainers and rebased against linux-next-20120822.
Arnd, can this go through the asm-generic tree?
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 | 1 + 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, 27 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 +1 -0
@@ -1,3 +1,4 @@ include include/asm-generic/Kbuild.asm generic-y += module.h +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,4 +1,6 @@ include include/asm-generic/Kbuild.asm +generic-y += current.h + header-y += pdc.h generic-y += word-at-a-time.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.