Commit | Line | Data |
---|---|---|
765f34fe AM |
1 | #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ |
2 | #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ | |
3 | ||
148817ba AM |
4 | /* |
5 | * Spinlock based version of ext2 atomic bitops | |
6 | */ | |
7 | ||
765f34fe AM |
8 | #define ext2_set_bit_atomic(lock, nr, addr) \ |
9 | ({ \ | |
10 | int ret; \ | |
11 | spin_lock(lock); \ | |
c5653005 | 12 | ret = __test_and_set_bit_le(nr, addr); \ |
765f34fe AM |
13 | spin_unlock(lock); \ |
14 | ret; \ | |
15 | }) | |
16 | ||
17 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | |
18 | ({ \ | |
19 | int ret; \ | |
20 | spin_lock(lock); \ | |
c5653005 | 21 | ret = __test_and_clear_bit_le(nr, addr); \ |
765f34fe AM |
22 | spin_unlock(lock); \ |
23 | ret; \ | |
24 | }) | |
25 | ||
26 | #endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */ |