Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Feb 2022 18:15:43 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a108252a712a - stable/13 - LinuxKPI: lockdep add lockdep_assert_not_held()
Message-ID:  <202202201815.21KIFh5N023055@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz:

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

commit a108252a712aec9ed2cc4bdbdd76d45d253fd3ea
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-02-09 12:01:32 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-02-20 16:25:03 +0000

    LinuxKPI: lockdep add lockdep_assert_not_held()
    
    Add lockdep_assert_not_held() asserting LA_UNLOCKED as needed by a
    driver.
    
    Reviewed by:    hselasky
    Differential Revision: https://reviews.freebsd.org/D34232
    
    (cherry picked from commit 064c110f4b551cbf3f2ef6f567736005c2d7007a)
---
 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 a801f2c2bbac..66bda709606e 100644
--- a/sys/compat/linuxkpi/common/include/linux/lockdep.h
+++ b/sys/compat/linuxkpi/common/include/linux/lockdep.h
@@ -50,6 +50,11 @@ struct pin_cookie {
 #define	lockdep_init_map(_map, _name, _key, _x) do { } while(0)
 
 #ifdef INVARIANTS
+#define	lockdep_assert_not_held(m) do {					\
+	struct lock_object *__lock = (struct lock_object *)(m);		\
+	LOCK_CLASS(__lock)->lc_assert(__lock, LA_UNLOCKED);		\
+} while (0)
+
 #define	lockdep_assert_held(m) do {					\
 	struct lock_object *__lock = (struct lock_object *)(m);		\
 	LOCK_CLASS(__lock)->lc_assert(__lock, LA_LOCKED);		\
@@ -72,6 +77,7 @@ lockdep_is_held(void *__m)
 #define	lockdep_is_held_type(_m, _t) lockdep_is_held(_m)
 
 #else
+#define	lockdep_assert_not_held(m) do { (void)(m); } while (0)
 #define	lockdep_assert_held(m) do { (void)(m); } while (0)
 
 #define	lockdep_assert_held_once(m) do { (void)(m); } while (0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202201815.21KIFh5N023055>