ath6kl: create ath6kl_cfg80211_stop()
authorKalle Valo <kvalo@qca.qualcomm.com>
Tue, 1 Nov 2011 06:44:04 +0000 (08:44 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 11 Nov 2011 10:58:59 +0000 (12:58 +0200)
Just take code from deep sleep for now, will be improved later. No
functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/ath6kl/cfg80211.h
drivers/net/wireless/ath/ath6kl/main.c

index e7203cf17542a534b0c4675745b82907edc547b0..db75642d16f28a38f0332782da6082357b56eb69 100644 (file)
@@ -2113,6 +2113,55 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
        .mgmt_frame_register = ath6kl_mgmt_frame_register,
 };
 
+void ath6kl_cfg80211_stop(struct ath6kl *ar)
+{
+       struct ath6kl_vif *vif;
+
+       /* FIXME: for multi vif */
+       vif = ath6kl_vif_first(ar);
+       if (!vif) {
+               /* save the current power mode before enabling power save */
+               ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode;
+
+               if (ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER) != 0)
+                       ath6kl_warn("ath6kl_deep_sleep_enable: "
+                                   "wmi_powermode_cmd failed\n");
+               return;
+       }
+
+       switch (vif->sme_state) {
+       case SME_CONNECTING:
+               cfg80211_connect_result(vif->ndev, vif->bssid, NULL, 0,
+                                       NULL, 0,
+                                       WLAN_STATUS_UNSPECIFIED_FAILURE,
+                                       GFP_KERNEL);
+               break;
+       case SME_CONNECTED:
+       default:
+               /*
+                * FIXME: oddly enough smeState is in DISCONNECTED during
+                * suspend, why? Need to send disconnected event in that
+                * state.
+                */
+               cfg80211_disconnected(vif->ndev, 0, NULL, 0, GFP_KERNEL);
+               break;
+       }
+
+       if (test_bit(CONNECTED, &vif->flags) ||
+           test_bit(CONNECT_PEND, &vif->flags))
+               ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx);
+
+       vif->sme_state = SME_DISCONNECTED;
+
+       /* disable scanning */
+       if (ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 0xFFFF, 0, 0,
+                                     0, 0, 0, 0, 0, 0, 0) != 0)
+               printk(KERN_WARNING "ath6kl: failed to disable scan "
+                      "during suspend\n");
+
+       ath6kl_cfg80211_scan_complete_event(vif, true);
+}
+
 struct ath6kl *ath6kl_core_alloc(struct device *dev)
 {
        struct ath6kl *ar;
index f323a49fdde320ea1bde2de4ce15863d68b8215a..bb0ac22dfa5bf72ca9c596547b99306f4d536a11 100644 (file)
@@ -40,4 +40,6 @@ void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason,
 void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid,
                                     bool ismcast);
 
+void ath6kl_cfg80211_stop(struct ath6kl *ar);
+
 #endif /* ATH6KL_CFG80211_H */
index d2822d0854eb0d5d48f2271239271ed584ec8dfc..378dc8d0277d7dd4fa08acab4e023f1b44699b4f 100644 (file)
@@ -580,51 +580,7 @@ void ath6kl_disconnect(struct ath6kl_vif *vif)
 
 void ath6kl_deep_sleep_enable(struct ath6kl *ar)
 {
-       struct ath6kl_vif *vif;
-
-       /* FIXME: for multi vif */
-       vif = ath6kl_vif_first(ar);
-       if (!vif) {
-               /* save the current power mode before enabling power save */
-               ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode;
-
-               if (ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER) != 0)
-                       ath6kl_warn("ath6kl_deep_sleep_enable: "
-                                   "wmi_powermode_cmd failed\n");
-               return;
-       }
-
-       switch (vif->sme_state) {
-       case SME_CONNECTING:
-               cfg80211_connect_result(vif->ndev, vif->bssid, NULL, 0,
-                                       NULL, 0,
-                                       WLAN_STATUS_UNSPECIFIED_FAILURE,
-                                       GFP_KERNEL);
-               break;
-       case SME_CONNECTED:
-       default:
-               /*
-                * FIXME: oddly enough smeState is in DISCONNECTED during
-                * suspend, why? Need to send disconnected event in that
-                * state.
-                */
-               cfg80211_disconnected(vif->ndev, 0, NULL, 0, GFP_KERNEL);
-               break;
-       }
-
-       if (test_bit(CONNECTED, &vif->flags) ||
-           test_bit(CONNECT_PEND, &vif->flags))
-               ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx);
-
-       vif->sme_state = SME_DISCONNECTED;
-
-       /* disable scanning */
-       if (ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 0xFFFF, 0, 0,
-                                     0, 0, 0, 0, 0, 0, 0) != 0)
-               printk(KERN_WARNING "ath6kl: failed to disable scan "
-                      "during suspend\n");
-
-       ath6kl_cfg80211_scan_complete_event(vif, true);
+       ath6kl_cfg80211_stop(ar);
 
        /* save the current power mode before enabling power save */
        ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode;