summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2015-06-15 20:34:09 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2015-06-16 22:31:41 +0200
commit1b838d0c3845b344c598b4631327914cc509dd2e (patch)
tree50e3c594be0d1f1144d65d6b8642400f5e7e952d
parent32825450e77e63dbb3b7343476f39a283ec3da46 (diff)
header: fix warning in lockdep_assert_held()backports-20150612
When building the kernel there are lots of warnings like this: drivers/net/wireless/ath/ath10k/ce.c:404:21: warning: unused variable ‘ar_pci’ [-Wunused-variable] struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); They are caused by an empty lockdep_assert_held() which does nothing with this variable in kernel version < 3.9. This patch replaces this macro with the version from a recent kernel and silence this warning. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/lockdep.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/backport/backport-include/linux/lockdep.h b/backport/backport-include/linux/lockdep.h
new file mode 100644
index 00000000..3974b8d7
--- /dev/null
+++ b/backport/backport-include/linux/lockdep.h
@@ -0,0 +1,17 @@
+#ifndef __BACKPORT_LINUX_LOCKDEP_H
+#define __BACKPORT_LINUX_LOCKDEP_H
+#include_next <linux/lockdep.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
+#undef lockdep_assert_held
+#ifdef CONFIG_LOCKDEP
+#define lockdep_assert_held(l) do { \
+ WARN_ON(debug_locks && !lockdep_is_held(l)); \
+ } while (0)
+#else
+#define lockdep_assert_held(l) do { (void)(l); } while (0)
+#endif /* CONFIG_LOCKDEP */
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */
+
+#endif /* __BACKPORT_LINUX_LOCKDEP_H */