staging: rtl8723au: Introduce rtw_do_join_network()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 9 Jun 2014 13:16:50 +0000 (15:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jun 2014 21:03:49 +0000 (14:03 -0700)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_ioctl_set.c
drivers/staging/rtl8723au/core/rtw_mlme.c
drivers/staging/rtl8723au/include/rtw_mlme.h

index 28cfea53b1753a72d676bdb535c594ea3925e8f9..d2ed9d15ad9d4d6f66d40f8e84d45e02fff0f3cb 100644 (file)
@@ -79,8 +79,6 @@ int rtw_do_join23a(struct rtw_adapter *padapter)
                select_ret = rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
                if (select_ret == _SUCCESS) {
                        pmlmepriv->to_join = false;
-                       mod_timer(&pmlmepriv->assoc_timer,
-                                 jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
                } else {
                        if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
                                struct wlan_bssid_ex *pdev_network;
index 9248f4834d6f6dab238ccaad19d86748af64a89a..4a146fbc86ca191d6a7ccf19cd747bfefd3feb97 100644 (file)
@@ -739,8 +739,6 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
 
                                if (rtw_select_and_join_from_scanned_queue23a(
                                            pmlmepriv) == _SUCCESS) {
-                                       mod_timer(&pmlmepriv->assoc_timer,
-                                                 jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
                                } else {
                                        pdev_network = &adapter->registrypriv.dev_network;
                                        pibss = adapter->registrypriv.dev_network.MacAddress;
@@ -782,14 +780,10 @@ rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
                        pmlmepriv->to_join = false;
                        ret = rtw_select_and_join_from_scanned_queue23a(
                                pmlmepriv);
-                       if (ret == _SUCCESS) {
-                               unsigned long e;
-                               e = msecs_to_jiffies(MAX_JOIN_TIMEOUT);
-                               mod_timer(&pmlmepriv->assoc_timer, jiffies + e);
-                       } else if (ret == 2) {/* there is no need to wait */
+                       if (ret == 2) {/* there is no need to wait */
                                _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
                                rtw_indicate_connect23a(adapter);
-                       } else {
+                       } else if (ret != _SUCCESS) {
                                DBG_8723A("try_to_join, but select scanning "
                                          "queue fail, to_roaming:%d\n",
                                          adapter->mlmepriv.to_roaming);
@@ -1784,6 +1778,31 @@ exit:
        return candidate;
 }
 
+
+int rtw_do_join_network(struct rtw_adapter *adapter,
+                       struct wlan_network *candidate)
+{
+       int ret;
+
+       /*  check for situation of  _FW_LINKED */
+       if (check_fwstate(&adapter->mlmepriv, _FW_LINKED)) {
+               DBG_8723A("%s: _FW_LINKED while ask_for_joinbss!\n", __func__);
+
+               rtw_disassoc_cmd23a(adapter, 0, true);
+               rtw_indicate_disconnect23a(adapter);
+               rtw_free_assoc_resources23a(adapter, 0);
+       }
+       set_fwstate(&adapter->mlmepriv, _FW_UNDER_LINKING);
+
+       ret = rtw_joinbss_cmd23a(adapter, candidate);
+
+       if (ret == _SUCCESS)
+               mod_timer(&adapter->mlmepriv.assoc_timer,
+                         jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
+
+       return ret;
+}
+
 int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
 {
        struct rtw_adapter *adapter;
@@ -1804,16 +1823,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
                          candidate->network.DSConfig);
        }
 
-       /*  check for situation of  _FW_LINKED */
-       if (check_fwstate(pmlmepriv, _FW_LINKED)) {
-               DBG_8723A("%s: _FW_LINKED while ask_for_joinbss!\n", __func__);
-
-               rtw_disassoc_cmd23a(adapter, 0, true);
-               rtw_indicate_disconnect23a(adapter);
-               rtw_free_assoc_resources23a(adapter, 0);
-       }
-       set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
-       ret = rtw_joinbss_cmd23a(adapter, candidate);
+       ret = rtw_do_join_network(adapter, candidate);
 
 exit:
        return ret;
index c8e82bfb3f75316d10d3e91c03b9115eb62c5c00..e48518f4b1bc1873237d8847f950bfd5a33f213e 100644 (file)
@@ -240,6 +240,8 @@ int rtw_init_mlme_priv23a(struct rtw_adapter *adapter);
 
 void rtw_free_mlme_priv23a(struct mlme_priv *pmlmepriv);
 
+int rtw_do_join_network(struct rtw_adapter *adapter,
+                       struct wlan_network *candidate);
 int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv);
 int rtw_set_key23a(struct rtw_adapter *adapter,
                struct security_priv *psecuritypriv, int keyid, u8 set_tx);