From: Nick Piggin Documentation/atomic_ops.txt defines these primitives must contain a memory barrier both before and after their memory operation. This is consistent with the atomic ops implementation on mips. Signed-off-by: Nick Piggin Cc: Ralf Baechle Signed-off-by: Andrew Morton --- include/asm-mips/bitops.h | 6 ++++++ 1 file changed, 6 insertions(+) diff -puN include/asm-mips/bitops.h~mips-fix-bitops include/asm-mips/bitops.h --- a/include/asm-mips/bitops.h~mips-fix-bitops +++ a/include/asm-mips/bitops.h @@ -244,6 +244,8 @@ static inline int test_and_set_bit(unsig unsigned short bit = nr & SZLONG_MASK; unsigned long res; + smp_llsc_mb(); + if (cpu_has_llsc && R10000_LLSC_WAR) { unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); unsigned long temp; @@ -312,6 +314,8 @@ static inline int test_and_clear_bit(uns unsigned short bit = nr & SZLONG_MASK; unsigned long res; + smp_llsc_mb(); + if (cpu_has_llsc && R10000_LLSC_WAR) { unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); unsigned long temp; @@ -400,6 +404,8 @@ static inline int test_and_change_bit(un unsigned short bit = nr & SZLONG_MASK; unsigned long res; + smp_llsc_mb(); + if (cpu_has_llsc && R10000_LLSC_WAR) { unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); unsigned long temp; _