Skip to contentSkip to conversation

staging: rtl8723bs: remove unused 'ratelen' parameter from rtw_check_network_type()

PATCH Superseded Nikolay Kulikov 2 participants 7 messages Feb 26 – Mar 1 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: remove unused 'ratelen' parameter from rtw_check_network_type()

The rtw_check_network_type() function takes a 'ratelen' parameter, but does not use it in any way. Also remove the local variable in rtw_ap.c created just to pass a value to this unused parameter.

---
 drivers/staging/rtl8723bs/core/rtw_ap.c        | 5 +----
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c  | 2 +-
 drivers/staging/rtl8723bs/include/ieee80211.h  | 2 +-
 4 files changed, 4 insertions(+), 7 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -4
index 3e62fc8f61cf..8be29bbebd41 100644
@@ -367,7 +367,6 @@ void add_ratid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
 void update_bmc_sta(struct adapter *padapter)
 {
 	unsigned char network_type;
-	int support_rate_num = 0;
 	unsigned int tx_ra_bitmap = 0;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -391,9 +390,7 @@ void update_bmc_sta(struct adapter *padapter)
 		memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats));
 
 		/* prepare for add_ratid */
-		support_rate_num = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
 		network_type = rtw_check_network_type((u8 *)&pcur_network->supported_rates,
-						      support_rate_num,
 						      pcur_network->configuration.ds_config
 		);
 		if (is_supported_tx_cck(network_type)) {
@@ -890,7 +887,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 		support_rate_num += ie_len;
 	}
 
-	network_type = rtw_check_network_type(support_rate, support_rate_num, channel);
+	network_type = rtw_check_network_type(support_rate, channel);
 
 	rtw_set_supported_rate(pbss_network->supported_rates, network_type);
 
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +1 -1
index dbd4bcc8cd28..a657c963ff52 100644
@@ -94,7 +94,7 @@ bool rtw_is_cckratesonly_included(u8 *rate)
 	return true;
 }
 
-int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
+int rtw_check_network_type(unsigned char *rate, int channel)
 {
 	if (channel > 14)
 		return WIRELESS_INVALID;
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1 -1
index a631fe323157..38c673e31313 100644
@@ -4886,7 +4886,7 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p
 	rtw_hal_update_sta_rate_mask(padapter, psta);
 
 	/*  ToDo: HT for Ad-hoc */
-	psta->wireless_mode = rtw_check_network_type(psta->bssrateset, psta->bssratelen, pmlmeext->cur_channel);
+	psta->wireless_mode = rtw_check_network_type(psta->bssrateset, pmlmeext->cur_channel);
 	psta->raid = networktype_to_raid_ex(padapter, psta);
 
 	/* rate radaptive */
drivers/staging/rtl8723bs/include/ieee80211.h +1 -1
index 97fd5f75096b..8ec14e8d4c89 100644
@@ -778,7 +778,7 @@ bool rtw_is_cckrates_included(u8 *rate);
 
 bool rtw_is_cckratesonly_included(u8 *rate);
 
-int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
+int rtw_check_network_type(unsigned char *rate, int channel);
 
 void rtw_get_bcn_info(struct wlan_network *pnetwork);
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 6 lines · Nikolay Kulikov

The rtw_check_network_type() function takes a 'ratelen' parameter, but does not use it in any way. Also remove the local variable in rtw_ap.c created just to pass a value to this unused parameter.

---

...

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · line 890

Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
@@ -890,7 +887,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 		support_rate_num += ie_len;
 	}
 
-	network_type = rtw_check_network_type(support_rate, support_rate_num, channel);
+	network_type = rtw_check_network_type(support_rate, channel);

I think you can delete support_rate_num in this function too.

Thanks,

ET

#2 lore raw
Quoted 11 lines · Ethan Tidmore
Quoted 6 lines · Nikolay Kulikov

The rtw_check_network_type() function takes a 'ratelen' parameter, but does not use it in any way. Also remove the local variable in rtw_ap.c created just to pass a value to this unused parameter.

---

...

Quoted 8 lines

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · line 890

Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
@@ -890,7 +887,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 		support_rate_num += ie_len;
 	}
 
-	network_type = rtw_check_network_type(support_rate, support_rate_num, channel);
+	network_type = rtw_check_network_type(support_rate, channel);

I think you can delete support_rate_num in this function too.

Is it possible to remove it completely? It's used as a temporary buffer for 'ie_len', so perhaps just the last line that increments 'support_rate_num' can be removed:

Quoted 1 line

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · line 887

Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
 		support_rate_num += ie_len;

since this value is not used anywhere below.

Thanks,

Nikolay

#3 lore raw
Quoted 21 lines · Nikolay Kulikov
Quoted 11 lines · Ethan Tidmore
Quoted 6 lines · Nikolay Kulikov

The rtw_check_network_type() function takes a 'ratelen' parameter, but does not use it in any way. Also remove the local variable in rtw_ap.c created just to pass a value to this unused parameter.

---

...

Quoted 8 lines

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · line 890

Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
@@ -890,7 +887,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 		support_rate_num += ie_len;
 	}
 
-	network_type = rtw_check_network_type(support_rate, support_rate_num, channel);
+	network_type = rtw_check_network_type(support_rate, channel);

I think you can delete support_rate_num in this function too.

Quoted 7 lines

Is it possible to remove it completely? It's used as a temporary buffer for 'ie_len', so perhaps just the last line that increments 'support_rate_num' can be removed:

Quoted 1 line

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · line 887

Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
 		support_rate_num += ie_len;

since this value is not used anywhere below.

You are right, we can remove support_rate_num entirely, but removing this would be nice.

Thanks,

ET

#4 lore raw
Quoted 26 lines · Ethan Tidmore
Quoted 25 lines · Nikolay Kulikov
Quoted 11 lines · Ethan Tidmore
Quoted 6 lines · Nikolay Kulikov

The rtw_check_network_type() function takes a 'ratelen' parameter, but does not use it in any way. Also remove the local variable in rtw_ap.c created just to pass a value to this unused parameter.

---

...

Quoted 8 lines

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · line 890

Quoted 6 lines
drivers/staging/rtl8723bs/core/rtw_ap.c +1 -1
@@ -890,7 +887,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 		support_rate_num += ie_len;
 	}
 
-	network_type = rtw_check_network_type(support_rate, support_rate_num, channel);
+	network_type = rtw_check_network_type(support_rate, channel);

I think you can delete support_rate_num in this function too.

Is it possible to remove it completely? It's used as a temporary buffer for 'ie_len', so perhaps just the last line that increments 'support_rate_num' can be removed:

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

drivers/staging/rtl8723bs/core/rtw_ap.c int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · line 887

Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_ap.c +0 -0
 		support_rate_num += ie_len;

since this value is not used anywhere below.

You are right, we can remove support_rate_num entirely, but removing this would be nice.

can't*

Quoted 4 lines

Thanks,

ET

#5 lore raw

PATCH v2 1/1 staging: rtl8723bs: remove unused 'ratelen' parameter from rtw_check_network_type()

In reply to Nikolay Kulikov

The rtw_check_network_type() function takes a 'ratelen' parameter, but does not use it in any way. Also remove the local variable in rtw_ap.c created just to pass a value to this unused parameter.

---

Changes in v2:
- remove the last 'support_rate_num' increment which is not used anywhere in rtw_check_beacon_data() in rtw_ap.c

 drivers/staging/rtl8723bs/core/rtw_ap.c        | 9 ++-------
 drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c  | 2 +-
 drivers/staging/rtl8723bs/include/ieee80211.h  | 2 +-
 4 files changed, 5 insertions(+), 10 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +2 -7
index 3e62fc8f61cf..d6aa52f859df 100644
@@ -367,7 +367,6 @@ void add_ratid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
 void update_bmc_sta(struct adapter *padapter)
 {
 	unsigned char network_type;
-	int support_rate_num = 0;
 	unsigned int tx_ra_bitmap = 0;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -391,9 +390,7 @@ void update_bmc_sta(struct adapter *padapter)
 		memset(&psta->sta_stats, 0, sizeof(struct stainfo_stats));
 
 		/* prepare for add_ratid */
-		support_rate_num = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
 		network_type = rtw_check_network_type((u8 *)&pcur_network->supported_rates,
-						      support_rate_num,
 						      pcur_network->configuration.ds_config
 		);
 		if (is_supported_tx_cck(network_type)) {
@@ -885,12 +882,10 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 		       WLAN_EID_EXT_SUPP_RATES,
 		       &ie_len,
 		       pbss_network->ie_length - _BEACON_IE_OFFSET_);
-	if (p) {
+	if (p)
 		memcpy(support_rate + support_rate_num, p + 2, ie_len);
-		support_rate_num += ie_len;
-	}
 
-	network_type = rtw_check_network_type(support_rate, support_rate_num, channel);
+	network_type = rtw_check_network_type(support_rate, channel);
 
 	rtw_set_supported_rate(pbss_network->supported_rates, network_type);
 
drivers/staging/rtl8723bs/core/rtw_ieee80211.c +1 -1
index dbd4bcc8cd28..a657c963ff52 100644
@@ -94,7 +94,7 @@ bool rtw_is_cckratesonly_included(u8 *rate)
 	return true;
 }
 
-int rtw_check_network_type(unsigned char *rate, int ratelen, int channel)
+int rtw_check_network_type(unsigned char *rate, int channel)
 {
 	if (channel > 14)
 		return WIRELESS_INVALID;
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +1 -1
index a631fe323157..38c673e31313 100644
@@ -4886,7 +4886,7 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *p
 	rtw_hal_update_sta_rate_mask(padapter, psta);
 
 	/*  ToDo: HT for Ad-hoc */
-	psta->wireless_mode = rtw_check_network_type(psta->bssrateset, psta->bssratelen, pmlmeext->cur_channel);
+	psta->wireless_mode = rtw_check_network_type(psta->bssrateset, pmlmeext->cur_channel);
 	psta->raid = networktype_to_raid_ex(padapter, psta);
 
 	/* rate radaptive */
drivers/staging/rtl8723bs/include/ieee80211.h +1 -1
index 97fd5f75096b..8ec14e8d4c89 100644
@@ -778,7 +778,7 @@ bool rtw_is_cckrates_included(u8 *rate);
 
 bool rtw_is_cckratesonly_included(u8 *rate);
 
-int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
+int rtw_check_network_type(unsigned char *rate, int channel);
 
 void rtw_get_bcn_info(struct wlan_network *pnetwork);
 
Signature · 1 line
2.53.0
Reviewed-by on v2 1/1
#6 lore raw
Quoted 10 lines · Nikolay Kulikov

The rtw_check_network_type() function takes a 'ratelen' parameter, but does not use it in any way. Also remove the local variable in rtw_ap.c created just to pass a value to this unused parameter.

---

Changes in v2:
- remove the last 'support_rate_num' increment which is not used anywhere in rtw_check_beacon_data() in rtw_ap.c

LGTM.

Thanks,

ET