git: 064c110f4b55 - main - LinuxKPI: lockdep add lockdep_assert_not_held()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 15 Feb 2022 23:16:32 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=064c110f4b551cbf3f2ef6f567736005c2d7007a commit 064c110f4b551cbf3f2ef6f567736005c2d7007a 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-15 23:15:00 +0000 LinuxKPI: lockdep add lockdep_assert_not_held() Add lockdep_assert_not_held() asserting LA_UNLOCKED as needed by a driver. MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34232 --- 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 142ca3e52b25..2289db7756d4 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)