Loading...
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/*
6 * Spinlock based version of ext2 atomic bitops
7 */
8
9#define ext2_set_bit_atomic(lock, nr, addr) \
10 ({ \
11 int ret; \
12 spin_lock(lock); \
13 ret = __test_and_set_bit_le(nr, addr); \
14 spin_unlock(lock); \
15 ret; \
16 })
17
18#define ext2_clear_bit_atomic(lock, nr, addr) \
19 ({ \
20 int ret; \
21 spin_lock(lock); \
22 ret = __test_and_clear_bit_le(nr, addr); \
23 spin_unlock(lock); \
24 ret; \
25 })
26
27#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */
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_ */