diff mbox

[3/3] powerpc/asm: Add STACK_INT_OFFSET macro in asm-offsets.c

Message ID 1464841788-17465-3-git-send-email-rashmicy@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Rashmica Gupta June 2, 2016, 4:29 a.m. UTC
There are quite a few entries in asm-offests.c look like this:
DEFINE(REG, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, reg));

So define a local MACRO to clean this up:
STACK_INT_OFFSET(sym, val) DEFINE(sym, STACK_INT_FRAME_SIZE + \
               offsetof(struct exception_regs, val))

Signed-off-by: Rashmica Gupta <rashmicy@gmail.com>
---
 arch/powerpc/kernel/asm-offsets.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
diff mbox

Patch

diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 3dbd3bd016ba..5efe5e297256 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -70,6 +70,8 @@ 
 
 #define STACK_OFFSET(sym, val) DEFINE(sym, STACK_FRAME_OVERHEAD + \
 		offsetof(struct pt_regs, val))
+#define STACK_INT_OFFSET(sym, val)	DEFINE(sym, \
+		STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, val))
 
 int main(void)
 {
@@ -308,21 +310,21 @@  int main(void)
 #if defined(CONFIG_PPC32)
 #if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
 	DEFINE(EXC_LVL_SIZE, STACK_EXC_LVL_FRAME_SIZE);
-	DEFINE(MAS0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas0));
+	STACK_INT_OFFSET(MAS0, mas0);
 	/* we overload MMUCR for 44x on MAS0 since they are mutually exclusive */
-	DEFINE(MMUCR, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas0));
-	DEFINE(MAS1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas1));
-	DEFINE(MAS2, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas2));
-	DEFINE(MAS3, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas3));
-	DEFINE(MAS6, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas6));
-	DEFINE(MAS7, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, mas7));
-	DEFINE(_SRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, srr0));
-	DEFINE(_SRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, srr1));
-	DEFINE(_CSRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, csrr0));
-	DEFINE(_CSRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, csrr1));
-	DEFINE(_DSRR0, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, dsrr0));
-	DEFINE(_DSRR1, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, dsrr1));
-	DEFINE(SAVED_KSP_LIMIT, STACK_INT_FRAME_SIZE+offsetof(struct exception_regs, saved_ksp_limit));
+	STACK_INT_OFFSET(MMUCR, mas0);
+	STACK_INT_OFFSET(MAS1, mas1);
+	STACK_INT_OFFSET(MAS2, mas2);
+	STACK_INT_OFFSET(MAS3, mas3);
+	STACK_INT_OFFSET(MAS6, mas6);
+	STACK_INT_OFFSET(MAS7, mas7);
+	STACK_INT_OFFSET(_SRR0, srr0);
+	STACK_INT_OFFSET(_SRR1, srr1);
+	STACK_INT_OFFSET(_CSRR0, csrr0);
+	STACK_INT_OFFSET(_CSRR1, csrr1);
+	STACK_INT_OFFSET(_DSRR0, dsrr0);
+	STACK_INT_OFFSET(_DSRR1, dsrr1);
+	STACK_INT_OFFSET(SAVED_KSP_LIMIT, saved_ksp_limit);
 #endif
 #endif