From 3d9cd95e518f05c88e9624dc341fd2d43087db38 Mon Sep 17 00:00:00 2001 From: bings Date: Mon, 23 Dec 2019 17:41:52 +0800 Subject: [PATCH] qcacld-3.0: Fix build error when enable 6g in kernel 4.4 When CONFIG_BAND_6GHZ and CFG80211_6GHZ_BAND_SUPPORTED are defined in kernel 4.4, which means 6g feature is enabled, currently there is a build error: wlan_hdd_iftype_data_alloc_6ghz is defined but not used. To fix this issue, refine iftype_data_*g defination with below rules. 1. If CONFIG_BAND_6GHZ and CFG80211_6GHZ_BAND_SUPPORTED are defined, iftype_data_2g, iftype_data_5g and iftype_data_6g will be defined no matter the kernel version. 2. If the kernel version is not smaller than 4.19, iftype_data_2g and iftype_data_5g will be defined. 3. If the kernel version is not smaller than 5.4 and CONFIG_BAND_6GHZ is defined, iftype_data_6g will be defined. Change-Id: If75bea9fc4c11d6cacd8dbf49455277f055ed8de CRs-Fixed: 2600962 --- core/hdd/inc/wlan_hdd_main.h | 3 ++- core/hdd/src/wlan_hdd_cfg80211.c | 45 +++++++++++++++----------------- core/hdd/src/wlan_hdd_main.c | 4 +-- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 370ad25f4827..ed334b106e7b 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1607,7 +1607,8 @@ struct hdd_context { struct ieee80211_channel *channels_2ghz; struct ieee80211_channel *channels_5ghz; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) +#if (defined(CONFIG_BAND_6GHZ) && defined(CFG80211_6GHZ_BAND_SUPPORTED)) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) struct ieee80211_sband_iftype_data *iftype_data_2g; struct ieee80211_sband_iftype_data *iftype_data_5g; #endif diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 49d5d2510c6c..1842573badd8 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -14998,6 +14998,8 @@ wlan_hdd_populate_srd_chan_info(struct hdd_context *hdd_ctx, uint32_t index) #endif +#if (defined(CONFIG_BAND_6GHZ) && defined(CFG80211_6GHZ_BAND_SUPPORTED)) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) #if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) static QDF_STATUS @@ -15011,15 +15013,26 @@ wlan_hdd_iftype_data_alloc_6ghz(struct hdd_context *hdd_ctx) return QDF_STATUS_SUCCESS; } + +static void +wlan_hdd_iftype_data_mem_free_6ghz(struct hdd_context *hdd_ctx) +{ + qdf_mem_free(hdd_ctx->iftype_data_6g); + hdd_ctx->iftype_data_6g = NULL; +} #else static inline QDF_STATUS wlan_hdd_iftype_data_alloc_6ghz(struct hdd_context *hdd_ctx) { return QDF_STATUS_SUCCESS; } + +static inline void +wlan_hdd_iftype_data_mem_free_6ghz(struct hdd_context *hdd_ctx) +{ +} #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) static QDF_STATUS wlan_hdd_iftype_data_alloc(struct hdd_context *hdd_ctx) { @@ -15051,30 +15064,7 @@ wlan_hdd_iftype_data_alloc(struct hdd_context *hdd_ctx) return QDF_STATUS_SUCCESS; } -#else -static inline QDF_STATUS -wlan_hdd_iftype_data_alloc(struct hdd_context *hdd_ctx) -{ - return QDF_STATUS_SUCCESS; -} -#endif -#if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ - (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) -static void -wlan_hdd_iftype_data_mem_free_6ghz(struct hdd_context *hdd_ctx) -{ - qdf_mem_free(hdd_ctx->iftype_data_6g); - hdd_ctx->iftype_data_6g = NULL; -} -#else -static inline void -wlan_hdd_iftype_data_mem_free_6ghz(struct hdd_context *hdd_ctx) -{ -} -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) static void wlan_hdd_iftype_data_mem_free(struct hdd_context *hdd_ctx) { @@ -15085,6 +15075,13 @@ wlan_hdd_iftype_data_mem_free(struct hdd_context *hdd_ctx) hdd_ctx->iftype_data_2g = NULL; } #else +static QDF_STATUS +wlan_hdd_iftype_data_alloc(struct hdd_context *hdd_ctx) + +{ + return QDF_STATUS_SUCCESS; +} + static inline void wlan_hdd_iftype_data_mem_free(struct hdd_context *hdd_ctx) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 71624553e9c2..4f9bbb754187 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1992,6 +1992,8 @@ static void hdd_extract_fw_version_info(struct hdd_context *hdd_ctx) HDD_FW_VER_REL_ID(hdd_ctx->target_fw_vers_ext); } +#if (defined(CONFIG_BAND_6GHZ) && defined(CFG80211_6GHZ_BAND_SUPPORTED)) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) #if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \ (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)) static void @@ -2032,8 +2034,6 @@ hdd_update_wiphy_he_caps_6ghz(struct hdd_context *hdd_ctx) } #endif -#if defined(WLAN_FEATURE_11AX) && \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) static void hdd_update_wiphy_he_cap(struct hdd_context *hdd_ctx) { tDot11fIEhe_cap he_cap_cfg;