[PATCH] powerpc/signal: Move and simplify get_clean_sp()

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE2188d

3 messages, 3 authors, 2020-08-07 · open the first message on its own page

[PATCH] powerpc/signal: Move and simplify get_clean_sp()

From: Christophe Leroy <hidden>
Date: 2020-08-06 11:13:16

get_clean_sp() is only used in kernel/signal.c . Move it there.

And GCC is smart enough to reduce the function when on PPC32, no
need of a special PPC32 simple version.

Signed-off-by: Christophe Leroy <redacted>
---
 arch/powerpc/include/asm/processor.h | 14 --------------
 arch/powerpc/kernel/signal.c         |  7 +++++++
 2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index ed0d633ab5aa..5c20b6d509ae 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -404,20 +404,6 @@ static inline void prefetchw(const void *x)
 
 #define HAVE_ARCH_PICK_MMAP_LAYOUT
 
-#ifdef CONFIG_PPC64
-static inline unsigned long get_clean_sp(unsigned long sp, int is_32)
-{
-	if (is_32)
-		return sp & 0x0ffffffffUL;
-	return sp;
-}
-#else
-static inline unsigned long get_clean_sp(unsigned long sp, int is_32)
-{
-	return sp;
-}
-#endif
-
 /* asm stubs */
 extern unsigned long isa300_idle_stop_noloss(unsigned long psscr_val);
 extern unsigned long isa300_idle_stop_mayloss(unsigned long psscr_val);
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index d15a98c758b8..bd0ba7c5e2cf 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -171,6 +171,13 @@ inline unsigned long copy_ckfpr_from_user(struct task_struct *task,
 
 int show_unhandled_signals = 1;
 
+static unsigned long get_clean_sp(unsigned long sp, int is_32)
+{
+	if (is_32)
+		return sp & 0x0ffffffffUL;
+	return sp;
+}
+
 /*
  * Allocate space for the signal frame
  */
-- 
2.25.0

Re: [PATCH] powerpc/signal: Move and simplify get_clean_sp()

From: Christoph Hellwig <hch@infradead.org>
Date: 2020-08-06 11:13:24

On Thu, Aug 06, 2020 at 08:50:20AM +0000, Christophe Leroy wrote:
get_clean_sp() is only used in kernel/signal.c . Move it there.

And GCC is smart enough to reduce the function when on PPC32, no
need of a special PPC32 simple version.
What about just open coding it in the only caller, which would seem even
cleaner?

Re: [PATCH] powerpc/signal: Move and simplify get_clean_sp()

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2020-08-07 02:48:09

Christoph Hellwig [off-list ref] writes:
On Thu, Aug 06, 2020 at 08:50:20AM +0000, Christophe Leroy wrote:
quoted
get_clean_sp() is only used in kernel/signal.c . Move it there.

And GCC is smart enough to reduce the function when on PPC32, no
need of a special PPC32 simple version.
What about just open coding it in the only caller, which would seem even
cleaner?
+1

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help