wl1271: Fix work cancelling when shutting down the driver
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>
Tue, 21 Sep 2010 04:23:29 +0000 (06:23 +0200)
committerLuciano Coelho <luciano.coelho@nokia.com>
Tue, 28 Sep 2010 09:30:03 +0000 (12:30 +0300)
The work cancelling has had several hazards, ranging from potentially
executing work after the driver is in OFF state, to executing work after
the driver and relevant memory structures are already removed.

Fix these.

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_event.c
drivers/net/wireless/wl12xx/wl1271_main.c
drivers/net/wireless/wl12xx/wl1271_ps.c

index bced8296a25114ba3b4ece228521275083c6595a..e6c839af903830557ae3b63e77c2432124778cbb 100644 (file)
@@ -41,6 +41,9 @@ void wl1271_pspoll_work(struct work_struct *work)
 
        mutex_lock(&wl->mutex);
 
+       if (unlikely(wl->state == WL1271_STATE_OFF))
+               goto out;
+
        if (!test_and_clear_bit(WL1271_FLAG_PSPOLL_FAILURE, &wl->flags))
                goto out;
 
index 0026e775bb0d4da1aafa84c8dbc631d21fe12dfb..9ab4fc4f7b4b306713672472351762031af8407f 100644 (file)
@@ -792,6 +792,8 @@ int wl1271_plt_stop(struct wl1271 *wl)
 out:
        mutex_unlock(&wl->mutex);
 
+       cancel_work_sync(&wl->irq_work);
+
        return ret;
 }
 
@@ -995,6 +997,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
        cancel_work_sync(&wl->irq_work);
        cancel_work_sync(&wl->tx_work);
        cancel_delayed_work_sync(&wl->pspoll_work);
+       cancel_delayed_work_sync(&wl->elp_work);
 
        mutex_lock(&wl->mutex);
 
index f75668e413fd7464d3e31f93604f5f49011dfe37..150dc674d8b4a467cd26fc17d44073243ebb83c2 100644 (file)
@@ -39,6 +39,9 @@ void wl1271_elp_work(struct work_struct *work)
 
        mutex_lock(&wl->mutex);
 
+       if (unlikely(wl->state == WL1271_STATE_OFF))
+               goto out;
+
        if (test_bit(WL1271_FLAG_IN_ELP, &wl->flags) ||
            (!test_bit(WL1271_FLAG_PSM, &wl->flags) &&
             !test_bit(WL1271_FLAG_IDLE, &wl->flags)))
This page took 0.099924 seconds and 5 git commands to generate.