From bedbef8ad3e75a304af6361af235302bcc61d06b Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Tue, 14 May 2024 06:39:01 +0000
Subject: [PATCH] 修改内核路径

---
 kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c |  290 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 146 insertions(+), 144 deletions(-)

diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c
old mode 100644
new mode 100755
index 6005a44..4b884df
--- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c
+++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_android_ext.c
@@ -1,5 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <net/netlink.h>
@@ -32,8 +31,6 @@
 #ifdef WL_ESCAN
 #include <wl_escan.h>
 #endif /* WL_ESCAN */
-
-uint android_msg_level = ANDROID_ERROR_LEVEL | ANDROID_MSG_LEVEL;
 
 #define AEXT_ERROR(name, arg1, args...) \
 	do { \
@@ -83,9 +80,6 @@
 #define CMD_ROAM_TRIGGER		"ROAM_TRIGGER"
 #define CMD_PM					"PM"
 #define CMD_MONITOR				"MONITOR"
-#ifdef BTC_WAR
-#define CMD_BTC_WAR			"BTC_WAR"
-#endif /* BTC_WAR */
 #define CMD_SET_SUSPEND_BCN_LI_DTIM		"SET_SUSPEND_BCN_LI_DTIM"
 #define CMD_WLMSGLEVEL			"WLMSGLEVEL"
 #ifdef WL_EXT_IAPSTA
@@ -323,9 +317,9 @@
 }
 
 chanspec_t
-wl_ext_chspec_host_to_driver(struct dhd_pub *dhd, chanspec_t chanspec)
+wl_ext_chspec_host_to_driver(int ioctl_ver, chanspec_t chanspec)
 {
-	if (dhd->conf->ioctl_ver == 1) {
+	if (ioctl_ver == 1) {
 		chanspec = wl_ext_chspec_to_legacy(chanspec);
 		if (chanspec == INVCHANSPEC) {
 			return chanspec;
@@ -337,7 +331,7 @@
 }
 
 static void
-wl_ext_ch_to_chanspec(struct dhd_pub *dhd, int ch,
+wl_ext_ch_to_chanspec(int ioctl_ver, int ch,
 	struct wl_join_params *join_params, size_t *join_params_size)
 {
 	chanspec_t chanspec = 0;
@@ -360,7 +354,7 @@
 		join_params->params.chanspec_list[0]  &= WL_CHANSPEC_CHAN_MASK;
 		join_params->params.chanspec_list[0] |= chanspec;
 		join_params->params.chanspec_list[0] =
-			wl_ext_chspec_host_to_driver(dhd,
+			wl_ext_chspec_host_to_driver(ioctl_ver,
 				join_params->params.chanspec_list[0]);
 
 		join_params->params.chanspec_num =
@@ -405,10 +399,10 @@
 }
 
 chanspec_t
-wl_ext_chspec_driver_to_host(struct dhd_pub *dhd, chanspec_t chanspec)
+wl_ext_chspec_driver_to_host(int ioctl_ver, chanspec_t chanspec)
 {
 	chanspec = dtohchanspec(chanspec);
-	if (dhd->conf->ioctl_ver == 1) {
+	if (ioctl_ver == 1) {
 		chanspec = wl_ext_chspec_from_legacy(chanspec);
 	}
 
@@ -419,7 +413,7 @@
 chanspec_band_t
 wl_ext_wlcband_to_chanspec_band(int band)
 {
-	chanspec_band_t chanspec_band = INVCHANSPEC;
+	chanspec_band_t chanspec_band = WLC_BAND_INVALID;
 
 	switch (band) {
 #ifdef WL_6G_BAND
@@ -434,7 +428,6 @@
 			chanspec_band = WL_CHANSPEC_BAND_2G;
 			break;
 		default:
-			AEXT_ERROR("wlan", "Invalid Frequency Band\n");
 			break;
 	}
 	return chanspec_band;
@@ -556,6 +549,28 @@
 	}
 }
 
+int
+wl_ext_get_ioctl_ver(struct net_device *dev, int *ioctl_ver)
+{
+	int ret = 0;
+	s32 val = 0;
+
+	val = 1;
+	ret = wl_ext_ioctl(dev, WLC_GET_VERSION, &val, sizeof(val), 0);
+	if (ret) {
+		return ret;
+	}
+	val = dtoh32(val);
+	if (val != WLC_IOCTL_VERSION && val != 1) {
+		AEXT_ERROR(dev->name, "Version mismatch, please upgrade. Got %d, expected %d or 1\n",
+			val, WLC_IOCTL_VERSION);
+		return BCME_VERSION;
+	}
+	*ioctl_ver = val;
+
+	return ret;
+}
+
 void
 wl_ext_bss_iovar_war(struct net_device *ndev, s32 *val)
 {
@@ -596,7 +611,6 @@
 wl_ext_set_chanspec(struct net_device *dev, struct wl_chan_info *chan_info,
 	chanspec_t *ret_chspec)
 {
-	struct dhd_pub *dhd = dhd_get_pub(dev);
 	s32 _chan = chan_info->chan;
 	chanspec_t chspec = 0;
 	chanspec_t fw_chspec = 0;
@@ -609,6 +623,7 @@
 		u32 bw_cap;
 	} param = {0, 0};
 	chanspec_band_t chanspec_band = 0;
+	int ioctl_ver;
 
 	if ((chan_info->band != WLC_BAND_2G) && (chan_info->band != WLC_BAND_5G) &&
 			(chan_info->band != WLC_BAND_6G)) {
@@ -641,7 +656,8 @@
 	chanspec_band = wl_ext_wlcband_to_chanspec_band(chan_info->band);
 	chspec = wf_create_chspec_from_primary(chan_info->chan, bw, chanspec_band);
 	if (wf_chspec_valid(chspec)) {
-		fw_chspec = wl_ext_chspec_host_to_driver(dhd, chspec);
+		wl_ext_get_ioctl_ver(dev, &ioctl_ver);
+		fw_chspec = wl_ext_chspec_host_to_driver(ioctl_ver, chspec);
 		if (fw_chspec != INVCHANSPEC) {
 			if ((err = wl_ext_iovar_setint(dev, "chanspec", fw_chspec)) == BCME_BADCHAN) {
 				if (bw == WL_CHANSPEC_BW_80)
@@ -651,11 +667,8 @@
 			} else if (err) {
 				AEXT_ERROR(dev->name, "failed to set chanspec error %d\n", err);
 			} else
-				WL_MSG(dev->name, "channel %s-%d(0x%x %sMHz)\n",
-					CHSPEC2BANDSTR(chspec), chan_info->chan, chspec,
-					CHSPEC_IS20(chspec)?"20":
-					CHSPEC_IS40(chspec)?"40":
-					CHSPEC_IS80(chspec)?"80":"160");
+				WL_MSG(dev->name, "channel %s-%d(0x%x)\n",
+					CHSPEC2BANDSTR(chspec), chan_info->chan, chspec);
 		} else {
 			AEXT_ERROR(dev->name, "failed to convert host chanspec to fw chanspec\n");
 			err = BCME_ERROR;
@@ -706,10 +719,6 @@
 	else if (strnicmp(band, "band=2g", strlen("band=2g")) == 0) {
 		chan_info.band = WLC_BAND_2G;
 	}
-	else if (channel <= CH_MAX_2G_CHANNEL)
-		chan_info.band = WLC_BAND_2G;
-	else
-		chan_info.band = WLC_BAND_5G;
 
 	if (channel > 0) {
 		chan_info.chan = channel;
@@ -854,30 +863,6 @@
 	return ret;
 }
 
-#ifdef BTC_WAR
-extern int btc_war;
-static int
-wl_ext_btc_war(struct net_device *dev, char *command, int total_len)
-{
-	int user_btc_war = 0;
-	bool enable = FALSE;
-
-	sscanf(command, "%*s %d", &user_btc_war);
-
-	AEXT_TRACE(dev->name, "btc_war=%d, user_btc_war=%d\n",
-		btc_war, user_btc_war);
-
-	if (btc_war >= 0) {
-		btc_war = user_btc_war;
-		if (btc_war > 0)
-			enable = TRUE;
-		wl_ext_btc_config(dev, enable);
-	}
-
-	return 0;
-}
-#endif /* BTC_WAR */
-
 s32
 wl_ext_connect(struct net_device *dev, struct wl_conn_info *conn_info)
 {
@@ -888,7 +873,10 @@
 	s32 err = 0;
 	u32 chan_cnt = 0;
 	s8 *iovar_buf = NULL;
+	int ioctl_ver = 0;
 	char sec[64];
+
+	wl_ext_get_ioctl_ver(dev, &ioctl_ver);
 
 	if (dhd->conf->chip == BCM43362_CHIP_ID)
 		goto set_ssid;
@@ -945,7 +933,7 @@
 		ext_join_params->assoc.chanspec_list[0]  &= WL_CHANSPEC_CHAN_MASK;
 		ext_join_params->assoc.chanspec_list[0] |= chspec;
 		ext_join_params->assoc.chanspec_list[0] =
-			wl_ext_chspec_host_to_driver(dhd,
+			wl_ext_chspec_host_to_driver(ioctl_ver,
 				ext_join_params->assoc.chanspec_list[0]);
 	}
 	ext_join_params->assoc.chanspec_num = htod32(ext_join_params->assoc.chanspec_num);
@@ -982,7 +970,7 @@
 	else
 		memcpy(&join_params.params.bssid, &ether_bcast, ETH_ALEN);
 
-	wl_ext_ch_to_chanspec(dhd, conn_info->channel, &join_params, &join_params_size);
+	wl_ext_ch_to_chanspec(ioctl_ver, conn_info->channel, &join_params, &join_params_size);
 	AEXT_TRACE(dev->name, "join_param_size %zu\n", join_params_size);
 
 	if (join_params.ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
@@ -1099,30 +1087,6 @@
 	return FALSE;
 }
 
-bool
-wl_ext_passive_chan(struct net_device *dev, struct wl_chan_info *chan_info)
-{
-	struct dhd_pub *dhd = dhd_get_pub(dev);
-	u32 chanspec;
-	s32 ret = BCME_OK;
-
-	chanspec = wf_create_chspec_from_primary(chan_info->chan,
-		WL_CHANSPEC_BW_20, wl_ext_wlcband_to_chanspec_band(chan_info->band));
-
-	chanspec = wl_ext_chspec_host_to_driver(dhd, chanspec);
-
-	ret = wldev_iovar_getint(dev, "per_chan_info", &chanspec);
-	if (!ret) {
-		if (chanspec & WL_CHAN_PASSIVE)
-			return TRUE;
-	} else {
-		if (chan_info->band == WLC_BAND_5G && chan_info->chan >= 52 && chan_info->chan <= 144)
-			return TRUE;
-	}
-
-	return FALSE;
-}
-
 uint16
 wl_ext_get_default_chan(struct net_device *dev,
 	uint16 *chan_2g, uint16 *chan_5g, bool nodfs)
@@ -1153,8 +1117,6 @@
 				chan_info.band = WLC_BAND_5G;
 				chan_info.chan = chan_tmp;
 				if (wl_ext_dfs_chan(&chan_info) && nodfs)
-					continue;
-				else if (wl_ext_passive_chan(dev, &chan_info))
 					continue;
 				else
 					*chan_5g = chan_tmp;
@@ -1235,6 +1197,69 @@
 
 	return ret;
 }
+
+#ifdef WL_CFG80211
+bool
+wl_legacy_chip_check(struct net_device *net)
+{
+	struct dhd_pub *dhd = dhd_get_pub(net);
+	uint chip;
+
+	chip = dhd_conf_get_chip(dhd);
+
+	if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID ||
+		chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID ||
+		chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID ||
+		chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID ||
+		chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID ||
+		chip == BCM4371_CHIP_ID ||
+		chip == BCM43430_CHIP_ID ||
+		chip == BCM4345_CHIP_ID || chip == BCM43454_CHIP_ID ||
+		chip == BCM4359_CHIP_ID ||
+		chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID ||
+		chip == BCM43569_CHIP_ID) {
+		return true;
+	}
+
+	return false;
+}
+
+bool
+wl_new_chip_check(struct net_device *net)
+{
+	struct dhd_pub *dhd = dhd_get_pub(net);
+	uint chip;
+
+	chip = dhd_conf_get_chip(dhd);
+
+	if (chip == BCM4359_CHIP_ID || chip == BCM43012_CHIP_ID ||
+			chip == BCM43751_CHIP_ID || chip == BCM43752_CHIP_ID) {
+		return true;
+	}
+
+	return false;
+}
+
+bool
+wl_extsae_chip(struct dhd_pub *dhd)
+{
+	uint chip;
+
+	chip = dhd_conf_get_chip(dhd);
+
+	if (chip == BCM43362_CHIP_ID || chip == BCM4330_CHIP_ID ||
+		chip == BCM4334_CHIP_ID || chip == BCM43340_CHIP_ID ||
+		chip == BCM43341_CHIP_ID || chip == BCM4324_CHIP_ID ||
+		chip == BCM4335_CHIP_ID || chip == BCM4339_CHIP_ID ||
+		chip == BCM4354_CHIP_ID || chip == BCM4356_CHIP_ID ||
+		chip == BCM43143_CHIP_ID || chip == BCM43242_CHIP_ID ||
+		chip == BCM43569_CHIP_ID) {
+		return false;
+	}
+
+	return true;
+}
+#endif
 
 #ifdef WLEASYMESH
 #define CMD_EASYMESH "EASYMESH"
@@ -1450,7 +1475,7 @@
 	int total_len)
 {
 	struct dhd_pub *dhd = dhd_get_pub(dev);
-	wl_mkeep_alive_pkt_v1_t *mkeep_alive_pktp;
+	wl_mkeep_alive_pkt_t *mkeep_alive_pktp;
 	int ret = -1, i, ifidx, id, period=-1;
 	char *packet = NULL, *buf = NULL;
 	int bytes_written = 0;
@@ -1478,7 +1503,7 @@
 			ret = wl_ext_iovar_getbuf(dev, "mkeep_alive", &id, sizeof(id), buf,
 				total_len, NULL);
 			if (!ret) {
-				mkeep_alive_pktp = (wl_mkeep_alive_pkt_v1_t *) buf;
+				mkeep_alive_pktp = (wl_mkeep_alive_pkt_t *) buf;
 				bytes_written += snprintf(command+bytes_written, total_len,
 					"Id            :%d\n"
 					"Period (msec) :%d\n"
@@ -1686,22 +1711,24 @@
 wl_ext_recal(struct net_device *dev, char *data, char *command,
 	int total_len)
 {
-	struct dhd_pub *dhd = dhd_get_pub(dev);
 	int ret = 0, i, nchan, nssid = 0;
-	int params_size = WL_SCAN_PARAMS_V1_FIXED_SIZE + WL_NUMCHANNELS * sizeof(uint16);
-	wl_scan_params_v1_t *params = NULL;
+	int params_size = WL_SCAN_PARAMS_FIXED_SIZE + WL_NUMCHANNELS * sizeof(uint16);
+	wl_scan_params_t *params = NULL;
+	int ioctl_ver;
 	char *p;
 
 	AEXT_TRACE(dev->name, "Enter\n");
 
 	if (data) {
 		params_size += WL_SCAN_PARAMS_SSID_MAX * sizeof(wlc_ssid_t);
-		params = (wl_scan_params_v1_t *) kzalloc(params_size, GFP_KERNEL);
+		params = (wl_scan_params_t *) kzalloc(params_size, GFP_KERNEL);
 		if (params == NULL) {
 			ret = -ENOMEM;
 			goto exit;
 		}
 		memset(params, 0, params_size);
+
+		wl_ext_get_ioctl_ver(dev, &ioctl_ver);
 
 		memcpy(&params->bssid, &ether_bcast, ETHER_ADDR_LEN);
 		params->bss_type = DOT11_BSSTYPE_ANY;
@@ -1723,7 +1750,7 @@
 		params->home_time = htod32(params->home_time);
 
 		for (i = 0; i < nchan; i++) {
-			wl_ext_chspec_host_to_driver(dhd, params->channel_list[i]);
+			wl_ext_chspec_host_to_driver(ioctl_ver, params->channel_list[i]);
 		}
 
 		p = (char*)params->channel_list + nchan * sizeof(uint16);
@@ -2500,6 +2527,22 @@
 } csi_list_t;
 
 static int
+wl_ether_atoe(const char *a, struct ether_addr *n)
+{
+	char *c = NULL;
+	int i = 0;
+
+	memset(n, 0, ETHER_ADDR_LEN);
+	for (;;) {
+		n->octet[i++] = (uint8)strtoul(a, &c, 16);
+		if (!*c++ || i == ETHER_ADDR_LEN)
+			break;
+		a = c;
+	}
+	return (i == ETHER_ADDR_LEN);
+}
+
+static int
 wl_ext_csi(struct net_device *dev, char *data, char *command, int total_len)
 {
 	csi_config_t csi, *csip;
@@ -2518,7 +2561,7 @@
 
 	if (data) {
 		sscanf(data, "%s %d", mac, &period);
-		ret = bcm_ether_atoe(mac, &ea);
+		ret = wl_ether_atoe(mac, &ea);
 		if (!ret) {
 			AEXT_ERROR(dev->name, "rejecting mac=%s, ret=%d\n", mac, ret);
 			goto exit;
@@ -2616,34 +2659,6 @@
 	return bytes_written;
 }
 
-static int
-wl_ext_disable_5g_band(struct net_device *dev, char *data, char *command,
-	int total_len)
-{
-#ifdef WL_CFG80211
-	struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
-#endif
-	int ret = -1;
-	int val;
-
-	if (data) {
-		val = (int)simple_strtol(data, NULL, 0);
-		ret = wl_ext_iovar_setint(dev, "disable_5g_band", val);
-#ifdef WL_CFG80211
-		if (!ret)
-			wl_update_wiphybands(cfg, true);
-#endif
-	} else {
-		ret = wl_ext_iovar_getint(dev, "disable_5g_band", &val);
-		if (!ret) {
-			ret = snprintf(command, total_len, "%d", val);
-			AEXT_TRACE(dev->name, "command result is %s\n", command);
-		}
-	}
-
-	return ret;
-}
-
 typedef int (wl_ext_tpl_parse_t)(struct net_device *dev, char *data, char *command,
 	int total_len);
 
@@ -2696,7 +2711,6 @@
 	{WLC_GET_VAR,	WLC_SET_VAR,	"csi",				wl_ext_csi},
 #endif /* CSI_SUPPORT */
 	{WLC_GET_VAR,	WLC_SET_VAR,	"country",			wl_ext_get_country},
-	{WLC_GET_VAR,	WLC_SET_VAR,	"disable_5g_band",	wl_ext_disable_5g_band},
 };
 
 /*
@@ -2838,11 +2852,6 @@
 	else if (strnicmp(command, CMD_MONITOR, strlen(CMD_MONITOR)) == 0) {
 		*bytes_written = wl_ext_monitor(net, command, total_len);
 	}
-#ifdef BTC_WAR
-	else if (strnicmp(command, CMD_BTC_WAR, strlen(CMD_BTC_WAR)) == 0) {
-		*bytes_written = wl_ext_btc_war(net, command, total_len);
-	}
-#endif /* BTC_WAR */
 	else if (strnicmp(command, CMD_SET_SUSPEND_BCN_LI_DTIM, strlen(CMD_SET_SUSPEND_BCN_LI_DTIM)) == 0) {
 		int bcn_li_dtim;
 		bcn_li_dtim = (int)simple_strtol((command + strlen(CMD_SET_SUSPEND_BCN_LI_DTIM) + 1), NULL, 10);
@@ -2936,7 +2945,7 @@
 		return -ENOMEM;
 	}
 
-	err = wldev_iovar_getbuf(dev, "chan_info_list", NULL,
+	err = wl_ext_iovar_getbuf(dev, "chan_info_list", NULL,
 		0, list, LOCAL_BUF_LEN, NULL);
 	if (err == BCME_UNSUPPORTED) {
 		err = wl_ext_iovar_getbuf(dev, "chanspecs", NULL,
@@ -3049,13 +3058,11 @@
 #if defined(BSSCACHE)
 	wl_bss_cache_ctrl_t *bss_cache_ctrl,
 #else
-	wl_scan_results_v109_t *bss_list,
+	wl_scan_results_t *bss_list,
 #endif /* BSSCACHE */
-	int *best_2g_ch, int *best_5g_ch, int *best_6g_ch)
+	int ioctl_ver, int *best_2g_ch, int *best_5g_ch, int *best_6g_ch)
 {
-	struct dhd_pub *dhd = dhd_get_pub(net);
 	struct wl_bss_info *bi = NULL;	/* must be initialized */
-	struct wl_chan_info chan_info;
 	s32 i, j;
 #if defined(BSSCACHE)
 	wl_bss_cache_t *node;
@@ -3093,18 +3100,13 @@
 		for (i = 0; i < list->count; i++) {
 			chspec = list->element[i];
 			channel = wf_chspec_ctlchan(chspec);
-			chan_info.band = CHSPEC2WLC_BAND(chspec);
-			chan_info.chan = channel;
-			if (wl_ext_passive_chan(net, &chan_info)) {
-				continue;
-			}
 			if (CHSPEC_IS2G(chspec) && (channel >= CH_MIN_2G_CHANNEL) &&
-					(channel <= CH_MAX_2G_CHANNEL)) {
+				(channel <= CH_MAX_2G_CHANNEL)) {
 				b_band[channel-1] = 0;
 			}
 #ifdef WL_6G_BAND
 			else if (CHSPEC_IS6G(chspec) && (channel >= CH_MIN_6G_CHANNEL) &&
-					(channel <= CH_MAX_6G_CHANNEL)) {
+				(channel <= CH_MAX_6G_CHANNEL)) {
 				if (channel <= 93)
 					six_g_band5[(channel-1)/4] = 0;
 				else if (channel >= 97 && channel <= 109)
@@ -3140,9 +3142,9 @@
 #if defined(BSSCACHE)
 		bi = node->results.bss_info;
 #else
-		bi = bi ? (wl_bss_info_v109_t *)((uintptr)bi + dtoh32(bi->length)) : bss_list->bss_info;
+		bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : bss_list->bss_info;
 #endif /* BSSCACHE */
-		chanspec = wl_ext_chspec_driver_to_host(dhd, bi->chanspec);
+		chanspec = wl_ext_chspec_driver_to_host(ioctl_ver, bi->chanspec);
 		cen_ch = CHSPEC_CHANNEL(bi->chanspec);
 		distance = 0;
 		if (CHSPEC_IS20(chanspec))
@@ -3165,25 +3167,25 @@
 		else if (CHSPEC_IS6G(chanspec)) {
 			distance += distance_6g;
 			if (cen_ch <= 93) {
-				for (j=0; j<ARRAYSIZE(six_g_band5); j++) {
+				for (j=0; j<ARRAYSIZE(a_band1); j++) {
 					if (six_g_band5[j] >= 0 && abs(cen_ch-(93+j*4)) <= distance)
 						six_g_band5[j] += 1;
 				}
 			}
 			else if (channel >= 97 && channel <= 109) {
-				for (j=0; j<ARRAYSIZE(six_g_band6); j++) {
+				for (j=0; j<ARRAYSIZE(a_band4); j++) {
 					if (six_g_band6[j] >= 0 && abs(cen_ch-(97+j*4)) <= distance)
 						six_g_band6[j] += 1;
 				}
 			}
 			else if (channel >= 117 && channel <= 181) {
-				for (j=0; j<ARRAYSIZE(six_g_band7); j++) {
+				for (j=0; j<ARRAYSIZE(a_band4); j++) {
 					if (six_g_band7[j] >= 0 && abs(cen_ch-(117+j*4)) <= distance)
 						six_g_band7[j] += 1;
 				}
 			}
 			else if (channel >= 189 && channel <= 221) {
-				for (j=0; j<ARRAYSIZE(six_g_band8); j++) {
+				for (j=0; j<ARRAYSIZE(a_band4); j++) {
 					if (six_g_band8[j] >= 0 && abs(cen_ch-(189+j*4)) <= distance)
 						six_g_band8[j] += 1;
 				}
@@ -3349,7 +3351,7 @@
 	memset(reqbuf, 0, CHANSPEC_BUF_SIZE);
 
 	acs_band = wl_ext_wlcband_to_chanspec_band(band);
-	if (acs_band == INVCHANSPEC) {
+	if ((uint32)acs_band == WLC_BAND_INVALID) {
 		acs_band = WL_CHANSPEC_BAND_2G;
 	}
 
@@ -3755,10 +3757,10 @@
 
 void
 wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl,
-	wl_scan_results_v109_t *ss_list)
+	wl_scan_results_t *ss_list)
 {
 	wl_rssi_cache_t *node, *prev, *leaf, **rssi_head;
-	wl_bss_info_v109_t *bi = NULL;
+	wl_bss_info_t *bi = NULL;
 	int i, j, k;
 	struct osl_timespec now, timeout;
 
@@ -3784,7 +3786,7 @@
 		node = *rssi_head;
 		prev = NULL;
 		k = 0;
-		bi = bi ? (wl_bss_info_v109_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info;
+		bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info;
 		for (;node;) {
 			if (!memcmp(&node->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) {
 				AEXT_INFO("wlan", "Update %d with BSSID %pM, RSSI=%3d, SSID \"%s\"\n",
@@ -4110,11 +4112,11 @@
 #if defined(RSSIAVG)
 	wl_rssi_cache_ctrl_t *rssi_cache_ctrl,
 #endif /* RSSIAVG */
-	wl_scan_results_v109_t *ss_list)
+	wl_scan_results_t *ss_list)
 {
 	wl_bss_cache_t *node, *node_target = NULL, *prev, *leaf, **bss_head;
 	wl_bss_cache_t *node_rssi_prev = NULL, *node_rssi = NULL;
-	wl_bss_info_v109_t *bi = NULL;
+	wl_bss_info_t *bi = NULL;
 	int i, k=0, bss_num = 0;
 	struct osl_timespec now, timeout;
 	int16 rssi_min;
@@ -4149,7 +4151,7 @@
 		prev = NULL;
 		node_target = NULL;
 		node_rssi_prev = NULL;
-		bi = bi ? (wl_bss_info_v109_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info;
+		bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info;
 
 		// find the bss with same BSSID
 		for (;node;) {

--
Gitblit v1.6.2