openwrt/target/linux/generic/pending-6.1/731-net-permit-ieee80211_pt...

60 lines
2.0 KiB
Diff

From 686c603f67ae87bf21a61b5e4b1564443f41c3ee Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Thu, 20 Oct 2022 03:34:43 +0200
Subject: [PATCH] net: permit ieee80211_ptr even with no CFG82111 support
Introduce a new flag CONFIG_CFG80211_HEADERS to compile in ieee80211_ptr
even if CFG80211 support is not compiled in. This is needed for the
backports project and for any downstream wireless driver that loads in
the kernel dynamically.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
include/linux/netdevice.h | 2 +-
net/batman-adv/hard-interface.c | 2 +-
net/wireless/Kconfig | 4 ++++
3 files changed, 6 insertions(+), 2 deletions(-)
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2190,7 +2190,7 @@ struct net_device {
#if IS_ENABLED(CONFIG_AX25)
void *ax25_ptr;
#endif
-#if IS_ENABLED(CONFIG_CFG80211)
+#if IS_ENABLED(CONFIG_CFG80211_HEADERS)
struct wireless_dev *ieee80211_ptr;
#endif
#if IS_ENABLED(CONFIG_IEEE802154) || IS_ENABLED(CONFIG_6LOWPAN)
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -308,7 +308,7 @@ static bool batadv_is_cfg80211_netdev(st
if (!net_device)
return false;
-#if IS_ENABLED(CONFIG_CFG80211)
+#if IS_ENABLED(CONFIG_CFG80211_HEADERS)
/* cfg80211 drivers have to set ieee80211_ptr */
if (net_device->ieee80211_ptr)
return true;
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -26,6 +26,7 @@ config CFG80211
# using a different algorithm, though right now they shouldn't
# (this is here rather than below to allow it to be a module)
select CRYPTO_SHA256 if CFG80211_USE_KERNEL_REGDB_KEYS
+ select CFG80211_HEADERS
help
cfg80211 is the Linux wireless LAN (802.11) configuration API.
Enable this if you have a wireless device.
@@ -36,6 +37,9 @@ config CFG80211
When built as a module it will be called cfg80211.
+config CFG80211_HEADERS
+ bool "cfg80211 - headers support"
+
if CFG80211
config NL80211_TESTMODE