mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 04:47:05 +00:00
1bce11126d
This is a simple, fair spinlock. Specifically it doesn't have all the subtle memory model dependencies that qspinlock has, which makes it more suitable for simple systems as it is more likely to be correct. It is implemented entirely in terms of standard atomics and thus works fine without any arch-specific code. This replaces the existing asm-generic/spinlock.h, which just errored out on SMP systems. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Guo Ren <guoren@kernel.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
17 lines
404 B
C
17 lines
404 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __ASM_GENERIC_SPINLOCK_TYPES_H
|
|
#define __ASM_GENERIC_SPINLOCK_TYPES_H
|
|
|
|
#include <linux/types.h>
|
|
typedef atomic_t arch_spinlock_t;
|
|
|
|
/*
|
|
* qrwlock_types depends on arch_spinlock_t, so we must typedef that before the
|
|
* include.
|
|
*/
|
|
#include <asm/qrwlock_types.h>
|
|
|
|
#define __ARCH_SPIN_LOCK_UNLOCKED ATOMIC_INIT(0)
|
|
|
|
#endif /* __ASM_GENERIC_SPINLOCK_TYPES_H */
|