aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorStefano Brivio <stefano.brivio@polimi.it>2007-11-07 12:16:11 -0500
committerJeff Garzik <jeff@garzik.org>2007-11-10 04:25:13 -0500
commita19d12d742903c745890c1374d64092595571e40 (patch)
treed256cf41525d6bc10923ec87eb15a75f4be84264 /drivers/net/wireless/b43
parent2817ef1a5d9010873692f8353f6320ebecf9b837 (diff)
b43: fix shared IRQ race condition
Fix an IRQ race condition in b43. If we call b43_stop_wireless_core(), it will set the status of the device to INITIALIZED and the IRQ handler won't care any longer about IRQs, thus the kernel will disable the IRQ if it's shared (unless we boot it with the 'irqpoll' option). So we must disable IRQs before changing the device status. Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r--drivers/net/wireless/b43/main.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index c9778c6cf2e8..2b17c1dc46f1 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2985,6 +2985,16 @@ static void b43_wireless_core_stop(struct b43_wldev *dev)
2985 2985
2986 if (b43_status(dev) < B43_STAT_STARTED) 2986 if (b43_status(dev) < B43_STAT_STARTED)
2987 return; 2987 return;
2988
2989 /* Disable and sync interrupts. We must do this before than
2990 * setting the status to INITIALIZED, as the interrupt handler
2991 * won't care about IRQs then. */
2992 spin_lock_irqsave(&wl->irq_lock, flags);
2993 dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL);
2994 b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* flush */
2995 spin_unlock_irqrestore(&wl->irq_lock, flags);
2996 b43_synchronize_irq(dev);
2997
2988 b43_set_status(dev, B43_STAT_INITIALIZED); 2998 b43_set_status(dev, B43_STAT_INITIALIZED);
2989 2999
2990 mutex_unlock(&wl->mutex); 3000 mutex_unlock(&wl->mutex);
@@ -2995,13 +3005,6 @@ static void b43_wireless_core_stop(struct b43_wldev *dev)
2995 3005
2996 ieee80211_stop_queues(wl->hw); //FIXME this could cause a deadlock, as mac80211 seems buggy. 3006 ieee80211_stop_queues(wl->hw); //FIXME this could cause a deadlock, as mac80211 seems buggy.
2997 3007
2998 /* Disable and sync interrupts. */
2999 spin_lock_irqsave(&wl->irq_lock, flags);
3000 dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL);
3001 b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* flush */
3002 spin_unlock_irqrestore(&wl->irq_lock, flags);
3003 b43_synchronize_irq(dev);
3004
3005 b43_mac_suspend(dev); 3008 b43_mac_suspend(dev);
3006 free_irq(dev->dev->irq, dev); 3009 free_irq(dev->dev->irq, dev);
3007 b43dbg(wl, "Wireless interface stopped\n"); 3010 b43dbg(wl, "Wireless interface stopped\n");