summaryrefslogtreecommitdiffstats
path: root/include/linux/lockdep.h
diff options
context:
space:
mode:
authorPeter Hurley2014-09-10 20:31:39 +0200
committerGreg Kroah-Hartman2014-09-24 06:06:21 +0200
commit9a37110d20c95d1ebf6c04881177fe8f62831db2 (patch)
tree6c997c35c6e3193fc73e4bfeb74ddc5fee56f233 /include/linux/lockdep.h
parenttty: serial_mctrl_gpio: Fix COMPILE_TEST build for architectures with custom ... (diff)
downloadkernel-qcow2-linux-9a37110d20c95d1ebf6c04881177fe8f62831db2.tar.gz
kernel-qcow2-linux-9a37110d20c95d1ebf6c04881177fe8f62831db2.tar.xz
kernel-qcow2-linux-9a37110d20c95d1ebf6c04881177fe8f62831db2.zip
locking: Add WARN_ON_ONCE lock assertion
An interface may need to assert a lock invariant and not flood the system logs; add a lockdep helper macro equivalent to lockdep_assert_held() which only WARNs once. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Acked-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/lockdep.h')
-rw-r--r--include/linux/lockdep.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 008388f920d7..64c7425afbce 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask);
WARN_ON(debug_locks && !lockdep_is_held(l)); \
} while (0)
+#define lockdep_assert_held_once(l) do { \
+ WARN_ON_ONCE(debug_locks && !lockdep_is_held(l)); \
+ } while (0)
+
#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
#else /* !CONFIG_LOCKDEP */
@@ -412,6 +416,7 @@ struct lock_class_key { };
#define lockdep_depth(tsk) (0)
#define lockdep_assert_held(l) do { (void)(l); } while (0)
+#define lockdep_assert_held_once(l) do { (void)(l); } while (0)
#define lockdep_recursing(tsk) (0)