All of lore.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

* [tip:core/locking] mutex: Make mutex_destroy() an inline function
  2011-07-16 15:42 [PATCH] mutex: Make mutex_destroy an inline function Jean Delvare
@ 2011-07-21 10:09 ` tip-bot for Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Jean Delvare @ 2011-07-21 10:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, khali, tglx, mingo

Commit-ID:  4582c0a4866ea70c35aa9279e1f91834d3348a93
Gitweb:     http://git.kernel.org/tip/4582c0a4866ea70c35aa9279e1f91834d3348a93
Author:     Jean Delvare <khali@linux-fr.org>
AuthorDate: Sat, 16 Jul 2011 17:42:00 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jul 2011 09:36:09 +0200

mutex: Make mutex_destroy() an inline function

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: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20110716174200.41002352@endymion.delvare
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/mutex.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index a940fe4..7f87217 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -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

^ permalink raw reply related	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.