This patch fixes a problem with work queues during shutdown. The bug
seems to be responsible for the boot-time crashes reported in
http://bugzilla.kernel.org/show_bug.cgi?id=8937.
Signed-off-by: Larry Finger <[EMAIL PROTECTED]>
---
Index: linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ linux-2.6/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -3197,6 +3197,9 @@ static void bcm43xx_periodic_work_handle
unsigned long orig_trans_start = 0;
mutex_lock(&bcm->mutex);
+ /* keep from doing and rearming periodic work if shutting down */
+ if (bcm43xx_status(bcm) == BCM43xx_STAT_UNINIT)
+ goto unlock_mutex;
if (unlikely(bcm->periodic_state % 60 == 0)) {
/* Periodic work will take a long time, so we want it to
* be preemtible.
@@ -3242,6 +3245,7 @@ static void bcm43xx_periodic_work_handle
mmiowb();
bcm->periodic_state++;
spin_unlock_irqrestore(&bcm->irq_lock, flags);
+unlock_mutex:
mutex_unlock(&bcm->mutex);
}
@@ -3338,6 +3342,14 @@ static void bcm43xx_free_board(struct bc
bcm43xx_periodic_tasks_delete(bcm);
mutex_lock(&(bcm)->mutex);
+ bcm43xx_set_status(bcm, BCM43xx_STAT_UNINIT);
+ mutex_unlock(&(bcm)->mutex);
+
+ /* next 2 steps must be unlocked, else they may deadlock */
+ cancel_work_sync(&bcm->restart_work);
+ cancel_delayed_work_sync(&bcm->periodic_work);
+
+ mutex_lock(&(bcm)->mutex);
bcm43xx_shutdown_all_wireless_cores(bcm);
bcm43xx_pctl_set_crystal(bcm, 0);
mutex_unlock(&(bcm)->mutex);
@@ -4030,7 +4042,6 @@ static int bcm43xx_net_stop(struct net_d
err = bcm43xx_disable_interrupts_sync(bcm);
assert(!err);
bcm43xx_free_board(bcm);
- flush_scheduled_work();
return 0;
}
@@ -4165,6 +4176,7 @@ static void bcm43xx_chip_reset(struct wo
mutex_lock(&(bcm)->mutex);
if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
bcm43xx_periodic_tasks_delete(bcm);
+ bcm43xx_set_status(bcm, BCM43xx_STAT_UNINIT);
phy = bcm43xx_current_phy(bcm);
err = bcm43xx_select_wireless_core(bcm, phy->type);
if (!err)
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev