aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2021-10-09 18:31:46 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-10-18 23:01:19 +0200
commitaf58b27b1b1ab1133c0fec4d817cd6360ebe280e (patch)
tree3b430829003c76898c48bdbf80945f2854b3b8ad
parentbb2e9faedc8957dea5fa1c50a959ca5d71141b33 (diff)
downloadbackports-af58b27b1b1ab1133c0fec4d817cd6360ebe280e.tar.gz
headers: Add lockdep_assert_not_held()
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>
-rw-r--r--backport/backport-include/linux/lockdep.h11
1 files changed, 11 insertions, 0 deletions
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 */