m68k: Fix asm register constraints for atomic ops
Subsystems (2)
Geert Uytterhoeven
maintainerPATCH v2 1/1 m68k: Fix asm register constraints for atomic ops
Depending on register assignment by the compiler:
{standard input}:3084: Error: operands mismatch -- statement andl %a1,%d1' ignored {standard input}:3145: Error: operands mismatch -- statement orl %a1,%d1' ignored {standard input}:3195: Error: operands mismatch -- statement `eorl %a1,%d1' ignored
Indeed, the first operand must not be an address register. However, it can be an immediate value. Fix this by adjusting the register constraint from "g" (general purpose register) to "di" (data register or immediate).
---
v2:
- Add Tested-by,
- Use "di" instead of "d".
Personally, I have never seen this failure in an 68020+ build, but I can reproduce it on Coldfire with the config provided by lkp (with bogus CONFIG_RMW_INSNS=y).
--- arch/m68k/include/asm/atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/m68k/include/asm/atomic.h +2 -2
@@ -48,7 +48,7 @@ static inline int arch_atomic_##op##_return(int i, atomic_t *v) \ " casl %2,%1,%0\n" \ " jne 1b" \ : "+m" (*v), "=&d" (t), "=&d" (tmp) \ - : "g" (i), "2" (arch_atomic_read(v))); \ + : "di" (i), "2" (arch_atomic_read(v))); \return t; \ }
@@ -63,7 +63,7 @@ static inline int arch_atomic_fetch_##op(int i, atomic_t *v) \ " casl %2,%1,%0\n" \ " jne 1b" \ : "+m" (*v), "=&d" (t), "=&d" (tmp) \ - : "g" (i), "2" (arch_atomic_read(v))); \ + : "di" (i), "2" (arch_atomic_read(v))); \return tmp; \ }
Signature · 1 line
2.25.1