wl1271: Separate interface removal to another function
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>
Tue, 21 Sep 2010 04:23:30 +0000 (06:23 +0200)
committerLuciano Coelho <luciano.coelho@nokia.com>
Tue, 28 Sep 2010 09:30:04 +0000 (12:30 +0300)
Do this so the interface removal can be triggered from an upcoming hardware
failure recovery mechanism.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
drivers/net/wireless/wl12xx/wl1271_main.c
drivers/net/wireless/wl12xx/wl1271_scan.c

index 9ab4fc4f7b4b306713672472351762031af8407f..e7f096fb62126f652559cc03f5cc75bd8ba69253 100644 (file)
@@ -960,15 +960,10 @@ out:
        return ret;
 }
 
-static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
-                                      struct ieee80211_vif *vif)
+static void __wl1271_op_remove_interface(struct wl1271 *wl)
 {
-       struct wl1271 *wl = hw->priv;
        int i;
 
-       cancel_work_sync(&wl->scan_complete_work);
-
-       mutex_lock(&wl->mutex);
        wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface");
 
        wl1271_info("down");
@@ -994,6 +989,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
 
        mutex_unlock(&wl->mutex);
 
+       cancel_work_sync(&wl->scan_complete_work);
        cancel_work_sync(&wl->irq_work);
        cancel_work_sync(&wl->tx_work);
        cancel_delayed_work_sync(&wl->pspoll_work);
@@ -1039,7 +1035,16 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
        wl->tx_res_if = NULL;
        kfree(wl->target_mem_map);
        wl->target_mem_map = NULL;
+}
 
+static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
+                                      struct ieee80211_vif *vif)
+{
+       struct wl1271 *wl = hw->priv;
+
+       mutex_lock(&wl->mutex);
+       WARN_ON(wl->vif != vif);
+       __wl1271_op_remove_interface(wl);
        mutex_unlock(&wl->mutex);
 }
 
index 9f1da82ed8d61e11141c05c6dad430b4a9e759fa..20caceba435e5ad71a2d7592b83d884346fd43dd 100644 (file)
@@ -36,6 +36,12 @@ void wl1271_scan_complete_work(struct work_struct *work)
        wl1271_debug(DEBUG_SCAN, "Scanning complete");
 
        mutex_lock(&wl->mutex);
+
+       if (wl->scan.state == WL1271_SCAN_STATE_IDLE) {
+               mutex_unlock(&wl->mutex);
+               return;
+       }
+
        wl->scan.state = WL1271_SCAN_STATE_IDLE;
        kfree(wl->scan.scanned_ch);
        wl->scan.scanned_ch = NULL;