Blame view

include/asm-generic/bitops/ext2-atomic.h 561 Bytes
765f34fe3   Akinobu Mita   [PATCH] bitops: g...
1
2
  #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
  #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
148817ba0   Akinobu Mita   asm-generic: add ...
3
4
5
  /*
   * Spinlock based version of ext2 atomic bitops
   */
765f34fe3   Akinobu Mita   [PATCH] bitops: g...
6
7
8
9
  #define ext2_set_bit_atomic(lock, nr, addr)		\
  	({						\
  		int ret;				\
  		spin_lock(lock);			\
c56530055   Akinobu Mita   asm-generic: use ...
10
  		ret = __test_and_set_bit_le(nr, addr);	\
765f34fe3   Akinobu Mita   [PATCH] bitops: g...
11
12
13
14
15
16
17
18
  		spin_unlock(lock);			\
  		ret;					\
  	})
  
  #define ext2_clear_bit_atomic(lock, nr, addr)		\
  	({						\
  		int ret;				\
  		spin_lock(lock);			\
c56530055   Akinobu Mita   asm-generic: use ...
19
  		ret = __test_and_clear_bit_le(nr, addr);	\
765f34fe3   Akinobu Mita   [PATCH] bitops: g...
20
21
22
23
24
  		spin_unlock(lock);			\
  		ret;					\
  	})
  
  #endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */