drivers: staging: rtl8188eu Refactored rtw_free_assoc_resources
authorBuţiu Alexandru Octavian <predator5047@gmail.com>
Thu, 23 Jul 2015 21:13:27 +0000 (00:13 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Jul 2015 20:37:46 +0000 (13:37 -0700)
Refactored rtw_free_assoc_resources to avoid sparse warnings about
different contexts for basic lock

Signed-off-by: Buţiu Alexandru Octavian <predator5047@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
drivers/staging/rtl8188eu/core/rtw_mlme.c
drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
drivers/staging/rtl8188eu/include/rtw_mlme.h
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
drivers/staging/rtl8188eu/os_dep/os_intfs.c
drivers/staging/rtl8188eu/os_dep/usb_intf.c

index 8c05cb021c46a467c644af2efb4b289744a7f314..22f5b45f5f7fcb68d29334801221e2c434e1c9ef 100644 (file)
@@ -183,7 +183,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
                        if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
                                rtw_indicate_disconnect(padapter);
 
-                       rtw_free_assoc_resources(padapter, 1);
+                       rtw_free_assoc_resources(padapter);
 
                        if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) {
                                _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)
                                        if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
                                                rtw_indicate_disconnect(padapter);
 
-                                       rtw_free_assoc_resources(padapter, 1);
+                                       rtw_free_assoc_resources(padapter);
 
                                        if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
                                                _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)
                        if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
                                rtw_indicate_disconnect(padapter);
 
-                       rtw_free_assoc_resources(padapter, 1);
+                       rtw_free_assoc_resources(padapter);
 
                        if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
                                _clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
@@ -366,7 +366,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
 
                if ((check_fwstate(pmlmepriv, _FW_LINKED)) ||
                    (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 (check_fwstate(pmlmepriv, _FW_LINKED) == true)
@@ -415,7 +415,7 @@ u8 rtw_set_802_11_disassociate(struct adapter *padapter)
 
                rtw_disassoc_cmd(padapter, 0, true);
                rtw_indicate_disconnect(padapter);
-               rtw_free_assoc_resources(padapter, 1);
+               rtw_free_assoc_resources(padapter);
                rtw_pwr_wakeup(padapter);
        }
 
index 2b599e3c07855f101b50bccf673f38344c06de49..71a7a85571aace0c825c6b249fceb3823c9b073a 100644 (file)
@@ -704,7 +704,7 @@ void rtw_surveydone_event_callback(struct adapter   *adapter, u8 *pbuf)
                                        if (--pmlmepriv->to_roaming == 0 ||
                                            _SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)) {
                                                pmlmepriv->to_roaming = 0;
-                                               rtw_free_assoc_resources(adapter, 1);
+                                               rtw_free_assoc_resources(adapter);
                                                rtw_indicate_disconnect(adapter);
                                        } else {
                                                pmlmepriv->to_join = true;
@@ -758,7 +758,19 @@ static void free_scanqueue(struct  mlme_priv *pmlmepriv)
 /*
 *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  mlme_priv *pmlmepriv = &adapter->mlmepriv;
@@ -793,8 +805,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
                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);
        if (pwlan)
@@ -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)))
                rtw_free_network_nolock(pmlmepriv, pwlan);
 
-       if (lock_scanned_queue)
-               spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
        pmlmepriv->key_mask = 0;
 }
 
@@ -1302,7 +1310,7 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf)
 
                rtw_free_uc_swdec_pending_queue(adapter);
 
-               rtw_free_assoc_resources(adapter, 1);
+               rtw_free_assoc_resources(adapter);
                rtw_indicate_disconnect(adapter);
                spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
                /*  remove the network entry in scanned_queue */
@@ -1557,7 +1565,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv)
 
                rtw_disassoc_cmd(adapter, 0, true);
                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));
index a2b54de21ed7be3ba58bf2f42fa9c1a328a80ab2..9765946466ab6ad7d7f4a55eaa2c836b83926886 100644 (file)
@@ -70,7 +70,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
                }
        }
        /* s2-3. */
-       rtw_free_assoc_resources(padapter, 1);
+       rtw_free_assoc_resources(padapter);
 
        /* s2-4. */
        rtw_free_network_queue(padapter, true);
index 8c7e8a36aa13a32dd1205107fab08dd9a87b9cf7..4c992573e3ca9fe630f8ed3caad56a2f0fad4274 100644 (file)
@@ -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_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_connect(struct adapter *adapter);
 void rtw_indicate_scan_done(struct adapter *padapter, bool aborted);
index ce756cdb817b744e61fd894a0209f35b1f9781a0..2db86fbe29d2354291b4c2153427e616ddeb0e63 100644 (file)
@@ -1871,7 +1871,7 @@ static int rtw_wx_set_auth(struct net_device *dev,
                        rtw_disassoc_cmd(padapter, 500, false);
                        DBG_88E("%s...call rtw_indicate_disconnect\n ", __func__);
                        rtw_indicate_disconnect(padapter);
-                       rtw_free_assoc_resources(padapter, 1);
+                       rtw_free_assoc_resources(padapter);
                }
                ret = wpa_set_auth_algs(dev, (u32)param->value);
                break;
index a14e79f31abf72d3e459cc7381c220201dac4f6d..2361bce480c3fa51b1b9c4d81aaec8047a92e8e7 100644 (file)
@@ -1175,7 +1175,7 @@ static int netdev_close(struct net_device *pnetdev)
                /* s2-2.  indicate disconnect to os */
                rtw_indicate_disconnect(padapter);
                /* s2-3. */
-               rtw_free_assoc_resources(padapter, 1);
+               rtw_free_assoc_resources(padapter);
                /* s2-4. */
                rtw_free_network_queue(padapter, true);
                /*  Close LED */
index 5f44c6a5b7778f9afa2b451aa2d8e7ab77851007..33bfe054f8677d5d4cc129c9b4111a4d9bf81a72 100644 (file)
@@ -266,7 +266,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
        /* s2-2.  indicate disconnect to os */
        rtw_indicate_disconnect(padapter);
        /* s2-3. */
-       rtw_free_assoc_resources(padapter, 1);
+       rtw_free_assoc_resources(padapter);
        /* s2-4. */
        rtw_free_network_queue(padapter, true);