git: 1cf90ce2414d - stable/13 - LinuxKPI: Make lockdep*_pin_lock macros useable for drm-kmod

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sat, 22 Jan 2022 19:36:26 UTC
The branch stable/13 has been updated by wulf:

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

commit 1cf90ce2414d8c9c1c0cecaae9484a57951c1123
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-12-03 13:38:19 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-01-22 19:34:36 +0000

    LinuxKPI: Make lockdep*_pin_lock macros useable for drm-kmod
    
    Summary:
    - Add dummy struct pin_cookie definition;
    - Convert lockdep_pin_lock macro to function;
    - Fix 'unused variable' compile-time errors;
    
    MFC after:      1 week
    Reviewers:      hselasky, manu
    Differential Revision:  https://reviews.freebsd.org/D33295
    
    (cherry picked from commit 68fcdba38b7ea65b1f2f395fbd25fb59880d7163)
---
 sys/compat/linuxkpi/common/include/linux/lockdep.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/lockdep.h b/sys/compat/linuxkpi/common/include/linux/lockdep.h
index 0bcb1fa7b925..25dad8698c74 100644
--- a/sys/compat/linuxkpi/common/include/linux/lockdep.h
+++ b/sys/compat/linuxkpi/common/include/linux/lockdep.h
@@ -38,6 +38,8 @@ struct lock_class_key {
 };
 struct lockdep_map {
 };
+struct pin_cookie {
+};
 
 #define	lockdep_set_class(lock, key)
 #define	lockdep_set_subclass(lock, sub)
@@ -69,9 +71,9 @@ lockdep_is_held(void *__m)
 #define	lockdep_is_held_type(_m, _t) lockdep_is_held(_m)
 
 #else
-#define	lockdep_assert_held(m) do { } while (0)
+#define	lockdep_assert_held(m) do { (void)(m); } while (0)
 
-#define	lockdep_assert_held_once(m) do { } while (0)
+#define	lockdep_assert_held_once(m) do { (void)(m); } while (0)
 
 #define	lockdep_is_held(m)	1
 #define	lockdep_is_held_type(_m, _t)	1
@@ -88,9 +90,9 @@ lockdep_is_held(void *__m)
 #define	mutex_acquire(...) do { } while (0)
 #define	mutex_release(...) do { } while (0)
 
-#define	lockdep_pin_lock(l) do { } while (0)
-#define	lockdep_repin_lock(l,c) do { } while (0)
-#define	lockdep_unpin_lock(l,c) do { } while (0)
+#define	lockdep_pin_lock(l) ({ struct pin_cookie __pc = { }; __pc; })
+#define	lockdep_repin_lock(l,c) do { (void)(l); (void)(c); } while (0)
+#define	lockdep_unpin_lock(l,c) do { (void)(l); (void)(c); } while (0)
 
 #define	lock_map_acquire(_map) do { } while (0)
 #define	lock_map_acquire_read(_map) do { } while (0)