hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/include/linux/mutex.h
....@@ -19,17 +19,21 @@
1919 #include <asm/processor.h>
2020 #include <linux/osq_lock.h>
2121 #include <linux/debug_locks.h>
22
+#include <linux/android_vendor.h>
2223
2324 struct ww_acquire_ctx;
2425
2526 #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
+ }
2832 #else
2933 # define __DEP_MAP_MUTEX_INITIALIZER(lockname)
3034 #endif
3135
32
-#ifdef CONFIG_PREEMPT_RT_FULL
36
+#ifdef CONFIG_PREEMPT_RT
3337 # include <linux/mutex_rt.h>
3438 #else
3539
....@@ -74,17 +78,11 @@
7478 #ifdef CONFIG_DEBUG_LOCK_ALLOC
7579 struct lockdep_map dep_map;
7680 #endif
81
+ ANDROID_OEM_DATA_ARRAY(1, 2);
7782 };
7883
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;
8886
8987 /*
9088 * This is the control structure for tasks blocked on mutex,
....@@ -148,14 +146,11 @@
148146 *
149147 * Returns true if the mutex is locked, false if unlocked.
150148 */
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);
155150
156151 /*
157152 * 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.
159154 */
160155 #ifdef CONFIG_DEBUG_LOCK_ALLOC
161156 extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
....@@ -224,15 +219,9 @@
224219 * - MUTEX_TRYLOCK_SUCCESS - lock acquired,
225220 * - MUTEX_TRYLOCK_RECURSIVE - we already owned the lock.
226221 */
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);
232224
233
- return mutex_trylock(lock);
234
-}
235
-
236
-#endif /* !PREEMPT_RT_FULL */
225
+#endif /* !PREEMPT_RT */
237226
238227 #endif /* __LINUX_MUTEX_H */