ext2-atomic.h 600 B

12345678910111213141516171819202122232425262728
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
  3. #define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
  4. /*
  5. * Spinlock based version of ext2 atomic bitops
  6. */
  7. #define ext2_set_bit_atomic(lock, nr, addr) \
  8. ({ \
  9. int ret; \
  10. spin_lock(lock); \
  11. ret = __test_and_set_bit_le(nr, addr); \
  12. spin_unlock(lock); \
  13. ret; \
  14. })
  15. #define ext2_clear_bit_atomic(lock, nr, addr) \
  16. ({ \
  17. int ret; \
  18. spin_lock(lock); \
  19. ret = __test_and_clear_bit_le(nr, addr); \
  20. spin_unlock(lock); \
  21. ret; \
  22. })
  23. #endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */