diff options
Diffstat (limited to 'arch/x86/include/asm/bitops.h')
| -rw-r--r-- | arch/x86/include/asm/bitops.h | 30 | 
1 files changed, 6 insertions, 24 deletions
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 41639ce8fd6..afcd35d331d 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h @@ -14,6 +14,8 @@  #include <linux/compiler.h>  #include <asm/alternative.h> +#include <asm/rmwcc.h> +#include <asm/barrier.h>  #if BITS_PER_LONG == 32  # define _BITOPS_LONG_SHIFT 5 @@ -101,7 +103,7 @@ static inline void __set_bit(long nr, volatile unsigned long *addr)   *   * clear_bit() is atomic and may not be reordered.  However, it does   * not contain a memory barrier, so if it is used for locking purposes, - * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() + * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic()   * in order to ensure changes are visible on other processors.   */  static __always_inline void @@ -155,9 +157,6 @@ static inline void __clear_bit_unlock(long nr, volatile unsigned long *addr)  	__clear_bit(nr, addr);  } -#define smp_mb__before_clear_bit()	barrier() -#define smp_mb__after_clear_bit()	barrier() -  /**   * __change_bit - Toggle a bit in memory   * @nr: the bit to change @@ -204,12 +203,7 @@ static inline void change_bit(long nr, volatile unsigned long *addr)   */  static inline int test_and_set_bit(long nr, volatile unsigned long *addr)  { -	int oldbit; - -	asm volatile(LOCK_PREFIX "bts %2,%1\n\t" -		     "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr) : "memory"); - -	return oldbit; +	GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, "Ir", nr, "%0", "c");  }  /** @@ -255,13 +249,7 @@ static inline int __test_and_set_bit(long nr, volatile unsigned long *addr)   */  static inline int test_and_clear_bit(long nr, volatile unsigned long *addr)  { -	int oldbit; - -	asm volatile(LOCK_PREFIX "btr %2,%1\n\t" -		     "sbb %0,%0" -		     : "=r" (oldbit), ADDR : "Ir" (nr) : "memory"); - -	return oldbit; +	GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, "Ir", nr, "%0", "c");  }  /** @@ -314,13 +302,7 @@ static inline int __test_and_change_bit(long nr, volatile unsigned long *addr)   */  static inline int test_and_change_bit(long nr, volatile unsigned long *addr)  { -	int oldbit; - -	asm volatile(LOCK_PREFIX "btc %2,%1\n\t" -		     "sbb %0,%0" -		     : "=r" (oldbit), ADDR : "Ir" (nr) : "memory"); - -	return oldbit; +	GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, "Ir", nr, "%0", "c");  }  static __always_inline int constant_test_bit(long nr, const volatile unsigned long *addr)  | 
