yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ |
| 2 | #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ |
| 3 | |
| 4 | /* |
| 5 | * Spinlock based version of ext2 atomic bitops |
| 6 | */ |
| 7 | |
| 8 | #define ext2_set_bit_atomic(lock, nr, addr) \ |
| 9 | ({ \ |
| 10 | int ret; \ |
| 11 | spin_lock(lock); \ |
| 12 | ret = __test_and_set_bit_le(nr, addr); \ |
| 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); \ |
| 21 | ret = __test_and_clear_bit_le(nr, addr); \ |
| 22 | spin_unlock(lock); \ |
| 23 | ret; \ |
| 24 | }) |
| 25 | |
| 26 | #endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */ |