blob: 87f0f109d7f1db4eb34ab11744bd30031daab69b [file] [log] [blame]
Akinobu Mita765f34f2006-03-26 01:39:16 -08001#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
2#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
3
Akinobu Mita148817b2011-07-26 16:09:04 -07004/*
5 * Spinlock based version of ext2 atomic bitops
6 */
7
Akinobu Mita765f34f2006-03-26 01:39:16 -08008#define ext2_set_bit_atomic(lock, nr, addr) \
9 ({ \
10 int ret; \
11 spin_lock(lock); \
Akinobu Mitac5653002011-03-23 16:42:04 -070012 ret = __test_and_set_bit_le(nr, addr); \
Akinobu Mita765f34f2006-03-26 01:39:16 -080013 spin_unlock(lock); \
14 ret; \
15 })
16
17#define ext2_clear_bit_atomic(lock, nr, addr) \
18 ({ \
19 int ret; \
20 spin_lock(lock); \
Akinobu Mitac5653002011-03-23 16:42:04 -070021 ret = __test_and_clear_bit_le(nr, addr); \
Akinobu Mita765f34f2006-03-26 01:39:16 -080022 spin_unlock(lock); \
23 ret; \
24 })
25
26#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */