[RFC][PATCH 3/4] perf/powerpc: Move mfspr and friends to header file

Sukadev Bhattiprolu sukadev at linux.vnet.ibm.com
Fri May 1 17:05:40 AEST 2015


mfspr() and related macros will be needed in two separate files.
Move these defintions to a common header file.

Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
---
 tools/perf/arch/powerpc/util/header.c |    9 +--------
 tools/perf/arch/powerpc/util/header.h |    9 +++++++++
 2 files changed, 10 insertions(+), 8 deletions(-)
 create mode 100644 tools/perf/arch/powerpc/util/header.h

diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
index 6c1b8a7..05d3fc8 100644
--- a/tools/perf/arch/powerpc/util/header.c
+++ b/tools/perf/arch/powerpc/util/header.c
@@ -6,14 +6,7 @@
 
 #include "../../util/header.h"
 #include "../../util/util.h"
-
-#define mfspr(rn)       ({unsigned long rval; \
-			 asm volatile("mfspr %0," __stringify(rn) \
-				      : "=r" (rval)); rval; })
-
-#define SPRN_PVR        0x11F	/* Processor Version Register */
-#define PVR_VER(pvr)    (((pvr) >>  16) & 0xFFFF) /* Version field */
-#define PVR_REV(pvr)    (((pvr) >>   0) & 0xFFFF) /* Revison field */
+#include "header.h"
 
 int
 get_cpuid(char *buffer, size_t sz)
diff --git a/tools/perf/arch/powerpc/util/header.h b/tools/perf/arch/powerpc/util/header.h
new file mode 100644
index 0000000..b9d3a0d
--- /dev/null
+++ b/tools/perf/arch/powerpc/util/header.h
@@ -0,0 +1,9 @@
+#include "../../util/util.h"	// __stringify
+
+#define mfspr(rn)       ({unsigned long rval; \
+			 asm volatile("mfspr %0," __stringify(rn) \
+				      : "=r" (rval)); rval; })
+
+#define SPRN_PVR        0x11F   /* Processor Version Register */
+#define PVR_VER(pvr)    (((pvr) >>  16) & 0xFFFF) /* Version field */
+#define PVR_REV(pvr)    (((pvr) >>   0) & 0xFFFF) /* Revison field */
-- 
1.7.9.5



More information about the Linuxppc-dev mailing list