| .. | .. |
|---|
| 14 | 14 | #define __LINUX_RT_MUTEX_H |
|---|
| 15 | 15 | |
|---|
| 16 | 16 | #include <linux/linkage.h> |
|---|
| 17 | +#include <linux/rbtree_type.h> |
|---|
| 17 | 18 | #include <linux/spinlock_types_raw.h> |
|---|
| 18 | | -#include <linux/rbtree.h> |
|---|
| 19 | 19 | |
|---|
| 20 | 20 | extern int max_lock_depth; /* for sysctl */ |
|---|
| 21 | 21 | |
|---|
| .. | .. |
|---|
| 36 | 36 | struct rb_root_cached waiters; |
|---|
| 37 | 37 | struct task_struct *owner; |
|---|
| 38 | 38 | int save_state; |
|---|
| 39 | | -#ifdef CONFIG_DEBUG_RT_MUTEXES |
|---|
| 40 | | - const char *name, *file; |
|---|
| 41 | | - int line; |
|---|
| 42 | | - void *magic; |
|---|
| 43 | | -#endif |
|---|
| 44 | 39 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 45 | 40 | struct lockdep_map dep_map; |
|---|
| 46 | 41 | #endif |
|---|
| .. | .. |
|---|
| 53 | 48 | extern int rt_mutex_debug_check_no_locks_freed(const void *from, |
|---|
| 54 | 49 | unsigned long len); |
|---|
| 55 | 50 | extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task); |
|---|
| 51 | + extern void rt_mutex_debug_task_free(struct task_struct *tsk); |
|---|
| 56 | 52 | #else |
|---|
| 57 | 53 | static inline int rt_mutex_debug_check_no_locks_freed(const void *from, |
|---|
| 58 | 54 | unsigned long len) |
|---|
| .. | .. |
|---|
| 60 | 56 | return 0; |
|---|
| 61 | 57 | } |
|---|
| 62 | 58 | # define rt_mutex_debug_check_no_locks_held(task) do { } while (0) |
|---|
| 59 | +# define rt_mutex_debug_task_free(t) do { } while (0) |
|---|
| 63 | 60 | #endif |
|---|
| 64 | 61 | |
|---|
| 65 | | -#ifdef CONFIG_DEBUG_RT_MUTEXES |
|---|
| 66 | | -# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| 67 | | - , .name = #mutexname, .file = __FILE__, .line = __LINE__ |
|---|
| 68 | | - |
|---|
| 69 | | -# define rt_mutex_init(mutex) \ |
|---|
| 62 | +#define rt_mutex_init(mutex) \ |
|---|
| 70 | 63 | do { \ |
|---|
| 71 | 64 | static struct lock_class_key __key; \ |
|---|
| 72 | 65 | __rt_mutex_init(mutex, __func__, &__key); \ |
|---|
| 73 | 66 | } while (0) |
|---|
| 74 | | - |
|---|
| 75 | | - extern void rt_mutex_debug_task_free(struct task_struct *tsk); |
|---|
| 76 | | -#else |
|---|
| 77 | | -# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) |
|---|
| 78 | | -# define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL, NULL) |
|---|
| 79 | | -# define rt_mutex_debug_task_free(t) do { } while (0) |
|---|
| 80 | | -#endif |
|---|
| 81 | 67 | |
|---|
| 82 | 68 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 83 | 69 | #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| .. | .. |
|---|
| 87 | 73 | #endif |
|---|
| 88 | 74 | |
|---|
| 89 | 75 | #define __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \ |
|---|
| 90 | | - .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ |
|---|
| 76 | + .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ |
|---|
| 91 | 77 | , .waiters = RB_ROOT_CACHED \ |
|---|
| 92 | 78 | , .owner = NULL \ |
|---|
| 93 | | - __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| 94 | 79 | __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) |
|---|
| 95 | 80 | |
|---|
| 96 | 81 | #define __RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| 97 | | - { __RT_MUTEX_INITIALIZER_PLAIN(mutexname) } |
|---|
| 98 | | - |
|---|
| 99 | | -#define DEFINE_RT_MUTEX(mutexname) \ |
|---|
| 100 | | - struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname) |
|---|
| 82 | + { __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \ |
|---|
| 83 | + , .save_state = 0 } |
|---|
| 101 | 84 | |
|---|
| 102 | 85 | #define __RT_MUTEX_INITIALIZER_SAVE_STATE(mutexname) \ |
|---|
| 103 | 86 | { __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \ |
|---|
| 104 | | - , .save_state = 1 } |
|---|
| 87 | + , .save_state = 1 } |
|---|
| 88 | + |
|---|
| 89 | +#define DEFINE_RT_MUTEX(mutexname) \ |
|---|
| 90 | + struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname) |
|---|
| 105 | 91 | |
|---|
| 106 | 92 | /** |
|---|
| 107 | 93 | * rt_mutex_is_locked - is the mutex locked |
|---|
| .. | .. |
|---|
| 126 | 112 | #endif |
|---|
| 127 | 113 | |
|---|
| 128 | 114 | extern int rt_mutex_lock_interruptible(struct rt_mutex *lock); |
|---|
| 129 | | -extern int rt_mutex_lock_killable(struct rt_mutex *lock); |
|---|
| 130 | | -extern int rt_mutex_timed_lock(struct rt_mutex *lock, |
|---|
| 131 | | - struct hrtimer_sleeper *timeout); |
|---|
| 132 | | - |
|---|
| 133 | 115 | extern int rt_mutex_trylock(struct rt_mutex *lock); |
|---|
| 134 | 116 | |
|---|
| 135 | 117 | extern void rt_mutex_unlock(struct rt_mutex *lock); |
|---|