]> git.karo-electronics.de Git - linux-beck.git/commitdiff
locking: Add WARN_ON_ONCE lock assertion
authorPeter Hurley <peter@hurleysoftware.com>
Wed, 10 Sep 2014 18:31:39 +0000 (14:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 04:06:21 +0000 (21:06 -0700)
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>
include/linux/lockdep.h

index 008388f920d7e93e32ba388dd4b497f33d7bd49d..64c7425afbcec6036f25385b15c1e566be3d92bb 100644 (file)
@@ -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)