mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-01 18:24:23 +08:00
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>
This commit is contained in:
parent
93b8877471
commit
9a37110d20
@ -362,6 +362,10 @@ extern void lockdep_trace_alloc(gfp_t mask);
|
|||||||
WARN_ON(debug_locks && !lockdep_is_held(l)); \
|
WARN_ON(debug_locks && !lockdep_is_held(l)); \
|
||||||
} while (0)
|
} 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)
|
#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
|
||||||
|
|
||||||
#else /* !CONFIG_LOCKDEP */
|
#else /* !CONFIG_LOCKDEP */
|
||||||
@ -412,6 +416,7 @@ struct lock_class_key { };
|
|||||||
#define lockdep_depth(tsk) (0)
|
#define lockdep_depth(tsk) (0)
|
||||||
|
|
||||||
#define lockdep_assert_held(l) do { (void)(l); } while (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)
|
#define lockdep_recursing(tsk) (0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user