[PATCH v5 01/10] locking/mutex: move mutex_destroy() definition lower

George Stark gnstark at salutedevices.com
Thu Mar 7 13:40:25 AEDT 2024


mutex_destroy() definition is located in the middle of the code related
purely to mutex initialization so place it separately after mutex_init()

Signed-off-by: George Stark <gnstark at salutedevices.com>
---
Hello Waiman. This is helper patch to make resulting mutex.h look like we discussed
it in December. It was in you cleanup patch at first but slept away somehow

 include/linux/mutex.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 67edc4ca2bee..f7611c092db7 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -37,14 +37,10 @@
 # define __DEBUG_MUTEX_INITIALIZER(lockname)				\
 	, .magic = &lockname

-extern void mutex_destroy(struct mutex *lock);
-
 #else

 # define __DEBUG_MUTEX_INITIALIZER(lockname)

-static inline void mutex_destroy(struct mutex *lock) {}
-
 #endif

 #ifndef CONFIG_PREEMPT_RT
@@ -117,6 +113,16 @@ do {							\
 } while (0)
 #endif /* CONFIG_PREEMPT_RT */

+#ifdef CONFIG_DEBUG_MUTEXES
+
+void mutex_destroy(struct mutex *lock);
+
+#else
+
+static inline void mutex_destroy(struct mutex *lock) {}
+
+#endif
+
 /*
  * See kernel/locking/mutex.c for detailed documentation of these APIs.
  * Also see Documentation/locking/mutex-design.rst.
--
2.25.1



More information about the Linuxppc-dev mailing list