svn commit: r313908 - in head/sys: kern sys

Mateusz Guzik mjg at FreeBSD.org
Sat Feb 18 01:52:12 UTC 2017


Author: mjg
Date: Sat Feb 18 01:52:10 2017
New Revision: 313908
URL: https://svnweb.freebsd.org/changeset/base/313908

Log:
  mtx: plug the 'opts' argument when not used

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/sys/lock.h
  head/sys/sys/mutex.h

Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c	Sat Feb 18 00:08:13 2017	(r313907)
+++ head/sys/kern/kern_mutex.c	Sat Feb 18 01:52:10 2017	(r313908)
@@ -429,7 +429,7 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
     const char *file, int line)
 #else
 void
-__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid, int opts)
+__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid)
 #endif
 {
 	struct mtx *m;
@@ -471,14 +471,18 @@ __mtx_lock_sleep(volatile uintptr_t *c, 
 		    (opts & MTX_RECURSE) != 0,
 	    ("_mtx_lock_sleep: recursed on non-recursive mutex %s @ %s:%d\n",
 		    m->lock_object.lo_name, file, line));
+#if LOCK_DEBUG > 0
 		opts &= ~MTX_RECURSE;
+#endif
 		m->mtx_recurse++;
 		atomic_set_ptr(&m->mtx_lock, MTX_RECURSED);
 		if (LOCK_LOG_TEST(&m->lock_object, opts))
 			CTR1(KTR_LOCK, "_mtx_lock_sleep: %p recursing", m);
 		return;
 	}
+#if LOCK_DEBUG > 0
 	opts &= ~MTX_RECURSE;
+#endif
 
 #ifdef HWPMC_HOOKS
 	PMC_SOFT_CALL( , , lock, failed);
@@ -873,7 +877,7 @@ void
 __mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file, int line)
 #else
 void
-__mtx_unlock_sleep(volatile uintptr_t *c, int opts)
+__mtx_unlock_sleep(volatile uintptr_t *c)
 #endif
 {
 	struct mtx *m;

Modified: head/sys/sys/lock.h
==============================================================================
--- head/sys/sys/lock.h	Sat Feb 18 00:08:13 2017	(r313907)
+++ head/sys/sys/lock.h	Sat Feb 18 01:52:10 2017	(r313908)
@@ -154,8 +154,13 @@ struct lock_class {
  * file    - file name
  * line    - line number
  */
+#if LOCK_DEBUG > 0
 #define	LOCK_LOG_TEST(lo, flags)					\
 	(((flags) & LOP_QUIET) == 0 && ((lo)->lo_flags & LO_QUIET) == 0)
+#else
+#define	LOCK_LOG_TEST(lo, flags)	0
+#endif
+
 
 #define	LOCK_LOG_LOCK(opname, lo, flags, recurse, file, line) do {	\
 	if (LOCK_LOG_TEST((lo), (flags)))				\

Modified: head/sys/sys/mutex.h
==============================================================================
--- head/sys/sys/mutex.h	Sat Feb 18 00:08:13 2017	(r313907)
+++ head/sys/sys/mutex.h	Sat Feb 18 01:52:10 2017	(r313908)
@@ -104,9 +104,8 @@ void	__mtx_lock_sleep(volatile uintptr_t
 void	__mtx_unlock_sleep(volatile uintptr_t *c, int opts, const char *file,
 	    int line);
 #else
-void	__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid,
-	    int opts);
-void	__mtx_unlock_sleep(volatile uintptr_t *c, int opts);
+void	__mtx_lock_sleep(volatile uintptr_t *c, uintptr_t v, uintptr_t tid);
+void	__mtx_unlock_sleep(volatile uintptr_t *c);
 #endif
 
 #ifdef SMP
@@ -154,9 +153,9 @@ void	thread_lock_flags_(struct thread *,
 	__mtx_unlock_sleep(&(m)->mtx_lock, o, f, l)
 #else
 #define	_mtx_lock_sleep(m, v, t, o, f, l)				\
-	__mtx_lock_sleep(&(m)->mtx_lock, v, t, o)
+	__mtx_lock_sleep(&(m)->mtx_lock, v, t)
 #define	_mtx_unlock_sleep(m, o, f, l)					\
-	__mtx_unlock_sleep(&(m)->mtx_lock, o)
+	__mtx_unlock_sleep(&(m)->mtx_lock)
 #endif
 #ifdef SMP
 #define	_mtx_lock_spin(m, v, t, o, f, l)				\


More information about the svn-src-head mailing list