[PATCH] Staging: rtl8723bs: Delete dead code from update_current_network()

From: Meir Elisha
Date: Sun Apr 07 2024 - 08:38:53 EST


Remove dead code from rtw_mlme.c in order to improve code readability.

Signed-off-by: Meir Elisha <meir6264@xxxxxxxxx>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 92 ++---------------------
1 file changed, 5 insertions(+), 87 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index bfb27f902753..8c487b7b7a40 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -22,7 +22,6 @@ int rtw_init_mlme_priv(struct adapter *padapter)

pmlmepriv->pscanned = NULL;
pmlmepriv->fw_state = WIFI_STATION_STATE; /* Must sync with rtw_wdev_alloc() */
- /* wdev->iftype = NL80211_IFTYPE_STATION */
pmlmepriv->cur_network.network.infrastructure_mode = Ndis802_11AutoUnknown;
pmlmepriv->scan_mode = SCAN_ACTIVE;/* 1: active, 0: passive. Maybe someday we should rename this varable to "active_mode" (Jeff) */

@@ -109,32 +108,6 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
}
}

-/*
-struct wlan_network *_rtw_dequeue_network(struct __queue *queue)
-{
- _irqL irqL;
-
- struct wlan_network *pnetwork;
-
- spin_lock_bh(&queue->lock);
-
- if (list_empty(&queue->queue))
-
- pnetwork = NULL;
-
- else
- {
- pnetwork = container_of(get_next(&queue->queue), struct wlan_network, list);
-
- list_del_init(&(pnetwork->list));
- }
-
- spin_unlock_bh(&queue->lock);
-
- return pnetwork;
-}
-*/
-
struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv)
{
struct wlan_network *pnetwork;
@@ -207,13 +180,9 @@ void _rtw_free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *
if (pnetwork->fixed)
return;

- /* spin_lock_irqsave(&free_queue->lock, irqL); */
-
list_del_init(&(pnetwork->list));

list_add_tail(&(pnetwork->list), get_list_head(free_queue));
-
- /* spin_unlock_irqrestore(&free_queue->lock, irqL); */
}

/*
@@ -231,8 +200,6 @@ struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr)
goto exit;
}

- /* spin_lock_bh(&scanned_queue->lock); */
-
phead = get_list_head(scanned_queue);
list_for_each(plist, phead) {
pnetwork = list_entry(plist, struct wlan_network, list);
@@ -244,8 +211,6 @@ struct wlan_network *_rtw_find_network(struct __queue *scanned_queue, u8 *addr)
if (plist == phead)
pnetwork = NULL;

- /* spin_unlock_bh(&scanned_queue->lock); */
-
exit:
return pnetwork;
}
@@ -320,16 +285,6 @@ void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
_rtw_free_mlme_priv(pmlmepriv);
}

-/*
-static struct wlan_network *rtw_dequeue_network(struct __queue *queue)
-{
- struct wlan_network *pnetwork;
-
- pnetwork = _rtw_dequeue_network(queue);
- return pnetwork;
-}
-*/
-
void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork);
void rtw_free_network_nolock(struct adapter *padapter, struct wlan_network *pnetwork)
{
@@ -494,12 +449,9 @@ static void update_current_network(struct adapter *adapter, struct wlan_bssid_ex
&(pmlmepriv->cur_network.network));

if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && (is_same_network(&(pmlmepriv->cur_network.network), pnetwork, 0))) {
- /* if (pmlmepriv->cur_network.network.ie_length<= pnetwork->ie_length) */
- {
- update_network(&(pmlmepriv->cur_network.network), pnetwork, adapter, true);
- rtw_update_protection(adapter, (pmlmepriv->cur_network.network.ies) + sizeof(struct ndis_802_11_fix_ie),
- pmlmepriv->cur_network.network.ie_length);
- }
+ update_network(&(pmlmepriv->cur_network.network), pnetwork, adapter, true);
+ rtw_update_protection(adapter, (pmlmepriv->cur_network.network.ies) + sizeof(struct ndis_802_11_fix_ie),
+ pmlmepriv->cur_network.network.ie_length);
}
}

@@ -540,7 +492,6 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t

/* If we didn't find a match, then get a new network slot to initialize
* with this beacon's information */
- /* if (phead == plist) { */
if (!target_find) {
if (list_empty(&pmlmepriv->free_bss_pool.queue)) {
/* If there are no more slots, expire the oldest */
@@ -613,15 +564,8 @@ void rtw_update_scanned_network(struct adapter *adapter, struct wlan_bssid_ex *t
void rtw_add_network(struct adapter *adapter, struct wlan_bssid_ex *pnetwork);
void rtw_add_network(struct adapter *adapter, struct wlan_bssid_ex *pnetwork)
{
- /* struct __queue *queue = &(pmlmepriv->scanned_queue); */
-
- /* spin_lock_bh(&queue->lock); */
-
update_current_network(adapter, pnetwork);
-
rtw_update_scanned_network(adapter, pnetwork);
-
- /* spin_unlock_bh(&queue->lock); */
}

/* select the desired network based on the capability of the (i)bss. */
@@ -637,10 +581,7 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
u32 desired_encmode;
u32 privacy;
-
- /* u8 wps_ie[512]; */
uint wps_ielen;
-
int bselected = true;

desired_encmode = psecuritypriv->ndisencryptstatus;
@@ -1052,9 +993,8 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str
memset((u8 *)&psta->dot11rxpn, 0, sizeof(union pn48));
}

- /* Commented by Albert 2012/07/21 */
- /* When doing the WPS, the wps_ie_len won't equal to 0 */
- /* And the Wi-Fi driver shouldn't allow the data packet to be transmitted. */
+ /* When doing the WPS, the wps_ie_len won't equal to 0 */
+ /* And the Wi-Fi driver shouldn't allow the data packet to be transmitted. */
if (padapter->securitypriv.wps_ie_len != 0) {
psta->ieee8021x_blocked = true;
padapter->securitypriv.wps_ie_len = 0;
@@ -1064,7 +1004,6 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str
/* if A-MPDU Rx is enabled, resetting rx_ordering_ctrl wstart_b(indicate_seq) to default value = 0xffff */
/* todo: check if AP can send A-MPDU packets */
for (i = 0; i < 16 ; i++) {
- /* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */
preorder_ctrl = &psta->recvreorder_ctrl[i];
preorder_ctrl->enable = false;
preorder_ctrl->indicate_seq = 0xffff;
@@ -1075,7 +1014,6 @@ static struct sta_info *rtw_joinbss_update_stainfo(struct adapter *padapter, str
bmc_sta = rtw_get_bcmc_stainfo(padapter);
if (bmc_sta) {
for (i = 0; i < 16 ; i++) {
- /* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */
preorder_ctrl = &bmc_sta->recvreorder_ctrl[i];
preorder_ctrl->enable = false;
preorder_ctrl->indicate_seq = 0xffff;
@@ -1239,8 +1177,6 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
rtw_reset_securitypriv(adapter);
_set_timer(&pmlmepriv->assoc_timer, 1);

- /* rtw_free_assoc_resources(adapter, 1); */
-
if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == true)
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);

@@ -1262,7 +1198,6 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
#endif

_set_timer(&pmlmepriv->assoc_timer, 1);
- /* rtw_free_assoc_resources(adapter, 1); */
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);

#ifdef REJOIN
@@ -1357,7 +1292,6 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf)
/* to do : init sta_info variable */
psta->qos_option = 0;
psta->mac_id = (uint)pstassoc->cam_id;
- /* psta->aid = (uint)pstassoc->cam_id; */

/* for ad-hoc mode */
rtw_hal_set_odm_var(adapter, HAL_ODM_STA_INFO, psta, true);
@@ -1472,10 +1406,8 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf)

if (adapter->stapriv.asoc_sta_count == 1) {/* a sta + bc/mc_stainfo (not Ibss_stainfo) */
u8 ret = _SUCCESS;
- /* rtw_indicate_disconnect(adapter);removed@20091105 */
spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
/* free old ibss network */
- /* pwlan = rtw_find_network(&pmlmepriv->scanned_queue, pstadel->macaddr); */
pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.mac_address);
if (pwlan) {
pwlan->fixed = false;
@@ -2088,14 +2020,6 @@ signed int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, u
} else if ((authmode == WLAN_EID_VENDOR_SPECIFIC) || (authmode == WLAN_EID_RSN)) {
/* copy RSN or SSN */
memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], psecuritypriv->supplicant_ie[1]+2);
- /* debug for CONFIG_IEEE80211W
- {
- int jj;
- printk("supplicant_ie_length =%d &&&&&&&&&&&&&&&&&&&\n", psecuritypriv->supplicant_ie[1]+2);
- for (jj = 0; jj < psecuritypriv->supplicant_ie[1]+2; jj++)
- printk(" %02x ", psecuritypriv->supplicant_ie[jj]);
- printk("\n");
- }*/
ielength += psecuritypriv->supplicant_ie[1]+2;
rtw_report_sec_ie(adapter, authmode, psecuritypriv->supplicant_ie);
}
@@ -2132,7 +2056,6 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter)
struct wlan_bssid_ex *pdev_network = &pregistrypriv->dev_network;
struct security_priv *psecuritypriv = &adapter->securitypriv;
struct wlan_network *cur_network = &adapter->mlmepriv.cur_network;
- /* struct xmit_priv *pxmitpriv = &adapter->xmitpriv; */

pdev_network->privacy = (psecuritypriv->dot11PrivacyAlgrthm > 0 ? 1 : 0) ; /* adhoc no 802.1x */

@@ -2381,7 +2304,6 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR,
&max_rx_ampdu_factor);

- /* rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); */
ht_capie.ampdu_params_info = (max_rx_ampdu_factor&0x03);

if (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
@@ -2411,14 +2333,10 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe
{
u8 *p, max_ampdu_sz;
int len;
- /* struct sta_info *bmc_sta, *psta; */
struct ieee80211_ht_cap *pht_capie;
- /* struct recv_reorder_ctrl *preorder_ctrl; */
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv;
- /* struct recv_priv *precvpriv = &padapter->recvpriv; */
struct registry_priv *pregistrypriv = &padapter->registrypriv;
- /* struct wlan_network *pcur_network = &(pmlmepriv->cur_network);; */
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 cbw40_enable = 0;
--
2.34.1