wl1271: Move work-init calls to hw allocation
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>
Thu, 30 Sep 2010 08:43:28 +0000 (10:43 +0200)
committerLuciano Coelho <luciano.coelho@nokia.com>
Tue, 5 Oct 2010 13:27:38 +0000 (16:27 +0300)
Due to legacy reason, dating back to when the wl1251 and wl1271 still were
a unified driver, some work-structures are initialized on hardware startup.

The hardware recovery code creates a scenario in which it is possible for a
workstruct to be re-initialized while the work-function itself is running,
which causes a kernel WARNing and a subsequent reboot.

To remedy this, move the work initialization calls to the hw allocation,
which is the logically correct place for them anyway.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Tested-by: Tuomas Katila <ext-tuomas.2.katila@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
drivers/net/wireless/wl12xx/wl1271_main.c

index 8071da10dbc943e74ff60d718d8d4e3de315be76..760a5814d4a446ffc49d07cdd2fd5fa6bb7bae93 100644 (file)
@@ -664,11 +664,6 @@ static int wl1271_setup(struct wl1271 *wl)
                return -ENOMEM;
        }
 
-       INIT_WORK(&wl->irq_work, wl1271_irq_work);
-       INIT_WORK(&wl->tx_work, wl1271_tx_work);
-       INIT_WORK(&wl->recovery_work, wl1271_recovery_work);
-       INIT_DELAYED_WORK(&wl->scan_complete_work, wl1271_scan_complete_work);
-
        return 0;
 }
 
@@ -2487,6 +2482,10 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
 
        INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work);
        INIT_DELAYED_WORK(&wl->pspoll_work, wl1271_pspoll_work);
+       INIT_WORK(&wl->irq_work, wl1271_irq_work);
+       INIT_WORK(&wl->tx_work, wl1271_tx_work);
+       INIT_WORK(&wl->recovery_work, wl1271_recovery_work);
+       INIT_DELAYED_WORK(&wl->scan_complete_work, wl1271_scan_complete_work);
        wl->channel = WL1271_DEFAULT_CHANNEL;
        wl->beacon_int = WL1271_DEFAULT_BEACON_INT;
        wl->default_key = 0;