aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2021-10-09 18:32:19 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-10-18 23:01:19 +0200
commitdfdd3dc2aab94e76b987c28201b5bbf9b9b7f443 (patch)
tree8ba40a6970cca1e70e2b2652c311abfc884acd13
parent35cf9be2759027850c22af2b68ef08001349f223 (diff)
downloadbackports-dfdd3dc2aab94e76b987c28201b5bbf9b9b7f443.tar.gz
headers: Add rfkill_set_hw_state_reason()
This adds the new function rfkill_set_hw_state_reason() from kernel 5.11 and maps it to the old rfkill_set_hw_state() by dropping the reason. kernel 5.11 also moved some definitions to the uapi/linux/rfkill.h, but on kernel versions < 5.11 it is not sufficient to only include the uapi version. This is used by the core wireless system. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/rfkill.h24
-rw-r--r--patches/0013-fix-makefile-includes/cfg80211.patch14
2 files changed, 37 insertions, 1 deletions
diff --git a/backport/backport-include/linux/rfkill.h b/backport/backport-include/linux/rfkill.h
new file mode 100644
index 00000000..c0b99d58
--- /dev/null
+++ b/backport/backport-include/linux/rfkill.h
@@ -0,0 +1,24 @@
+#ifndef __BACKPORT_UAPI__RFKILL_H
+#define __BACKPORT_UAPI__RFKILL_H
+#include_next <linux/rfkill.h>
+
+
+#if LINUX_VERSION_IS_LESS(5,11,0)
+
+/* This should come from uapi/linux/rfkill.h, but it was much easier
+ * to do it this way.
+ */
+enum rfkill_hard_block_reasons {
+ RFKILL_HARD_BLOCK_SIGNAL = 1 << 0,
+ RFKILL_HARD_BLOCK_NOT_OWNER = 1 << 1,
+};
+
+static inline bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
+ bool blocked, unsigned long reason)
+{
+ return rfkill_set_hw_state(rfkill, blocked);
+}
+
+#endif /* 5.11 */
+
+#endif /* __BACKPORT_UAPI__RFKILL_H */
diff --git a/patches/0013-fix-makefile-includes/cfg80211.patch b/patches/0013-fix-makefile-includes/cfg80211.patch
index 0e079911..c44e3f58 100644
--- a/patches/0013-fix-makefile-includes/cfg80211.patch
+++ b/patches/0013-fix-makefile-includes/cfg80211.patch
@@ -6,7 +6,19 @@ the type is renamed.
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
-@@ -22,6 +22,7 @@
+@@ -11,7 +11,11 @@
+ */
+
+ #include <linux/ethtool.h>
++#if LINUX_VERSION_IS_LESS(5,11,0)
++#include <linux/rfkill.h>
++#else
+ #include <uapi/linux/rfkill.h>
++#endif
+ #include <linux/netdevice.h>
+ #include <linux/debugfs.h>
+ #include <linux/list.h>
+@@ -23,6 +27,7 @@
#include <linux/ieee80211.h>
#include <linux/net.h>
#include <net/regulatory.h>