Skip to content

Commit

Permalink
frv: Use OFFSET macro in DEF_*REG()
Browse files Browse the repository at this point in the history
Avoid code duplication by using OFFSET() in DEF_*REG() instead of
replicating the macro.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
  • Loading branch information
Matthias Kaehlcke authored and Masahiro Yamada committed Apr 18, 2017
1 parent 90ad405 commit 20c994e
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions arch/frv/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,10 @@
#include <asm/thread_info.h>
#include <asm/gdb-stub.h>

#define DEF_PTREG(sym, reg) \
asm volatile("\n->" #sym " %0 offsetof(struct pt_regs, " #reg ")" \
: : "i" (offsetof(struct pt_regs, reg)))

#define DEF_IREG(sym, reg) \
asm volatile("\n->" #sym " %0 offsetof(struct user_context, " #reg ")" \
: : "i" (offsetof(struct user_context, reg)))

#define DEF_FREG(sym, reg) \
asm volatile("\n->" #sym " %0 offsetof(struct user_context, " #reg ")" \
: : "i" (offsetof(struct user_context, reg)))

#define DEF_0REG(sym, reg) \
asm volatile("\n->" #sym " %0 offsetof(struct frv_frame0, " #reg ")" \
: : "i" (offsetof(struct frv_frame0, reg)))
#define DEF_PTREG(sym, reg) OFFSET(sym, pt_regs, reg)
#define DEF_IREG(sym, reg) OFFSET(sym, user_context, reg)
#define DEF_FREG(sym, reg) OFFSET(sym, user_context, reg)
#define DEF_0REG(sym, reg) OFFSET(sym, frv_frame0, reg)

void foo(void)
{
Expand Down

0 comments on commit 20c994e

Please sign in to comment.