Skip to contentSkip to conversation

frv: Use OFFSET macro in DEF_*REG()

PATCH In review Matthias Kaehlcke 3 participants 6 messages Apr 3, 2017 – Apr 23, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 frv: Use OFFSET macro in DEF_*REG()

Avoid code duplication by using OFFSET() in DEF_*REG() instead of replicating the macro.

---
 arch/frv/kernel/asm-offsets.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
arch/frv/kernel/asm-offsets.c +4 -15
index 8414293f213a..20c5b79b55f9 100644
@@ -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)
 {
Signature · 1 line
2.12.2.564.g063fe858b8-goog
#1 lore raw

El Mon, Apr 03, 2017 at 12:46:36PM -0700 Matthias Kaehlcke ha dit:

Quoted 4 lines

Avoid code duplication by using OFFSET() in DEF_*REG() instead of replicating the macro.

Ping, any feedback on this patch?

Thanks

Matthias

#2 lore raw

2017-04-18 5:35 GMT+09:00 Matthias Kaehlcke <[email protected]>:

Quoted 5 lines

El Mon, Apr 03, 2017 at 12:46:36PM -0700 Matthias Kaehlcke ha dit:

Quoted 3 lines

Avoid code duplication by using OFFSET() in DEF_*REG() instead of replicating the macro.

Quoted 7 lines
Quoted 1 line

Ping, any feedback on this patch?

Thanks

Matthias

If this is not picked up via frv tree,
I will apply it to kbuild tree.

(frv does not seem very active these days.)

Let's wait a bit and see if we get a response.

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw

Hi David,

2017-04-18 18:59 GMT+09:00 David Howells <[email protected]>:

Quoted 8 lines
Quoted 4 lines · Matthias Kaehlcke

Avoid code duplication by using OFFSET() in DEF_*REG() instead of replicating the macro.

Ah, I've just noticed you are the last frv maintainer, and now the frv is orphan.

So, I will pick up this patch to the kbuild tree.

Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada