From bcbbab1f66de61980edf46faee3d989a65c8b45a Mon Sep 17 00:00:00 2001 From: Sherry Sun Date: Wed, 19 Jul 2023 10:40:53 +0800 Subject: [PATCH] mxm_wifiex: fix L6.5 kernel build errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When build wifi driver based on L6.5 kernel, will observe the following build errors. /mwifiex/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c:355:22: error: initialization of ‘int (*)(struct wiphy *, struct net_device *, const u8 *, int, u8, u8, u16, u32, bool, const u8 *, size_t)’ {aka ‘int (*)(struct wiphy *, struct net_device *, const unsigned char *, int, unsigned char, unsigned char, short unsigned int, unsigned int, _Bool, const unsigned char *, long unsigned int)’} from incompatible pointer type ‘int (*)(struct wiphy *, struct net_device *, const u8 *, u8, u8, u16, u32, bool, const u8 *, size_t)’ {aka ‘int (*)(struct wiphy *, struct net_device *, const unsigned char *, unsigned char, unsigned char, short unsigned int, unsigned int, _Bool, const unsigned char *, long unsigned int)’} [-Werror=incompatible-pointer-types] 355 | .tdls_mgmt = woal_cfg80211_tdls_mgmt, | ^~~~~~~~~~~~~~~~~~~~~~~ /mwifiex/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c:355:22: note: (near initialization for ‘woal_cfg80211_ops.tdls_mgmt’) /mwifiex/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c: In function ‘woal_register_cfg80211’: /mwifiex/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c:10173:36: error: ‘REGULATORY_IGNORE_STALE_KICKOFF’ undeclared (first use in this function) 10173 | wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /mwifiex/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c:10173:36: note: each undeclared identifier is reported only once for each function it appears in cc1: some warnings being treated as errors make[3]: *** [scripts/Makefile.build:243: /mwifiex/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.o] Error 1 These errors caused by kernel patch c6112046b1a9("wifi: cfg80211: make TDLS management link-aware"), now tdls_mgmt() callback adds one link_id function parameter. And kernel patch e8c2af660ba0("wifi: cfg80211: fix regulatory disconnect with OCB/NAN") remove the REGULATORY_IGNORE_STALE_KICKOFF flag. Signed-off-by: Sherry Sun --- .../wlan_src/mlinux/moal_sta_cfg80211.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c index 1533a7f..fa91645 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c @@ -210,6 +210,9 @@ int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, const u8 *peer, #else u8 *peer, +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 5, 0) + int link_id, #endif u8 action_code, u8 dialog_token, u16 status_code, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) @@ -7335,6 +7338,11 @@ void woal_check_auto_tdls(struct wiphy *wiphy, struct net_device *dev) } if (tdls_discovery) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 5, 0) + woal_cfg80211_tdls_mgmt(wiphy, dev, bcast_addr, + 0, TDLS_DISCOVERY_REQUEST, 1, 0, 0, 0, + NULL, 0); +#else #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) woal_cfg80211_tdls_mgmt(wiphy, dev, bcast_addr, TDLS_DISCOVERY_REQUEST, 1, 0, 0, 0, @@ -7344,6 +7352,7 @@ void woal_check_auto_tdls(struct wiphy *wiphy, struct net_device *dev) TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); #endif +#endif #else woal_cfg80211_tdls_mgmt(wiphy, dev, bcast_addr, TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); @@ -8074,7 +8083,6 @@ fail: return ret; } -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) /** * @brief Tx TDLS packet * @@ -8091,6 +8099,14 @@ fail: * * @return 0 -- success, otherwise fail */ +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 5, 0) +int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, + const t_u8 *peer, int link_id, u8 action_code, + t_u8 dialog_token, t_u16 status_code, + t_u32 peer_capability, bool initiator, + const t_u8 *extra_ies, size_t extra_ies_len) +#else +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, const t_u8 *peer, u8 action_code, t_u8 dialog_token, t_u16 status_code, t_u32 peer_capability, @@ -8143,6 +8159,7 @@ int woal_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, size_t extra_ies_len) #endif #endif +#endif { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int ret = 0; @@ -10164,7 +10181,7 @@ mlan_status woal_register_cfg80211(moal_private *priv) PRINTM(MIOCTL, "Follow countryIE provided by AP.\n"); } #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) && CFG80211_VERSION_CODE < KERNEL_VERSION(6, 5, 0) /*REGULATORY_IGNORE_STALE_KICKOFF: the regulatory core will _not_ make * sure all interfaces on this wiphy reside on allowed channels. If this * flag is not set, upon a regdomain change, the interfaces are given a