diff mbox

[U-Boot,v2,05/14] powerpc: move set_msr() and get_msr() into .h

Message ID f836b7cd75f0354cba8a0a12a87f8ca933ec238b.1499945943.git.christophe.leroy@c-s.fr
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Christophe Leroy July 13, 2017, 1:09 p.m. UTC
set_msr() and get_msr() are defined and used twice.
This patch moves them into ppc.h

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/include/asm/ppc.h | 14 ++++++++++++++
 arch/powerpc/lib/interrupts.c  | 14 --------------
 arch/powerpc/lib/kgdb.c        | 14 --------------
 3 files changed, 14 insertions(+), 28 deletions(-)

Comments

Tom Rini July 25, 2017, 12:43 a.m. UTC | #1
On Thu, Jul 13, 2017 at 03:09:52PM +0200, Christophe Leroy wrote:

> set_msr() and get_msr() are defined and used twice.
> This patch moves them into ppc.h
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/ppc.h b/arch/powerpc/include/asm/ppc.h
index c6aa2f0dfb..89f08eccc7 100644
--- a/arch/powerpc/include/asm/ppc.h
+++ b/arch/powerpc/include/asm/ppc.h
@@ -96,6 +96,20 @@  static inline ulong get_ddr_freq(ulong dummy)
 ulong get_ddr_freq(ulong);
 #endif
 
+static inline unsigned long get_msr(void)
+{
+	unsigned long msr;
+
+	asm volatile ("mfmsr %0" : "=r" (msr) : );
+
+	return msr;
+}
+
+static inline void set_msr(unsigned long msr)
+{
+	asm volatile ("mtmsr %0" : : "r" (msr));
+}
+
 #endif /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_PPC
diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c
index 50313573fb..ccba829710 100644
--- a/arch/powerpc/lib/interrupts.c
+++ b/arch/powerpc/lib/interrupts.c
@@ -33,20 +33,6 @@  extern void timer_interrupt_cpu (struct pt_regs *);
 
 static unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
 
-static __inline__ unsigned long get_msr (void)
-{
-	unsigned long msr;
-
-	asm volatile ("mfmsr %0":"=r" (msr):);
-
-	return msr;
-}
-
-static __inline__ void set_msr (unsigned long msr)
-{
-	asm volatile ("mtmsr %0"::"r" (msr));
-}
-
 static __inline__ unsigned long get_dec (void)
 {
 	unsigned long val;
diff --git a/arch/powerpc/lib/kgdb.c b/arch/powerpc/lib/kgdb.c
index 88c2af21eb..aa16a00a42 100644
--- a/arch/powerpc/lib/kgdb.c
+++ b/arch/powerpc/lib/kgdb.c
@@ -38,20 +38,6 @@  kgdb_longjmp(long *buf, int val)
 	     : "=&r"(temp) : "r" (buf), "r" (val));
 }
 
-static inline unsigned long
-get_msr(void)
-{
-	unsigned long msr;
-	asm volatile("mfmsr %0" : "=r" (msr):);
-	return msr;
-}
-
-static inline void
-set_msr(unsigned long msr)
-{
-	asm volatile("mtmsr %0" : : "r" (msr));
-}
-
 /* Convert the SPARC hardware trap type code to a unix signal number. */
 /*
  * This table contains the mapping between PowerPC hardware trap types, and