From: Michael Buesch <[EMAIL PROTECTED]>
This correctly cancels all workqueues on shutdown.
Signed-off-by: Michael Buesch <[EMAIL PROTECTED]>
Signed-off-by: Larry Finger <larry.finger.lwfinger.net>
---
Index: wireless-dev/drivers/net/wireless/b43legacy/main.c
===================================================================
--- wireless-dev.orig/drivers/net/wireless/b43legacy/main.c
+++ wireless-dev/drivers/net/wireless/b43legacy/main.c
@@ -2275,11 +2275,6 @@ out:
mutex_unlock(&dev->wl->mutex);
}
-static void b43legacy_periodic_tasks_delete(struct b43legacy_wldev *dev)
-{
- cancel_rearming_delayed_work(&dev->periodic_work);
-}
-
static void b43legacy_periodic_tasks_setup(struct b43legacy_wldev *dev)
{
struct delayed_work *work = &dev->periodic_work;
@@ -2774,9 +2769,9 @@ static void b43legacy_wireless_core_stop
b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED);
mutex_unlock(&wl->mutex);
- /* Must unlock as it would otherwise deadlock. No races here. */
- b43legacy_periodic_tasks_delete(dev);
- flush_workqueue(dev->wl->hw->workqueue);
+ /* Must unlock as it would otherwise deadlock. No races here.
+ * Cancel the possibly running self-rearming periodic work. */
+ cancel_delayed_work_sync(&dev->periodic_work);
mutex_lock(&wl->mutex);
ieee80211_stop_queues(wl->hw); /* FIXME this could cause a deadlock */
@@ -3014,13 +3009,22 @@ static void b43legacy_imcfglo_timeouts_w
}
/* Shutdown a wireless core */
+/* Locking: wl->mutex */
static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
{
+ struct b43legacy_wl *wl = dev->wl;
struct b43legacy_phy *phy = &dev->phy;
B43legacy_WARN_ON(b43legacy_status(dev) > B43legacy_STAT_INITIALIZED);
if (b43legacy_status(dev) != B43legacy_STAT_INITIALIZED)
return;
+ b43legacy_set_status(dev, B43legacy_STAT_UNINIT);
+
+ mutex_unlock(&wl->mutex);
+ /* Must unlock as it would otherwise deadlock. No races here.
+ * Cancel possibly pending workqueues. */
+ cancel_work_sync(&dev->restart_work);
+ mutex_lock(&wl->mutex);
b43legacy_rng_exit(dev->wl);
b43legacy_pio_free(dev);
@@ -3034,7 +3038,6 @@ static void b43legacy_wireless_core_exit
phy->lo_control = NULL;
ssb_device_disable(dev->dev, 0);
ssb_bus_may_powerdown(dev->dev->bus);
- b43legacy_set_status(dev, B43legacy_STAT_UNINIT);
}
static void prepare_phy_data_for_init(struct b43legacy_wldev *dev)
@@ -3711,6 +3714,9 @@ static void b43legacy_remove(struct ssb_
void b43legacy_controller_restart(struct b43legacy_wldev *dev,
const char *reason)
{
+ /* Must avoid requeueing, if we are in shutdown. */
+ if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED)
+ return;
b43legacyinfo(dev->wl, "Controller RESET (%s) ...\n", reason);
queue_work(dev->wl->hw->workqueue, &dev->restart_work);
}
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev