wl12xx: cancel delayed elp work and clear flags when stopping PLT
authorLuciano Coelho <coelho@ti.com>
Wed, 11 Jan 2012 07:42:42 +0000 (09:42 +0200)
committerLuciano Coelho <coelho@ti.com>
Wed, 15 Feb 2012 06:38:28 +0000 (08:38 +0200)
In some cases a race condition can happen if we don't cancel any
pending ELP work before stopping PLT.  With this commit we cancel ELP
work and clear the wl->flags bitmask.  Also clean up the wl elements
after powering off.

Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/main.c

index 3a1636b68cd259674728051ccdb9112c99f9440e..3587afcd6469117121b7a7e3b21de300e77868a0 100644 (file)
@@ -1420,17 +1420,18 @@ int wl1271_plt_stop(struct wl1271 *wl)
                goto out;
        }
 
-       wl->state = WL1271_STATE_OFF;
-       wl->rx_counter = 0;
-
        mutex_unlock(&wl->mutex);
 
        wl1271_flush_deferred_work(wl);
        cancel_work_sync(&wl->netstack_work);
        cancel_work_sync(&wl->recovery_work);
+       cancel_delayed_work_sync(&wl->elp_work);
 
        mutex_lock(&wl->mutex);
        wl1271_power_off(wl);
+       wl->flags = 0;
+       wl->state = WL1271_STATE_OFF;
+       wl->rx_counter = 0;
        mutex_unlock(&wl->mutex);
 
 out: