]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - include/linux/spinlock_types_rt.h
Merge branch '4.0.8-rt6'
[zynq/linux.git] / include / linux / spinlock_types_rt.h
diff --git a/include/linux/spinlock_types_rt.h b/include/linux/spinlock_types_rt.h
new file mode 100644 (file)
index 0000000..9fd4319
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef __LINUX_SPINLOCK_TYPES_RT_H
+#define __LINUX_SPINLOCK_TYPES_RT_H
+
+#ifndef __LINUX_SPINLOCK_TYPES_H
+#error "Do not include directly. Include spinlock_types.h instead"
+#endif
+
+#include <linux/cache.h>
+
+/*
+ * PREEMPT_RT: spinlocks - an RT mutex plus lock-break field:
+ */
+typedef struct spinlock {
+       struct rt_mutex         lock;
+       unsigned int            break_lock;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+       struct lockdep_map      dep_map;
+#endif
+} spinlock_t;
+
+#ifdef CONFIG_DEBUG_RT_MUTEXES
+# define __RT_SPIN_INITIALIZER(name) \
+       { \
+       .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \
+       .save_state = 1, \
+       .file = __FILE__, \
+       .line = __LINE__ , \
+       }
+#else
+# define __RT_SPIN_INITIALIZER(name) \
+       {                                                               \
+       .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock),          \
+       .save_state = 1, \
+       }
+#endif
+
+/*
+.wait_list = PLIST_HEAD_INIT_RAW((name).lock.wait_list, (name).lock.wait_lock)
+*/
+
+#define __SPIN_LOCK_UNLOCKED(name)                     \
+       { .lock = __RT_SPIN_INITIALIZER(name.lock),             \
+         SPIN_DEP_MAP_INIT(name) }
+
+#define __DEFINE_SPINLOCK(name) \
+       spinlock_t name = __SPIN_LOCK_UNLOCKED(name)
+
+#define DEFINE_SPINLOCK(name) \
+       spinlock_t name __cacheline_aligned_in_smp = __SPIN_LOCK_UNLOCKED(name)
+
+#endif