generic: 6.1: add patch to compile ieee8211 headers
[openwrt/openwrt.git] / target / linux / generic / pending-6.1 / 731-net-permit-ieee80211_ptr-even-with-no-CFG82111-suppo.patch
1 From 686c603f67ae87bf21a61b5e4b1564443f41c3ee Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Thu, 20 Oct 2022 03:34:43 +0200
4 Subject: [PATCH] net: permit ieee80211_ptr even with no CFG82111 support
5
6 Introduce a new flag CONFIG_CFG80211_HEADERS to compile in ieee80211_ptr
7 even if CFG80211 support is not compiled in. This is needed for the
8 backports project and for any downstream wireless driver that loads in
9 the kernel dynamically.
10
11 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
12 ---
13 include/linux/netdevice.h | 2 +-
14 net/batman-adv/hard-interface.c | 2 +-
15 net/wireless/Kconfig | 4 ++++
16 3 files changed, 6 insertions(+), 2 deletions(-)
17
18 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
19 index eddf8ee270e7..1ac7390772de 100644
20 --- a/include/linux/netdevice.h
21 +++ b/include/linux/netdevice.h
22 @@ -2156,7 +2156,7 @@ struct net_device {
23 #if IS_ENABLED(CONFIG_AX25)
24 void *ax25_ptr;
25 #endif
26 -#if IS_ENABLED(CONFIG_CFG80211)
27 +#if IS_ENABLED(CONFIG_CFG80211_HEADERS)
28 struct wireless_dev *ieee80211_ptr;
29 #endif
30 #if IS_ENABLED(CONFIG_IEEE802154) || IS_ENABLED(CONFIG_6LOWPAN)
31 diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
32 index 41c1ad33d009..58a1c5999b44 100644
33 --- a/net/batman-adv/hard-interface.c
34 +++ b/net/batman-adv/hard-interface.c
35 @@ -308,7 +308,7 @@ static bool batadv_is_cfg80211_netdev(struct net_device *net_device)
36 if (!net_device)
37 return false;
38
39 -#if IS_ENABLED(CONFIG_CFG80211)
40 +#if IS_ENABLED(CONFIG_CFG80211_HEADERS)
41 /* cfg80211 drivers have to set ieee80211_ptr */
42 if (net_device->ieee80211_ptr)
43 return true;
44 diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
45 index f620acd2a0f5..9f1aa9ec9fa3 100644
46 --- a/net/wireless/Kconfig
47 +++ b/net/wireless/Kconfig
48 @@ -26,6 +26,7 @@ config CFG80211
49 # using a different algorithm, though right now they shouldn't
50 # (this is here rather than below to allow it to be a module)
51 select CRYPTO_SHA256 if CFG80211_USE_KERNEL_REGDB_KEYS
52 + select CFG80211_HEADERS
53 help
54 cfg80211 is the Linux wireless LAN (802.11) configuration API.
55 Enable this if you have a wireless device.
56 @@ -36,6 +37,9 @@ config CFG80211
57
58 When built as a module it will be called cfg80211.
59
60 +config CFG80211_HEADERS
61 + bool "cfg80211 - headers support"
62 +
63 if CFG80211
64
65 config NL80211_TESTMODE
66 --
67 2.37.2
68