libata: Add ATA_HORKAGE_NO_NCQ_ON_ATI for Samsung 860 and 870 SSD.
[linux-2.6-microblaze.git] / include / linux / rtmutex.h
index 87b325a..9deedfe 100644 (file)
 #ifndef __LINUX_RT_MUTEX_H
 #define __LINUX_RT_MUTEX_H
 
+#include <linux/compiler.h>
 #include <linux/linkage.h>
-#include <linux/rbtree.h>
-#include <linux/spinlock_types.h>
+#include <linux/rbtree_types.h>
+#include <linux/spinlock_types_raw.h>
 
 extern int max_lock_depth; /* for sysctl */
 
+struct rt_mutex_base {
+       raw_spinlock_t          wait_lock;
+       struct rb_root_cached   waiters;
+       struct task_struct      *owner;
+};
+
+#define __RT_MUTEX_BASE_INITIALIZER(rtbasename)                                \
+{                                                                      \
+       .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(rtbasename.wait_lock),    \
+       .waiters = RB_ROOT_CACHED,                                      \
+       .owner = NULL                                                   \
+}
+
+/**
+ * rt_mutex_base_is_locked - is the rtmutex locked
+ * @lock: the mutex to be queried
+ *
+ * Returns true if the mutex is locked, false if unlocked.
+ */
+static inline bool rt_mutex_base_is_locked(struct rt_mutex_base *lock)
+{
+       return READ_ONCE(lock->owner) != NULL;
+}
+
+extern void rt_mutex_base_init(struct rt_mutex_base *rtb);
+
 /**
  * The rt_mutex structure
  *
@@ -28,9 +55,7 @@ extern int max_lock_depth; /* for sysctl */
  * @owner:     the mutex owner
  */
 struct rt_mutex {
-       raw_spinlock_t          wait_lock;
-       struct rb_root_cached   waiters;
-       struct task_struct      *owner;
+       struct rt_mutex_base    rtmutex;
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
        struct lockdep_map      dep_map;
 #endif
@@ -63,26 +88,13 @@ do { \
 
 #define __RT_MUTEX_INITIALIZER(mutexname)                              \
 {                                                                      \
-       .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock),     \
-       .waiters = RB_ROOT_CACHED,                                      \
-       .owner = NULL,                                                  \
+       .rtmutex = __RT_MUTEX_BASE_INITIALIZER(mutexname.rtmutex),      \
        __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)                       \
 }
 
 #define DEFINE_RT_MUTEX(mutexname) \
        struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
 
-/**
- * rt_mutex_is_locked - is the mutex locked
- * @lock: the mutex to be queried
- *
- * Returns 1 if the mutex is locked, 0 if unlocked.
- */
-static inline int rt_mutex_is_locked(struct rt_mutex *lock)
-{
-       return lock->owner != NULL;
-}
-
 extern void __rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock_class_key *key);
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC