Browse Source

qcacld-3.0: Replace MAX_CHANNEL by NUM_CHANNELS

When 6GHz introduced, the MAX channel numbers
are conditionally defined by macro NUM_CHANNELS based on
6GHz band supported by driver or not.
Change the driver to use the NUM_CHANNELS for channel
list operation.

Change-Id: I866ac1423b97f9ab74740da263d642f2e3b70445
CRs-Fixed: 2531003
Liangwei Dong 5 years ago
parent
commit
2eb654f21c

+ 2 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -10905,8 +10905,8 @@ static int hdd_parse_vendor_acs_chan_config(struct hdd_vendor_chan_info
 	nla_for_each_nested(curr_attr, tb[SET_CHAN_CHAN_LIST], rem)
 		i++;
 
-	if (i > MAX_CHANNEL) {
-		hdd_err("Error: Exceeded max channels: %u", MAX_CHANNEL);
+	if (i > NUM_CHANNELS) {
+		hdd_err("Error: Exceeded max channels: %u", NUM_CHANNELS);
 		return -ENOMEM;
 	}
 

+ 0 - 1
core/hdd/src/wlan_hdd_cfg80211.h

@@ -132,7 +132,6 @@ struct hdd_context;
 
 #define HDD_SET_BIT(__param, __val)    ((__param) |= (1 << (__val)))
 
-#define MAX_CHANNEL (NUM_24GHZ_CHANNELS + NUM_5GHZ_CHANNELS)
 #define MAX_SCAN_SSID 10
 
 #define IS_CHANNEL_VALID(channel) ((channel >= 0 && channel < 15) \

+ 2 - 2
core/hdd/src/wlan_hdd_ioctl.c

@@ -7255,7 +7255,7 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr)
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	uint8_t *param;
 	int j, i, temp_int, ret = 0, num_channels;
-	uint32_t parsed_channels[MAX_CHANNEL];
+	uint32_t parsed_channels[NUM_CHANNELS];
 	bool is_command_repeated = false;
 
 	if (!hdd_ctx) {
@@ -7288,7 +7288,7 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr)
 		return -EINVAL;
 	}
 
-	if (temp_int < 0 || temp_int > MAX_CHANNEL) {
+	if (temp_int < 0 || temp_int > NUM_CHANNELS) {
 		hdd_err("Invalid Number of channel received");
 		return -EINVAL;
 	}

+ 1 - 1
core/hdd/src/wlan_hdd_scan.c

@@ -995,7 +995,7 @@ static int __wlan_hdd_cfg80211_vendor_scan(struct wiphy *wiphy,
 				n_channels += wiphy->bands[band]->n_channels;
 	}
 
-	if (MAX_CHANNEL < n_channels) {
+	if (n_channels > NUM_CHANNELS) {
 		hdd_err("Exceed max number of channels: %d", n_channels);
 		return -EINVAL;
 	}

+ 2 - 4
os_if/tdls/src/wlan_cfg80211_tdls.c

@@ -35,8 +35,6 @@
 #include <wlan_reg_services_api.h>
 #include "wlan_cfg80211_mc_cp_stats.h"
 
-#define MAX_CHANNEL (NUM_24GHZ_CHANNELS + NUM_5GHZ_CHANNELS)
-
 
 #define TDLS_MAX_NO_OF_2_4_CHANNELS 14
 
@@ -335,8 +333,8 @@ tdls_calc_channels_from_staparams(struct tdls_update_peer_params *req_info,
 	for (i = 0; i < num_unique_channels; i++)
 		osif_debug("[%d]: %d,", i, dest_chans[i]);
 
-	if (MAX_CHANNEL < num_unique_channels)
-		num_unique_channels = MAX_CHANNEL;
+	if (num_unique_channels > NUM_CHANNELS)
+		num_unique_channels = NUM_CHANNELS;
 	req_info->supported_channels_len = num_unique_channels;
 	osif_debug("After removing duplcates supported_channels_len: %d",
 		   req_info->supported_channels_len);