diff mbox series

[22/47] headers: Add rfkill_set_hw_state_reason()

Message ID 20211019214320.2035704-23-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
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>
---
 backport/backport-include/linux/rfkill.h      | 24 +++++++++++++++++++
 .../0013-fix-makefile-includes/cfg80211.patch | 14 ++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 backport/backport-include/linux/rfkill.h
diff mbox series

Patch

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>