mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
4f084ca74c
Move raw_spinlock into its own file. Prepare for RT 'sleeping spinlocks', to avoid header recursion, as RT locks require rtmutex.h, which in turn requires the raw spinlock types. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210815211303.371269088@linutronix.de
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
#ifndef __LINUX_SPINLOCK_TYPES_H
|
|
#define __LINUX_SPINLOCK_TYPES_H
|
|
|
|
/*
|
|
* include/linux/spinlock_types.h - generic spinlock type definitions
|
|
* and initializers
|
|
*
|
|
* portions Copyright 2005, Red Hat, Inc., Ingo Molnar
|
|
* Released under the General Public License (GPL).
|
|
*/
|
|
|
|
#include <linux/spinlock_types_raw.h>
|
|
|
|
typedef struct spinlock {
|
|
union {
|
|
struct raw_spinlock rlock;
|
|
|
|
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
|
# define LOCK_PADSIZE (offsetof(struct raw_spinlock, dep_map))
|
|
struct {
|
|
u8 __padding[LOCK_PADSIZE];
|
|
struct lockdep_map dep_map;
|
|
};
|
|
#endif
|
|
};
|
|
} spinlock_t;
|
|
|
|
#define ___SPIN_LOCK_INITIALIZER(lockname) \
|
|
{ \
|
|
.raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \
|
|
SPIN_DEBUG_INIT(lockname) \
|
|
SPIN_DEP_MAP_INIT(lockname) }
|
|
|
|
#define __SPIN_LOCK_INITIALIZER(lockname) \
|
|
{ { .rlock = ___SPIN_LOCK_INITIALIZER(lockname) } }
|
|
|
|
#define __SPIN_LOCK_UNLOCKED(lockname) \
|
|
(spinlock_t) __SPIN_LOCK_INITIALIZER(lockname)
|
|
|
|
#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
|
|
|
|
#include <linux/rwlock_types.h>
|
|
|
|
#endif /* __LINUX_SPINLOCK_TYPES_H */
|