public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mutex: Make mutex_destroy an inline function
@ 2011-07-16 15:42 Jean Delvare
  2011-07-21 10:09 ` [tip:core/locking] mutex: Make mutex_destroy() " tip-bot for Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2011-07-16 15:42 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, Andrew Morton

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@linux-fr.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-21 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-16 15:42 [PATCH] mutex: Make mutex_destroy an inline function Jean Delvare
2011-07-21 10:09 ` [tip:core/locking] mutex: Make mutex_destroy() " tip-bot for Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox