[PATCH 20/47] headers: Add lockdep_assert_not_held()

Hauke Mehrtens <[email protected]>
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
The lockdep_assert_not_held() define was added in kernel 5.13 and is
used by ath10k now.
The code was copied from the upstream kernel.

Signed-off-by: Hauke Mehrtens <[email protected]>
---
 backport/backport-include/linux/lockdep.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/backport/backport-include/linux/lockdep.h b/backport/backport-include/linux/lockdep.h
index 7cf38b23..ed5ea678 100644
--- a/backport/backport-include/linux/lockdep.h
+++ b/backport/backport-include/linux/lockdep.h
@@ -9,4 +9,15 @@ struct lockdep_map { };
 #endif /* CONFIG_LOCKDEP */
 #endif /* LINUX_VERSION_IS_LESS(4,15,0) */
 
+#ifndef lockdep_assert_not_held
+#ifdef CONFIG_LOCKDEP
+#define lockdep_assert_not_held(l)	do {				\
+		WARN_ON(debug_locks &&					\
+			lockdep_is_held(l) == LOCK_STATE_HELD);		\
+	} while (0)
+#else
+#define lockdep_assert_not_held(l)		do { (void)(l); } while (0)
+#endif /* CONFIG_LOCKDEP */
+#endif /* lockdep_assert_not_held */
+
 #endif /* __BACKPORT_LINUX_LOCKDEP_H */
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.