Commit b4ba3b57 authored by Buţiu Alexandru Octavian's avatar Buţiu Alexandru Octavian Committed by Greg Kroah-Hartman

drivers: staging: rtl8188eu Refactored rtw_free_assoc_resources

Refactored rtw_free_assoc_resources to avoid sparse warnings about
different contexts for basic lock
Signed-off-by: default avatarBuţiu Alexandru Octavian <predator5047@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5143f7a3
...@@ -183,7 +183,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid) ...@@ -183,7 +183,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) {
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
...@@ -271,7 +271,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) ...@@ -271,7 +271,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) { if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
...@@ -293,7 +293,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid) ...@@ -293,7 +293,7 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) { if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE); _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
...@@ -366,7 +366,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter, ...@@ -366,7 +366,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
if ((check_fwstate(pmlmepriv, _FW_LINKED)) || if ((check_fwstate(pmlmepriv, _FW_LINKED)) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))) (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)))
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) { if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) {
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
...@@ -415,7 +415,7 @@ u8 rtw_set_802_11_disassociate(struct adapter *padapter) ...@@ -415,7 +415,7 @@ u8 rtw_set_802_11_disassociate(struct adapter *padapter)
rtw_disassoc_cmd(padapter, 0, true); rtw_disassoc_cmd(padapter, 0, true);
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
rtw_pwr_wakeup(padapter); rtw_pwr_wakeup(padapter);
} }
......
...@@ -704,7 +704,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf) ...@@ -704,7 +704,7 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
if (--pmlmepriv->to_roaming == 0 || if (--pmlmepriv->to_roaming == 0 ||
_SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) { _SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) {
pmlmepriv->to_roaming = 0; pmlmepriv->to_roaming = 0;
rtw_free_assoc_resources(adapter, 1); rtw_free_assoc_resources(adapter);
rtw_indicate_disconnect(adapter); rtw_indicate_disconnect(adapter);
} else { } else {
pmlmepriv->to_join = true; pmlmepriv->to_join = true;
...@@ -758,7 +758,19 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv) ...@@ -758,7 +758,19 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
/* /*
*rtw_free_assoc_resources: the caller has to lock pmlmepriv->lock *rtw_free_assoc_resources: the caller has to lock pmlmepriv->lock
*/ */
void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) void rtw_free_assoc_resources(struct adapter *adapter)
{
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
rtw_free_assoc_resources_locked(adapter);
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
}
/*
*rtw_free_assoc_resources_locked: the caller has to lock pmlmepriv->lock
*/
void rtw_free_assoc_resources_locked(struct adapter *adapter)
{ {
struct wlan_network *pwlan = NULL; struct wlan_network *pwlan = NULL;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
...@@ -793,8 +805,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) ...@@ -793,8 +805,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
rtw_init_bcmc_stainfo(adapter); rtw_init_bcmc_stainfo(adapter);
} }
if (lock_scanned_queue)
spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress); pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.MacAddress);
if (pwlan) if (pwlan)
...@@ -805,8 +815,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue) ...@@ -805,8 +815,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && (adapter->stapriv.asoc_sta_count == 1))) if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && (adapter->stapriv.asoc_sta_count == 1)))
rtw_free_network_nolock(pmlmepriv, pwlan); rtw_free_network_nolock(pmlmepriv, pwlan);
if (lock_scanned_queue)
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
pmlmepriv->key_mask = 0; pmlmepriv->key_mask = 0;
} }
...@@ -1302,7 +1310,7 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf) ...@@ -1302,7 +1310,7 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf)
rtw_free_uc_swdec_pending_queue(adapter); rtw_free_uc_swdec_pending_queue(adapter);
rtw_free_assoc_resources(adapter, 1); rtw_free_assoc_resources(adapter);
rtw_indicate_disconnect(adapter); rtw_indicate_disconnect(adapter);
spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
/* remove the network entry in scanned_queue */ /* remove the network entry in scanned_queue */
...@@ -1557,7 +1565,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv) ...@@ -1557,7 +1565,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv)
rtw_disassoc_cmd(adapter, 0, true); rtw_disassoc_cmd(adapter, 0, true);
rtw_indicate_disconnect(adapter); rtw_indicate_disconnect(adapter);
rtw_free_assoc_resources(adapter, 0); rtw_free_assoc_resources_locked(adapter);
} }
rtw_hal_get_def_var(adapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(supp_ant_div)); rtw_hal_get_def_var(adapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &(supp_ant_div));
......
...@@ -70,7 +70,7 @@ static int rtw_hw_suspend(struct adapter *padapter) ...@@ -70,7 +70,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
} }
} }
/* s2-3. */ /* s2-3. */
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
/* s2-4. */ /* s2-4. */
rtw_free_network_queue(padapter, true); rtw_free_network_queue(padapter, true);
......
...@@ -535,7 +535,8 @@ void rtw_generate_random_ibss(u8 *pibss); ...@@ -535,7 +535,8 @@ void rtw_generate_random_ibss(u8 *pibss);
struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr); struct wlan_network *rtw_find_network(struct __queue *scanned_queue, u8 *addr);
struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue); struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue);
void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue); void rtw_free_assoc_resources(struct adapter *adapter);
void rtw_free_assoc_resources_locked(struct adapter *adapter);
void rtw_indicate_disconnect(struct adapter *adapter); void rtw_indicate_disconnect(struct adapter *adapter);
void rtw_indicate_connect(struct adapter *adapter); void rtw_indicate_connect(struct adapter *adapter);
void rtw_indicate_scan_done(struct adapter *padapter, bool aborted); void rtw_indicate_scan_done(struct adapter *padapter, bool aborted);
......
...@@ -1871,7 +1871,7 @@ static int rtw_wx_set_auth(struct net_device *dev, ...@@ -1871,7 +1871,7 @@ static int rtw_wx_set_auth(struct net_device *dev,
rtw_disassoc_cmd(padapter, 500, false); rtw_disassoc_cmd(padapter, 500, false);
DBG_88E("%s...call rtw_indicate_disconnect\n ", __func__); DBG_88E("%s...call rtw_indicate_disconnect\n ", __func__);
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
} }
ret = wpa_set_auth_algs(dev, (u32)param->value); ret = wpa_set_auth_algs(dev, (u32)param->value);
break; break;
......
...@@ -1175,7 +1175,7 @@ static int netdev_close(struct net_device *pnetdev) ...@@ -1175,7 +1175,7 @@ static int netdev_close(struct net_device *pnetdev)
/* s2-2. indicate disconnect to os */ /* s2-2. indicate disconnect to os */
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
/* s2-3. */ /* s2-3. */
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
/* s2-4. */ /* s2-4. */
rtw_free_network_queue(padapter, true); rtw_free_network_queue(padapter, true);
/* Close LED */ /* Close LED */
......
...@@ -266,7 +266,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) ...@@ -266,7 +266,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
/* s2-2. indicate disconnect to os */ /* s2-2. indicate disconnect to os */
rtw_indicate_disconnect(padapter); rtw_indicate_disconnect(padapter);
/* s2-3. */ /* s2-3. */
rtw_free_assoc_resources(padapter, 1); rtw_free_assoc_resources(padapter);
/* s2-4. */ /* s2-4. */
rtw_free_network_queue(padapter, true); rtw_free_network_queue(padapter, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment