wil6210: Don't use wdev->sme_state
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Tue, 28 May 2013 12:17:53 +0000 (15:17 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 29 May 2013 19:22:32 +0000 (15:22 -0400)
sme_state is private wdev's variable.
Track connection state internally

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/wil6210/cfg80211.c
drivers/net/wireless/ath/wil6210/main.c
drivers/net/wireless/ath/wil6210/wil6210.h
drivers/net/wireless/ath/wil6210/wmi.c

index c5d4a87abaaf76eb3e91c167a0905d69cd96edef..4eb05d0818c3633520cd85210912368f6754eedd 100644 (file)
@@ -322,12 +322,16 @@ static int wil_cfg80211_connect(struct wiphy *wiphy,
         * FW don't support scan after connection attempt
         */
        set_bit(wil_status_dontscan, &wil->status);
+       set_bit(wil_status_fwconnecting, &wil->status);
 
        rc = wmi_send(wil, WMI_CONNECT_CMDID, &conn, sizeof(conn));
        if (rc == 0) {
                /* Connect can take lots of time */
                mod_timer(&wil->connect_timer,
                          jiffies + msecs_to_jiffies(2000));
+       } else {
+               clear_bit(wil_status_dontscan, &wil->status);
+               clear_bit(wil_status_fwconnecting, &wil->status);
        }
 
  out:
index ea49c8a18e15b63a3731bdc0fc4b9be782a48079..c97b864667c57db00226daa95e5e53ece033f1aa 100644 (file)
@@ -56,27 +56,21 @@ static void _wil6210_disconnect(struct wil6210_priv *wil, void *bssid)
 {
        uint i;
        struct net_device *ndev = wil_to_ndev(wil);
-       struct wireless_dev *wdev = wil->wdev;
 
        wil_dbg_misc(wil, "%s()\n", __func__);
 
        wil_link_off(wil);
-       clear_bit(wil_status_fwconnected, &wil->status);
-
-       switch (wdev->sme_state) {
-       case CFG80211_SME_CONNECTED:
-               cfg80211_disconnected(ndev, WLAN_STATUS_UNSPECIFIED_FAILURE,
+       if (test_bit(wil_status_fwconnected, &wil->status)) {
+               clear_bit(wil_status_fwconnected, &wil->status);
+               cfg80211_disconnected(ndev,
+                                     WLAN_STATUS_UNSPECIFIED_FAILURE,
                                      NULL, 0, GFP_KERNEL);
-               break;
-       case CFG80211_SME_CONNECTING:
+       } else if (test_bit(wil_status_fwconnecting, &wil->status)) {
                cfg80211_connect_result(ndev, bssid, NULL, 0, NULL, 0,
                                        WLAN_STATUS_UNSPECIFIED_FAILURE,
                                        GFP_KERNEL);
-               break;
-       default:
-               break;
        }
-
+       clear_bit(wil_status_fwconnecting, &wil->status);
        for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++)
                wil_vring_fini_tx(wil, i);
 
index 2e3c26e1c9751857497fdcc0ae450b0c0b4a7aaa..373cf656f5b0a217c86c86dd8995cb63af184ccd 100644 (file)
@@ -186,6 +186,7 @@ struct vring {
 
 enum { /* for wil6210_priv.status */
        wil_status_fwready = 0,
+       wil_status_fwconnecting,
        wil_status_fwconnected,
        wil_status_dontscan,
        wil_status_reset_done,
index a091eb11e392f3193b12de6b458f2cc14398091c..527ffb5438215b2b1992ee5b570cd0438636ac51 100644 (file)
@@ -409,7 +409,7 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len)
 
        if ((wdev->iftype == NL80211_IFTYPE_STATION) ||
            (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) {
-               if (wdev->sme_state != CFG80211_SME_CONNECTING) {
+               if (!test_bit(wil_status_fwconnecting, &wil->status)) {
                        wil_err(wil, "Not in connecting state\n");
                        return;
                }
@@ -433,6 +433,7 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len)
 
                cfg80211_new_sta(ndev, evt->bssid, &sinfo, GFP_KERNEL);
        }
+       clear_bit(wil_status_fwconnecting, &wil->status);
        set_bit(wil_status_fwconnected, &wil->status);
 
        /* FIXME FW can transmit only ucast frames to peer */