Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 392c5174 authored by Mans Rullgard's avatar Mans Rullgard Committed by Hans-Christian Egtvedt
Browse files

avr32: fix asm operand constraint in cmpxchg()



If the 'old' operand to cmpxchg() is a constant wider than 21 bits,
linking fails with a "relocation truncated to fit: R_AVR32_21S" error.

Fix this by replacing the "i" constraint with "Ks21" which makes the
compiler use a temporary register for out of range constants.

Signed-off-by: default avatarMans Rullgard <mans@mansr.com>
Acked-by: default avatarHans-Christian Noren Egtvedt <egtvedt@samfundet.no>
Tested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: default avatarSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
parent b837e97f
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -57,7 +57,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
		"	brne	1b\n"
		"	brne	1b\n"
		"2:\n"
		"2:\n"
		: [ret] "=&r"(ret), [m] "=m"(*m)
		: [ret] "=&r"(ret), [m] "=m"(*m)
		: "m"(m), [old] "ir"(old), [new] "r"(new)
		: "m"(m), [old] "Ks21r"(old), [new] "r"(new)
		: "memory", "cc");
		: "memory", "cc");
	return ret;
	return ret;
}
}