| .. | .. |
|---|
| 19 | 19 | #include <asm/processor.h> |
|---|
| 20 | 20 | #include <linux/osq_lock.h> |
|---|
| 21 | 21 | #include <linux/debug_locks.h> |
|---|
| 22 | +#include <linux/android_vendor.h> |
|---|
| 22 | 23 | |
|---|
| 23 | 24 | struct ww_acquire_ctx; |
|---|
| 24 | 25 | |
|---|
| 25 | 26 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 26 | | -# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ |
|---|
| 27 | | - , .dep_map = { .name = #lockname } |
|---|
| 27 | +# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ |
|---|
| 28 | + , .dep_map = { \ |
|---|
| 29 | + .name = #lockname, \ |
|---|
| 30 | + .wait_type_inner = LD_WAIT_SLEEP, \ |
|---|
| 31 | + } |
|---|
| 28 | 32 | #else |
|---|
| 29 | 33 | # define __DEP_MAP_MUTEX_INITIALIZER(lockname) |
|---|
| 30 | 34 | #endif |
|---|
| 31 | 35 | |
|---|
| 32 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 36 | +#ifdef CONFIG_PREEMPT_RT |
|---|
| 33 | 37 | # include <linux/mutex_rt.h> |
|---|
| 34 | 38 | #else |
|---|
| 35 | 39 | |
|---|
| .. | .. |
|---|
| 74 | 78 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 75 | 79 | struct lockdep_map dep_map; |
|---|
| 76 | 80 | #endif |
|---|
| 81 | + ANDROID_OEM_DATA_ARRAY(1, 2); |
|---|
| 77 | 82 | }; |
|---|
| 78 | 83 | |
|---|
| 79 | | -/* |
|---|
| 80 | | - * Internal helper function; C doesn't allow us to hide it :/ |
|---|
| 81 | | - * |
|---|
| 82 | | - * DO NOT USE (outside of mutex code). |
|---|
| 83 | | - */ |
|---|
| 84 | | -static inline struct task_struct *__mutex_owner(struct mutex *lock) |
|---|
| 85 | | -{ |
|---|
| 86 | | - return (struct task_struct *)(atomic_long_read(&lock->owner) & ~0x07); |
|---|
| 87 | | -} |
|---|
| 84 | +struct ww_class; |
|---|
| 85 | +struct ww_acquire_ctx; |
|---|
| 88 | 86 | |
|---|
| 89 | 87 | /* |
|---|
| 90 | 88 | * This is the control structure for tasks blocked on mutex, |
|---|
| .. | .. |
|---|
| 148 | 146 | * |
|---|
| 149 | 147 | * Returns true if the mutex is locked, false if unlocked. |
|---|
| 150 | 148 | */ |
|---|
| 151 | | -static inline bool mutex_is_locked(struct mutex *lock) |
|---|
| 152 | | -{ |
|---|
| 153 | | - return __mutex_owner(lock) != NULL; |
|---|
| 154 | | -} |
|---|
| 149 | +extern bool mutex_is_locked(struct mutex *lock); |
|---|
| 155 | 150 | |
|---|
| 156 | 151 | /* |
|---|
| 157 | 152 | * See kernel/locking/mutex.c for detailed documentation of these APIs. |
|---|
| 158 | | - * Also see Documentation/locking/mutex-design.txt. |
|---|
| 153 | + * Also see Documentation/locking/mutex-design.rst. |
|---|
| 159 | 154 | */ |
|---|
| 160 | 155 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 161 | 156 | extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); |
|---|
| .. | .. |
|---|
| 224 | 219 | * - MUTEX_TRYLOCK_SUCCESS - lock acquired, |
|---|
| 225 | 220 | * - MUTEX_TRYLOCK_RECURSIVE - we already owned the lock. |
|---|
| 226 | 221 | */ |
|---|
| 227 | | -static inline /* __deprecated */ __must_check enum mutex_trylock_recursive_enum |
|---|
| 228 | | -mutex_trylock_recursive(struct mutex *lock) |
|---|
| 229 | | -{ |
|---|
| 230 | | - if (unlikely(__mutex_owner(lock) == current)) |
|---|
| 231 | | - return MUTEX_TRYLOCK_RECURSIVE; |
|---|
| 222 | +extern /* __deprecated */ __must_check enum mutex_trylock_recursive_enum |
|---|
| 223 | +mutex_trylock_recursive(struct mutex *lock); |
|---|
| 232 | 224 | |
|---|
| 233 | | - return mutex_trylock(lock); |
|---|
| 234 | | -} |
|---|
| 235 | | - |
|---|
| 236 | | -#endif /* !PREEMPT_RT_FULL */ |
|---|
| 225 | +#endif /* !PREEMPT_RT */ |
|---|
| 237 | 226 | |
|---|
| 238 | 227 | #endif /* __LINUX_MUTEX_H */ |
|---|