* [PATCH] Move most arches to asm-generic/current.h
@ 2012-04-24 3:18 Stephen Boyd
2012-04-24 3:30 ` David Miller
` (5 more replies)
0 siblings, 6 replies; 14+ messages in thread
From: Stephen Boyd @ 2012-04-24 3:18 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-kernel, linux-arch
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 <sboyd@codeaurora.org>
Cc: linux-arch@vger.kernel.org
---
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
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index e423def..8b8f979 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -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
diff --git a/arch/alpha/include/asm/current.h b/arch/alpha/include/asm/current.h
deleted file mode 100644
index 094d285..0000000
--- a/arch/alpha/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/arm/include/asm/current.h b/arch/arm/include/asm/current.h
index 75d21e2..7dd0eec 100644
--- a/arch/arm/include/asm/current.h
+++ b/arch/arm/include/asm/current.h
@@ -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 */
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 3136628..31e4050 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -1,3 +1,4 @@
include include/asm-generic/Kbuild.asm
header-y += cachectl.h
+header-y += current.h
diff --git a/arch/avr32/include/asm/current.h b/arch/avr32/include/asm/current.h
deleted file mode 100644
index c7b0549..0000000
--- a/arch/avr32/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 04d02a5..f0b4add 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -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
diff --git a/arch/cris/include/asm/current.h b/arch/cris/include/asm/current.h
deleted file mode 100644
index 5f5c0efd..0000000
--- a/arch/cris/include/asm/current.h
+++ /dev/null
@@ -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) */
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@lineo.com>
- * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
- *
- * 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/Kbuild b/arch/m32r/include/asm/Kbuild
index c68e168..60e3d50 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -1 +1,3 @@
include include/asm-generic/Kbuild.asm
+
+header-y += current.h
diff --git a/arch/m32r/include/asm/current.h b/arch/m32r/include/asm/current.h
deleted file mode 100644
index 7859d86..0000000
--- a/arch/m32r/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/m68k/include/asm/current.h b/arch/m68k/include/asm/current.h
index 91fcc53..eb9ae55 100644
--- a/arch/m68k/include/asm/current.h
+++ b/arch/m68k/include/asm/current.h
@@ -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) */
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/Kbuild b/arch/parisc/include/asm/Kbuild
index 19a434f..2911a52 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -1,3 +1,4 @@
include include/asm-generic/Kbuild.asm
+header-y += current.h
header-y += pdc.h
diff --git a/arch/parisc/include/asm/current.h b/arch/parisc/include/asm/current.h
deleted file mode 100644
index 0fb9338..0000000
--- a/arch/parisc/include/asm/current.h
+++ /dev/null
@@ -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) */
diff --git a/arch/sparc/include/asm/current.h b/arch/sparc/include/asm/current.h
index 10a0df5..023b330 100644
--- a/arch/sparc/include/asm/current.h
+++ b/arch/sparc/include/asm/current.h
@@ -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>
register struct 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) */
diff --git a/arch/tile/include/asm/current.h b/arch/tile/include/asm/current.h
index da21acf..3fe65f7 100644
--- a/arch/tile/include/asm/current.h
+++ b/arch/tile/include/asm/current.h
@@ -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);
diff --git a/arch/xtensa/include/asm/current.h b/arch/xtensa/include/asm/current.h
index 8d1eb5d..8c98868 100644
--- a/arch/xtensa/include/asm/current.h
+++ b/arch/xtensa/include/asm/current.h
@@ -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
diff --git a/include/asm-generic/current.h b/include/asm-generic/current.h
index 5e86f6a..bbfb795 100644
--- a/include/asm-generic/current.h
+++ b/include/asm-generic/current.h
@@ -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 */
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-24 3:18 [PATCH] Move most arches to asm-generic/current.h Stephen Boyd
@ 2012-04-24 3:30 ` David Miller
2012-04-26 17:51 ` Stephen Boyd
` (4 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2012-04-24 3:30 UTC (permalink / raw)
To: sboyd; +Cc: arnd, linux-kernel, linux-arch
From: Stephen Boyd <sboyd@codeaurora.org>
Date: Mon, 23 Apr 2012 20:18:29 -0700
> 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 <sboyd@codeaurora.org>
> Cc: linux-arch@vger.kernel.org
For sparc bits:
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-24 3:18 [PATCH] Move most arches to asm-generic/current.h Stephen Boyd
2012-04-24 3:30 ` David Miller
@ 2012-04-26 17:51 ` Stephen Boyd
2012-04-30 9:08 ` David Howells
` (3 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2012-04-26 17:51 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-kernel, linux-arch
On 04/23/12 20:18, Stephen Boyd wrote:
> 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 <sboyd@codeaurora.org>
> Cc: linux-arch@vger.kernel.org
> ---
> diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
> index e423def..8b8f979 100644
> --- a/arch/alpha/include/asm/Kbuild
> +++ b/arch/alpha/include/asm/Kbuild
> @@ -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.
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-24 3:18 [PATCH] Move most arches to asm-generic/current.h Stephen Boyd
2012-04-24 3:30 ` David Miller
2012-04-26 17:51 ` Stephen Boyd
@ 2012-04-30 9:08 ` David Howells
2012-04-30 12:51 ` Chris Metcalf
` (2 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: David Howells @ 2012-04-30 9:08 UTC (permalink / raw)
To: Stephen Boyd; +Cc: dhowells, Arnd Bergmann, linux-kernel, linux-arch
Stephen Boyd <sboyd@codeaurora.org> wrote:
> 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 <sboyd@codeaurora.org>
> Cc: linux-arch@vger.kernel.org
Acked-by: David Howells <dhowells@redhat.com> [MN10300]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-24 3:18 [PATCH] Move most arches to asm-generic/current.h Stephen Boyd
` (2 preceding siblings ...)
2012-04-30 9:08 ` David Howells
@ 2012-04-30 12:51 ` Chris Metcalf
2012-04-30 14:15 ` Arnd Bergmann
2012-08-22 19:25 ` [PATCH/RESEND] " Stephen Boyd
5 siblings, 0 replies; 14+ messages in thread
From: Chris Metcalf @ 2012-04-30 12:51 UTC (permalink / raw)
To: Stephen Boyd; +Cc: Arnd Bergmann, linux-kernel, linux-arch
On 4/23/2012 11:18 PM, Stephen Boyd wrote:
> 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 <sboyd@codeaurora.org>
> Cc: linux-arch@vger.kernel.org
For tile:
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-24 3:18 [PATCH] Move most arches to asm-generic/current.h Stephen Boyd
` (3 preceding siblings ...)
2012-04-30 12:51 ` Chris Metcalf
@ 2012-04-30 14:15 ` Arnd Bergmann
2012-04-30 16:35 ` Stephen Boyd
2012-08-22 19:25 ` [PATCH/RESEND] " Stephen Boyd
5 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2012-04-30 14:15 UTC (permalink / raw)
To: Stephen Boyd; +Cc: linux-kernel, linux-arch
On Tuesday 24 April 2012, Stephen Boyd wrote:
> diff --git a/include/asm-generic/current.h b/include/asm-generic/current.h
> index 5e86f6a..bbfb795 100644
> --- a/include/asm-generic/current.h
> +++ b/include/asm-generic/current.h
> @@ -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 */
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.
Acked-by: Arnd Bergmann <arnd@arndb.de>
Arnd
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-30 14:15 ` Arnd Bergmann
@ 2012-04-30 16:35 ` Stephen Boyd
2012-04-30 16:38 ` Arnd Bergmann
0 siblings, 1 reply; 14+ messages in thread
From: Stephen Boyd @ 2012-04-30 16:35 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-kernel, linux-arch
On 04/30/12 07:15, Arnd Bergmann wrote:
> On Tuesday 24 April 2012, Stephen Boyd wrote:
>> diff --git a/include/asm-generic/current.h b/include/asm-generic/current.h
>> index 5e86f6a..bbfb795 100644
>> --- a/include/asm-generic/current.h
>> +++ b/include/asm-generic/current.h
>> @@ -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 */
> 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.
>
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.
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-30 16:35 ` Stephen Boyd
@ 2012-04-30 16:38 ` Arnd Bergmann
2012-04-30 17:07 ` Stephen Boyd
0 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2012-04-30 16:38 UTC (permalink / raw)
To: Stephen Boyd; +Cc: linux-kernel, linux-arch
On Monday 30 April 2012, Stephen Boyd wrote:
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-30 16:38 ` Arnd Bergmann
@ 2012-04-30 17:07 ` Stephen Boyd
2012-04-30 17:07 ` Stephen Boyd
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Stephen Boyd @ 2012-04-30 17:07 UTC (permalink / raw)
To: linux-alpha
Cc: Arnd Bergmann, linux-kernel, linux-arch, Richard Henderson,
Ivan Kokshaysky, Matt Turner
On 04/30/12 09:38, Arnd Bergmann wrote:
> On Monday 30 April 2012, Stephen Boyd wrote:
>> 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.
>
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'
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
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-30 17:07 ` Stephen Boyd
@ 2012-04-30 17:07 ` Stephen Boyd
2012-04-30 17:11 ` Matt Turner
2012-04-30 19:52 ` Arnd Bergmann
2 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2012-04-30 17:07 UTC (permalink / raw)
To: linux-alpha
Cc: Arnd Bergmann, linux-kernel, linux-arch, Richard Henderson,
Ivan Kokshaysky, Matt Turner
On 04/30/12 09:38, Arnd Bergmann wrote:
> On Monday 30 April 2012, Stephen Boyd wrote:
>> 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.
>
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'
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
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-30 17:07 ` Stephen Boyd
2012-04-30 17:07 ` Stephen Boyd
@ 2012-04-30 17:11 ` Matt Turner
2012-04-30 19:52 ` Arnd Bergmann
2 siblings, 0 replies; 14+ messages in thread
From: Matt Turner @ 2012-04-30 17:11 UTC (permalink / raw)
To: Stephen Boyd
Cc: linux-alpha, Arnd Bergmann, linux-kernel, linux-arch,
Richard Henderson, Ivan Kokshaysky
On Mon, Apr 30, 2012 at 1:07 PM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 04/30/12 09:38, Arnd Bergmann wrote:
>
>> On Monday 30 April 2012, Stephen Boyd wrote:
>>> 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.
>>
>
> 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'
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move most arches to asm-generic/current.h
2012-04-30 17:07 ` Stephen Boyd
2012-04-30 17:07 ` Stephen Boyd
2012-04-30 17:11 ` Matt Turner
@ 2012-04-30 19:52 ` Arnd Bergmann
2 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2012-04-30 19:52 UTC (permalink / raw)
To: Stephen Boyd
Cc: linux-alpha, linux-kernel, linux-arch, Richard Henderson,
Ivan Kokshaysky, Matt Turner
On Monday 30 April 2012, Stephen Boyd wrote:
> 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'
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH/RESEND] Move most arches to asm-generic/current.h
2012-04-24 3:18 [PATCH] Move most arches to asm-generic/current.h Stephen Boyd
` (4 preceding siblings ...)
2012-04-30 14:15 ` Arnd Bergmann
@ 2012-08-22 19:25 ` Stephen Boyd
2012-08-22 19:25 ` Stephen Boyd
5 siblings, 1 reply; 14+ messages in thread
From: Stephen Boyd @ 2012-08-22 19:25 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, linux-arch
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 <sboyd@codeaurora.org>
Cc: linux-arch@vger.kernel.org
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Marc Gauthier <marc@tensilica.com> [Xtensa]
Acked-by: David S. Miller <davem@davemloft.net> [Sparc]
Acked-by: Chris Metcalf <cmetcalf@tilera.com> [Tile]
Acked-by: David Howells <dhowells@redhat.com> [MN10300]
---
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
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index e423def..37f1cac 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -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
diff --git a/arch/alpha/include/asm/current.h b/arch/alpha/include/asm/current.h
deleted file mode 100644
index 094d285..0000000
--- a/arch/alpha/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/arm/include/asm/current.h b/arch/arm/include/asm/current.h
index 75d21e2..7dd0eec 100644
--- a/arch/arm/include/asm/current.h
+++ b/arch/arm/include/asm/current.h
@@ -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 */
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 3136628..851e4b0 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -1,3 +1,5 @@
include include/asm-generic/Kbuild.asm
+generic-y += current.h
+
header-y += cachectl.h
diff --git a/arch/avr32/include/asm/current.h b/arch/avr32/include/asm/current.h
deleted file mode 100644
index c7b0549..0000000
--- a/arch/avr32/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 28b690d..ed7b868 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -1,5 +1,7 @@
include include/asm-generic/Kbuild.asm
+generic-y += current.h
+
header-y += arch-v10/
header-y += arch-v32/
diff --git a/arch/cris/include/asm/current.h b/arch/cris/include/asm/current.h
deleted file mode 100644
index 5f5c0efd..0000000
--- a/arch/cris/include/asm/current.h
+++ /dev/null
@@ -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) */
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@lineo.com>
- * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
- *
- * 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/Kbuild b/arch/m32r/include/asm/Kbuild
index 871382d..2d20ee0 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -1,3 +1,4 @@
include include/asm-generic/Kbuild.asm
generic-y += module.h
+generic-y += current.h
diff --git a/arch/m32r/include/asm/current.h b/arch/m32r/include/asm/current.h
deleted file mode 100644
index 7859d86..0000000
--- a/arch/m32r/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/m68k/include/asm/current.h b/arch/m68k/include/asm/current.h
index 91fcc53..eb9ae55 100644
--- a/arch/m68k/include/asm/current.h
+++ b/arch/m68k/include/asm/current.h
@@ -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) */
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/Kbuild b/arch/parisc/include/asm/Kbuild
index 4383707..d702dac 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -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
diff --git a/arch/parisc/include/asm/current.h b/arch/parisc/include/asm/current.h
deleted file mode 100644
index 0fb9338..0000000
--- a/arch/parisc/include/asm/current.h
+++ /dev/null
@@ -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) */
diff --git a/arch/sparc/include/asm/current.h b/arch/sparc/include/asm/current.h
index 10a0df5..023b330 100644
--- a/arch/sparc/include/asm/current.h
+++ b/arch/sparc/include/asm/current.h
@@ -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>
register struct 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) */
diff --git a/arch/tile/include/asm/current.h b/arch/tile/include/asm/current.h
index da21acf..3fe65f7 100644
--- a/arch/tile/include/asm/current.h
+++ b/arch/tile/include/asm/current.h
@@ -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);
diff --git a/arch/xtensa/include/asm/current.h b/arch/xtensa/include/asm/current.h
index 8d1eb5d..8c98868 100644
--- a/arch/xtensa/include/asm/current.h
+++ b/arch/xtensa/include/asm/current.h
@@ -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
diff --git a/include/asm-generic/current.h b/include/asm-generic/current.h
index 5e86f6a..bbfb795 100644
--- a/include/asm-generic/current.h
+++ b/include/asm-generic/current.h
@@ -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 */
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH/RESEND] Move most arches to asm-generic/current.h
2012-08-22 19:25 ` [PATCH/RESEND] " Stephen Boyd
@ 2012-08-22 19:25 ` Stephen Boyd
0 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2012-08-22 19:25 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, linux-arch
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 <sboyd@codeaurora.org>
Cc: linux-arch@vger.kernel.org
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Marc Gauthier <marc@tensilica.com> [Xtensa]
Acked-by: David S. Miller <davem@davemloft.net> [Sparc]
Acked-by: Chris Metcalf <cmetcalf@tilera.com> [Tile]
Acked-by: David Howells <dhowells@redhat.com> [MN10300]
---
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
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index e423def..37f1cac 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -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
diff --git a/arch/alpha/include/asm/current.h b/arch/alpha/include/asm/current.h
deleted file mode 100644
index 094d285..0000000
--- a/arch/alpha/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/arm/include/asm/current.h b/arch/arm/include/asm/current.h
index 75d21e2..7dd0eec 100644
--- a/arch/arm/include/asm/current.h
+++ b/arch/arm/include/asm/current.h
@@ -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 */
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 3136628..851e4b0 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -1,3 +1,5 @@
include include/asm-generic/Kbuild.asm
+generic-y += current.h
+
header-y += cachectl.h
diff --git a/arch/avr32/include/asm/current.h b/arch/avr32/include/asm/current.h
deleted file mode 100644
index c7b0549..0000000
--- a/arch/avr32/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 28b690d..ed7b868 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -1,5 +1,7 @@
include include/asm-generic/Kbuild.asm
+generic-y += current.h
+
header-y += arch-v10/
header-y += arch-v32/
diff --git a/arch/cris/include/asm/current.h b/arch/cris/include/asm/current.h
deleted file mode 100644
index 5f5c0efd..0000000
--- a/arch/cris/include/asm/current.h
+++ /dev/null
@@ -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) */
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@lineo.com>
- * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
- *
- * 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/Kbuild b/arch/m32r/include/asm/Kbuild
index 871382d..2d20ee0 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -1,3 +1,4 @@
include include/asm-generic/Kbuild.asm
generic-y += module.h
+generic-y += current.h
diff --git a/arch/m32r/include/asm/current.h b/arch/m32r/include/asm/current.h
deleted file mode 100644
index 7859d86..0000000
--- a/arch/m32r/include/asm/current.h
+++ /dev/null
@@ -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 */
diff --git a/arch/m68k/include/asm/current.h b/arch/m68k/include/asm/current.h
index 91fcc53..eb9ae55 100644
--- a/arch/m68k/include/asm/current.h
+++ b/arch/m68k/include/asm/current.h
@@ -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) */
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/Kbuild b/arch/parisc/include/asm/Kbuild
index 4383707..d702dac 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -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
diff --git a/arch/parisc/include/asm/current.h b/arch/parisc/include/asm/current.h
deleted file mode 100644
index 0fb9338..0000000
--- a/arch/parisc/include/asm/current.h
+++ /dev/null
@@ -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) */
diff --git a/arch/sparc/include/asm/current.h b/arch/sparc/include/asm/current.h
index 10a0df5..023b330 100644
--- a/arch/sparc/include/asm/current.h
+++ b/arch/sparc/include/asm/current.h
@@ -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>
register struct 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) */
diff --git a/arch/tile/include/asm/current.h b/arch/tile/include/asm/current.h
index da21acf..3fe65f7 100644
--- a/arch/tile/include/asm/current.h
+++ b/arch/tile/include/asm/current.h
@@ -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);
diff --git a/arch/xtensa/include/asm/current.h b/arch/xtensa/include/asm/current.h
index 8d1eb5d..8c98868 100644
--- a/arch/xtensa/include/asm/current.h
+++ b/arch/xtensa/include/asm/current.h
@@ -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
diff --git a/include/asm-generic/current.h b/include/asm-generic/current.h
index 5e86f6a..bbfb795 100644
--- a/include/asm-generic/current.h
+++ b/include/asm-generic/current.h
@@ -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 */
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2012-08-22 19:25 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-24 3:18 [PATCH] Move most arches to asm-generic/current.h Stephen Boyd
2012-04-24 3:30 ` David Miller
2012-04-26 17:51 ` Stephen Boyd
2012-04-30 9:08 ` David Howells
2012-04-30 12:51 ` Chris Metcalf
2012-04-30 14:15 ` Arnd Bergmann
2012-04-30 16:35 ` Stephen Boyd
2012-04-30 16:38 ` Arnd Bergmann
2012-04-30 17:07 ` Stephen Boyd
2012-04-30 17:07 ` Stephen Boyd
2012-04-30 17:11 ` Matt Turner
2012-04-30 19:52 ` Arnd Bergmann
2012-08-22 19:25 ` [PATCH/RESEND] " Stephen Boyd
2012-08-22 19:25 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).