Akinobu Mita | 765f34f | 2006-03-26 01:39:16 -0800 | [diff] [blame] | 1 | #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ |
| 2 | #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ |
| 3 | |
Akinobu Mita | 148817b | 2011-07-26 16:09:04 -0700 | [diff] [blame] | 4 | /* |
| 5 | * Spinlock based version of ext2 atomic bitops |
| 6 | */ |
| 7 | |
Akinobu Mita | 765f34f | 2006-03-26 01:39:16 -0800 | [diff] [blame] | 8 | #define ext2_set_bit_atomic(lock, nr, addr) \ |
| 9 | ({ \ |
| 10 | int ret; \ |
| 11 | spin_lock(lock); \ |
Akinobu Mita | c565300 | 2011-03-23 16:42:04 -0700 | [diff] [blame] | 12 | ret = __test_and_set_bit_le(nr, addr); \ |
Akinobu Mita | 765f34f | 2006-03-26 01:39:16 -0800 | [diff] [blame] | 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); \ |
Akinobu Mita | c565300 | 2011-03-23 16:42:04 -0700 | [diff] [blame] | 21 | ret = __test_and_clear_bit_le(nr, addr); \ |
Akinobu Mita | 765f34f | 2006-03-26 01:39:16 -0800 | [diff] [blame] | 22 | spin_unlock(lock); \ |
| 23 | ret; \ |
| 24 | }) |
| 25 | |
| 26 | #endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */ |