From: Nick Piggin Date: Thu, 18 Oct 2007 10:06:52 +0000 (-0700) Subject: mips: fix bitops X-Git-Tag: v2.6.24-rc1~329 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8f30ae54714abf494d79826d90b5e4844fbf355;p=platform%2Fkernel%2Flinux-3.10.git mips: fix bitops 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 Signed-off-by: Linus Torvalds --- diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 0d3373f..5478d94 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h @@ -240,6 +240,8 @@ static inline int test_and_set_bit(unsigned long nr, 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; @@ -308,6 +310,8 @@ static inline int test_and_clear_bit(unsigned long nr, 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; @@ -396,6 +400,8 @@ static inline int test_and_change_bit(unsigned long nr, 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;