diff mbox series

[20/47] headers: Add lockdep_assert_not_held()

Message ID 20211019214320.2035704-21-hauke@hauke-m.de (mailing list archive)
State New, archived
Headers show
Series backports: Update to kernel 5.15-rc6 | expand

Commit Message

Hauke Mehrtens Oct. 19, 2021, 9:42 p.m. UTC
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 <hauke@hauke-m.de>
---
 backport/backport-include/linux/lockdep.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

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 */