[PATCH] mutex: Make mutex_destroy an inline function

From: Jean Delvare
Date: Sat Jul 16 2011 - 11:42:20 EST


The non-debug variant of mutex_destroy is a no-op, currently
implemented as a macro which does nothing. This approach fails to
check the type of the parameter, so an error would only show when
debugging gets enabled. Using an inline function instead, offers
type checking for earlier bug catching.

Signed-off-by: Jean Delvare <khali@xxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
---
include/linux/mutex.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-3.0-rc7.orig/include/linux/mutex.h 2011-05-30 20:45:24.000000000 +0200
+++ linux-3.0-rc7/include/linux/mutex.h 2011-07-16 15:42:38.000000000 +0200
@@ -92,7 +92,7 @@ do { \
\
__mutex_init((mutex), #mutex, &__key); \
} while (0)
-# define mutex_destroy(mutex) do { } while (0)
+static inline void mutex_destroy(struct mutex *lock) {}
#endif

#ifdef CONFIG_DEBUG_LOCK_ALLOC


--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/