linux/include/linux/spinlock_types.h

#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>

#ifndef CONFIG_PREEMPT_RT

/* Non PREEMPT_RT kernels map spinlock to raw_spinlock */
spinlock_t;

#define ___SPIN_LOCK_INITIALIZER(lockname)

#define __SPIN_LOCK_INITIALIZER(lockname)

#define __SPIN_LOCK_UNLOCKED(lockname)

#define DEFINE_SPINLOCK(x)

#else /* !CONFIG_PREEMPT_RT */

/* PREEMPT_RT kernels map spinlock to rt_mutex */
#include <linux/rtmutex.h>

typedef struct spinlock {
	struct rt_mutex_base	lock;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
	struct lockdep_map	dep_map;
#endif
} spinlock_t;

#define __SPIN_LOCK_UNLOCKED

#define __LOCAL_SPIN_LOCK_UNLOCKED

#define DEFINE_SPINLOCK

#endif /* CONFIG_PREEMPT_RT */

#include <linux/rwlock_types.h>

#endif /* __LINUX_SPINLOCK_TYPES_H */