blob: 0cfc3180b0746d93fbaa5277f1022acfdc9c5e29 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Akinobu Mita765f34f2006-03-26 01:39:16 -08002#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
3#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
4
Akinobu Mita148817b2011-07-26 16:09:04 -07005/*
6 * Spinlock based version of ext2 atomic bitops
7 */
8
Akinobu Mita765f34f2006-03-26 01:39:16 -08009#define ext2_set_bit_atomic(lock, nr, addr) \
10 ({ \
11 int ret; \
12 spin_lock(lock); \
Akinobu Mitac5653002011-03-23 16:42:04 -070013 ret = __test_and_set_bit_le(nr, addr); \
Akinobu Mita765f34f2006-03-26 01:39:16 -080014 spin_unlock(lock); \
15 ret; \
16 })
17
18#define ext2_clear_bit_atomic(lock, nr, addr) \
19 ({ \
20 int ret; \
21 spin_lock(lock); \
Akinobu Mitac5653002011-03-23 16:42:04 -070022 ret = __test_and_clear_bit_le(nr, addr); \
Akinobu Mita765f34f2006-03-26 01:39:16 -080023 spin_unlock(lock); \
24 ret; \
25 })
26
27#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */