Path: blob/master/include/asm-generic/bitops/lock.h
10818 views
#ifndef _ASM_GENERIC_BITOPS_LOCK_H_1#define _ASM_GENERIC_BITOPS_LOCK_H_23/**4* test_and_set_bit_lock - Set a bit and return its old value, for lock5* @nr: Bit to set6* @addr: Address to count from7*8* This operation is atomic and provides acquire barrier semantics.9* It can be used to implement bit locks.10*/11#define test_and_set_bit_lock(nr, addr) test_and_set_bit(nr, addr)1213/**14* clear_bit_unlock - Clear a bit in memory, for unlock15* @nr: the bit to set16* @addr: the address to start counting from17*18* This operation is atomic and provides release barrier semantics.19*/20#define clear_bit_unlock(nr, addr) \21do { \22smp_mb__before_clear_bit(); \23clear_bit(nr, addr); \24} while (0)2526/**27* __clear_bit_unlock - Clear a bit in memory, for unlock28* @nr: the bit to set29* @addr: the address to start counting from30*31* This operation is like clear_bit_unlock, however it is not atomic.32* It does provide release barrier semantics so it can be used to unlock33* a bit lock, however it would only be used if no other CPU can modify34* any bits in the memory until the lock is released (a good example is35* if the bit lock itself protects access to the other bits in the word).36*/37#define __clear_bit_unlock(nr, addr) \38do { \39smp_mb(); \40__clear_bit(nr, addr); \41} while (0)4243#endif /* _ASM_GENERIC_BITOPS_LOCK_H_ */44454647