git: b82bcfb66fa5 - main - linuxkpi: Define `lockdep_assert{,_once}()`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Mon, 13 Feb 2023 21:09:51 UTC
The branch main has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=b82bcfb66fa5ef30939f3f5169a07bf4bc139e71

commit b82bcfb66fa5ef30939f3f5169a07bf4bc139e71
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-02-09 22:04:26 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-02-13 21:09:32 +0000

    linuxkpi: Define `lockdep_assert{,_once}()`
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38538
---
 sys/compat/linuxkpi/common/include/linux/lockdep.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/lockdep.h b/sys/compat/linuxkpi/common/include/linux/lockdep.h
index 1f68d6fbc22d..97991c4e598a 100644
--- a/sys/compat/linuxkpi/common/include/linux/lockdep.h
+++ b/sys/compat/linuxkpi/common/include/linux/lockdep.h
@@ -52,6 +52,9 @@ struct pin_cookie {
 #define	lockdep_unregister_key(key) do { } while(0)
 
 #ifdef INVARIANTS
+#define	lockdep_assert(cond) do { WARN_ON(!cond); } while (0)
+#define	lockdep_assert_once(cond) do { WARN_ON_ONCE(!cond); } while (0)
+
 #define	lockdep_assert_not_held(m) do {					\
 	struct lock_object *__lock = (struct lock_object *)(m);		\
 	LOCK_CLASS(__lock)->lc_assert(__lock, LA_UNLOCKED);		\
@@ -81,6 +84,9 @@ lockdep_is_held(void *__m)
 #define	lockdep_is_held_type(_m, _t) lockdep_is_held(_m)
 
 #else
+#define	lockdep_assert(cond) do { } while (0)
+#define	lockdep_assert_once(cond) do { } while (0)
+
 #define	lockdep_assert_not_held(m) do { (void)(m); } while (0)
 #define	lockdep_assert_held(m) do { (void)(m); } while (0)
 #define	lockdep_assert_none_held_once() do { } while (0)