Thread (53 messages) 53 messages, 9 authors, 2022-02-11
STALE1587d

[PATCH 08/12] locking/mutex: Init name properly w/ CONFIG_LOCK_INFO

From: Namhyung Kim <namhyung@kernel.org>
Date: 2022-02-08 18:43:03
Subsystem: locking primitives, the rest · Maintainers: Peter Zijlstra, Ingo Molnar, Will Deacon, Boqun Feng, Linus Torvalds

The mutex.dep_map.name was set in debug_mutex_init() which is defined
only if CONFIG_DEBUG_MUTEXES is on.  Let's fix it to work with
CONFIG_LOCK_INFO as well.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 kernel/locking/mutex.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/kernel/locking/mutex.h b/kernel/locking/mutex.h
index 0b2a79c4013b..b7b584ecdfef 100644
--- a/kernel/locking/mutex.h
+++ b/kernel/locking/mutex.h
@@ -41,5 +41,12 @@ extern void debug_mutex_init(struct mutex *lock, const char *name,
 # define debug_mutex_add_waiter(lock, waiter, ti)	do { } while (0)
 # define debug_mutex_remove_waiter(lock, waiter, ti)	do { } while (0)
 # define debug_mutex_unlock(lock)			do { } while (0)
+
+#ifdef CONFIG_LOCK_INFO
+# define debug_mutex_init(lock, name, key)			\
+		lockdep_set_class_and_name(lock, key, name)
+#else
 # define debug_mutex_init(lock, name, key)		do { } while (0)
+#endif /* !CONFIG_LOCK_INFO */
+
 #endif /* !CONFIG_DEBUG_MUTEXES */
-- 
2.35.0.263.gb82422642f-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help