xref: /kernel/linux/linux-5.10/include/asm-generic/bitops/ext2-atomic.h
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/include/asm-generic/bitops/
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
38c2ecf20Sopenharmony_ci#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * Spinlock based version of ext2 atomic bitops
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define ext2_set_bit_atomic(lock, nr, addr)		\
108c2ecf20Sopenharmony_ci	({						\
118c2ecf20Sopenharmony_ci		int ret;				\
128c2ecf20Sopenharmony_ci		spin_lock(lock);			\
138c2ecf20Sopenharmony_ci		ret = __test_and_set_bit_le(nr, addr);	\
148c2ecf20Sopenharmony_ci		spin_unlock(lock);			\
158c2ecf20Sopenharmony_ci		ret;					\
168c2ecf20Sopenharmony_ci	})
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define ext2_clear_bit_atomic(lock, nr, addr)		\
198c2ecf20Sopenharmony_ci	({						\
208c2ecf20Sopenharmony_ci		int ret;				\
218c2ecf20Sopenharmony_ci		spin_lock(lock);			\
228c2ecf20Sopenharmony_ci		ret = __test_and_clear_bit_le(nr, addr);	\
238c2ecf20Sopenharmony_ci		spin_unlock(lock);			\
248c2ecf20Sopenharmony_ci		ret;					\
258c2ecf20Sopenharmony_ci	})
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */
28

Indexes created Thu Nov 07 10:32:03 CST 2024