|
| 1 | +From fa27d70495e3b4f92c9de43b33aa09813a318495 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Giulio Benetti <giulio.benetti@benettiengineering.com> |
| 3 | +Date: Mon, 18 May 2026 16:44:57 +0200 |
| 4 | +Subject: [PATCH] fix(esp_hosted_ng): Fix build for kernel 7.1 |
| 5 | + |
| 6 | +With commit: |
| 7 | +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=033fe322f5852d5144a85978e880e01b1787fd0d |
| 8 | +many functions esp_cfg80211_*() have argument struct netdevice * subsituted |
| 9 | +with struct wireless_dev *. So let's add separate function headers and |
| 10 | +retrieve struct netdev * from struct wireless_dev * if Linux version >= 7.1. |
| 11 | + |
| 12 | +Upstream: https://github.com/espressif/esp-hosted/pull/736 |
| 13 | +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> |
| 14 | +--- |
| 15 | + esp_hosted_ng/host/esp_cfg80211.c | 50 +++++++++++++++++++++++++++++++ |
| 16 | + 1 file changed, 50 insertions(+) |
| 17 | + |
| 18 | +diff --git a/esp_hosted_ng/host/esp_cfg80211.c b/esp_hosted_ng/host/esp_cfg80211.c |
| 19 | +index c68f7983e6..1009df1fd5 100644 |
| 20 | +--- a/esp_hosted_ng/host/esp_cfg80211.c |
| 21 | ++++ b/esp_hosted_ng/host/esp_cfg80211.c |
| 22 | +@@ -533,22 +533,38 @@ static int esp_cfg80211_set_default_key(struct wiphy *wiphy, |
| 23 | + } |
| 24 | + |
| 25 | + static int esp_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, |
| 26 | ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)) |
| 27 | ++ struct wireless_dev *wdev, INT_LINK_ID u8 key_index) |
| 28 | ++#else |
| 29 | + struct net_device *ndev, INT_LINK_ID u8 key_index) |
| 30 | ++#endif |
| 31 | + { |
| 32 | + return 0; |
| 33 | + } |
| 34 | + |
| 35 | ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)) |
| 36 | ++static int esp_cfg80211_del_key(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 37 | ++#else |
| 38 | + static int esp_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, |
| 39 | ++#endif |
| 40 | + INT_LINK_ID u8 key_index, bool pairwise, |
| 41 | + const u8 *mac_addr) |
| 42 | + { |
| 43 | + return 0; |
| 44 | + } |
| 45 | + |
| 46 | ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)) |
| 47 | ++static int esp_cfg80211_add_key(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 48 | ++ INT_LINK_ID u8 key_index, bool pairwise, |
| 49 | ++ const u8 *mac_addr, struct key_params *params) |
| 50 | ++{ |
| 51 | ++ struct net_device *dev = wdev->netdev; |
| 52 | ++#else |
| 53 | + static int esp_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, |
| 54 | + INT_LINK_ID u8 key_index, bool pairwise, |
| 55 | + const u8 *mac_addr, struct key_params *params) |
| 56 | + { |
| 57 | ++#endif |
| 58 | + struct esp_wifi_device *priv = NULL; |
| 59 | + |
| 60 | + if (!wiphy || !dev || !params) { |
| 61 | +@@ -564,7 +580,11 @@ static int esp_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, |
| 62 | + esp_dbg("\n"); |
| 63 | + |
| 64 | + if (params->key_len == 0) { |
| 65 | ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)) |
| 66 | ++ return esp_cfg80211_del_key(wiphy, wdev, ZERO_LINK_ID key_index, pairwise, mac_addr); |
| 67 | ++#else |
| 68 | + return esp_cfg80211_del_key(wiphy, dev, ZERO_LINK_ID key_index, pairwise, mac_addr); |
| 69 | ++#endif |
| 70 | + } |
| 71 | + return cmd_add_key(priv, key_index, pairwise, mac_addr, params); |
| 72 | + } |
| 73 | +@@ -783,9 +803,16 @@ static int esp_cfg80211_set_tx_power(struct wiphy *wiphy, |
| 74 | + return cmd_set_tx_power(priv, priv->tx_pwr); |
| 75 | + } |
| 76 | + |
| 77 | ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)) |
| 78 | ++static int esp_cfg80211_get_station(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 79 | ++ const u8 *mac, struct station_info *sinfo) |
| 80 | ++{ |
| 81 | ++ struct net_device *ndev = wdev->netdev; |
| 82 | ++#else |
| 83 | + static int esp_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, |
| 84 | + const u8 *mac, struct station_info *sinfo) |
| 85 | + { |
| 86 | ++#endif |
| 87 | + struct esp_wifi_device *priv = NULL; |
| 88 | + |
| 89 | + priv = netdev_priv(ndev); |
| 90 | +@@ -1034,9 +1061,16 @@ static int esp_cfg80211_probe_client(struct wiphy *wiphy, struct net_device *dev |
| 91 | + return 0; |
| 92 | + } |
| 93 | + |
| 94 | ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)) |
| 95 | ++static int esp_cfg80211_del_station(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 96 | ++ struct station_del_parameters *params) |
| 97 | ++{ |
| 98 | ++ struct net_device *dev = wdev->netdev; |
| 99 | ++#else |
| 100 | + static int esp_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, |
| 101 | + struct station_del_parameters *params) |
| 102 | + { |
| 103 | ++#endif |
| 104 | + struct esp_wifi_device *priv = NULL; |
| 105 | + |
| 106 | + if (!wiphy || !dev) { |
| 107 | +@@ -1055,10 +1089,18 @@ static int esp_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, |
| 108 | + return 0; |
| 109 | + } |
| 110 | + |
| 111 | ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)) |
| 112 | ++static int esp_cfg80211_add_station(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 113 | ++ const u8 *mac, |
| 114 | ++ struct station_parameters *params) |
| 115 | ++{ |
| 116 | ++ struct net_device *dev = wdev->netdev; |
| 117 | ++#else |
| 118 | + static int esp_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, |
| 119 | + const u8 *mac, |
| 120 | + struct station_parameters *params) |
| 121 | + { |
| 122 | ++#endif |
| 123 | + struct esp_wifi_device *priv = NULL; |
| 124 | + |
| 125 | + if (!wiphy || !dev) { |
| 126 | +@@ -1078,10 +1120,18 @@ static int esp_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev, |
| 127 | + return 0; |
| 128 | + } |
| 129 | + |
| 130 | ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(7, 1, 0)) |
| 131 | ++static int esp_cfg80211_change_station(struct wiphy *wiphy, |
| 132 | ++ struct wireless_dev *wdev, const u8 *mac, |
| 133 | ++ struct station_parameters *params) |
| 134 | ++{ |
| 135 | ++ struct net_device *dev = wdev->netdev; |
| 136 | ++#else |
| 137 | + static int esp_cfg80211_change_station(struct wiphy *wiphy, |
| 138 | + struct net_device *dev, const u8 *mac, |
| 139 | + struct station_parameters *params) |
| 140 | + { |
| 141 | ++#endif |
| 142 | + struct esp_wifi_device *priv = NULL; |
| 143 | + |
| 144 | + if (!wiphy || !dev) { |
| 145 | +-- |
| 146 | +2.47.3 |
| 147 | + |
0 commit comments