git: a1fc49b1ec37 - stable/13 - linuxkpi: Define `lockdep_assert{,_once}()`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Thu, 16 Feb 2023 11:56:28 UTC
The branch stable/13 has been updated by dumbbell (ports committer):

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

commit a1fc49b1ec377c80cd596f48b00a9edac919b15e
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-16 11:55:19 +0000

    linuxkpi: Define `lockdep_assert{,_once}()`
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38538
    
    (cherry picked from commit b82bcfb66fa5ef30939f3f5169a07bf4bc139e71)
---
 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 f1bec0efeee8..41b4b71ffb20 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)