diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-12-18 16:13:39 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-19 15:23:56 -0500 |
commit | d10d0e5707fb7b8afa7e68a14d69e752604ee294 (patch) | |
tree | 796e53908137310e3467e2c15703304857fab506 /drivers/net/wireless/b43/main.c | |
parent | 0e7690f1e9ee1e762f27678d2ea10e4c1fde3236 (diff) |
b43: Fix some MAC locking
This fixes some locking w.r.t. the lower MAC (firmware).
It also removes a lot of ancient IRQ-locking that's not needed anymore.
We simply suspend the MAC. That's easier and causes less trouble.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r-- | drivers/net/wireless/b43/main.c | 50 |
1 files changed, 8 insertions, 42 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index ba7a5ab7fe1d..07dc9886d968 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3324,7 +3324,6 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3324 | unsigned long flags; | 3324 | unsigned long flags; |
3325 | int antenna; | 3325 | int antenna; |
3326 | int err = 0; | 3326 | int err = 0; |
3327 | u32 savedirqs; | ||
3328 | 3327 | ||
3329 | mutex_lock(&wl->mutex); | 3328 | mutex_lock(&wl->mutex); |
3330 | 3329 | ||
@@ -3335,24 +3334,14 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3335 | dev = wl->current_dev; | 3334 | dev = wl->current_dev; |
3336 | phy = &dev->phy; | 3335 | phy = &dev->phy; |
3337 | 3336 | ||
3337 | b43_mac_suspend(dev); | ||
3338 | |||
3338 | if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) | 3339 | if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) |
3339 | b43_set_retry_limits(dev, conf->short_frame_max_tx_count, | 3340 | b43_set_retry_limits(dev, conf->short_frame_max_tx_count, |
3340 | conf->long_frame_max_tx_count); | 3341 | conf->long_frame_max_tx_count); |
3341 | changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS; | 3342 | changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS; |
3342 | if (!changed) | 3343 | if (!changed) |
3343 | goto out_unlock_mutex; | 3344 | goto out_mac_enable; |
3344 | |||
3345 | /* Disable IRQs while reconfiguring the device. | ||
3346 | * This makes it possible to drop the spinlock throughout | ||
3347 | * the reconfiguration process. */ | ||
3348 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
3349 | if (b43_status(dev) < B43_STAT_STARTED) { | ||
3350 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
3351 | goto out_unlock_mutex; | ||
3352 | } | ||
3353 | savedirqs = b43_interrupt_disable(dev, B43_IRQ_ALL); | ||
3354 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
3355 | b43_synchronize_irq(dev); | ||
3356 | 3345 | ||
3357 | /* Switch to the requested channel. | 3346 | /* Switch to the requested channel. |
3358 | * The firmware takes care of races with the TX handler. */ | 3347 | * The firmware takes care of races with the TX handler. */ |
@@ -3399,11 +3388,9 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3399 | } | 3388 | } |
3400 | } | 3389 | } |
3401 | 3390 | ||
3402 | spin_lock_irqsave(&wl->irq_lock, flags); | 3391 | out_mac_enable: |
3403 | b43_interrupt_enable(dev, savedirqs); | 3392 | b43_mac_enable(dev); |
3404 | mmiowb(); | 3393 | out_unlock_mutex: |
3405 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
3406 | out_unlock_mutex: | ||
3407 | mutex_unlock(&wl->mutex); | 3394 | mutex_unlock(&wl->mutex); |
3408 | 3395 | ||
3409 | return err; | 3396 | return err; |
@@ -3461,27 +3448,12 @@ static void b43_op_bss_info_changed(struct ieee80211_hw *hw, | |||
3461 | { | 3448 | { |
3462 | struct b43_wl *wl = hw_to_b43_wl(hw); | 3449 | struct b43_wl *wl = hw_to_b43_wl(hw); |
3463 | struct b43_wldev *dev; | 3450 | struct b43_wldev *dev; |
3464 | struct b43_phy *phy; | ||
3465 | unsigned long flags; | ||
3466 | u32 savedirqs; | ||
3467 | 3451 | ||
3468 | mutex_lock(&wl->mutex); | 3452 | mutex_lock(&wl->mutex); |
3469 | 3453 | ||
3470 | dev = wl->current_dev; | 3454 | dev = wl->current_dev; |
3471 | phy = &dev->phy; | 3455 | if (!dev || b43_status(dev) < B43_STAT_STARTED) |
3472 | |||
3473 | /* Disable IRQs while reconfiguring the device. | ||
3474 | * This makes it possible to drop the spinlock throughout | ||
3475 | * the reconfiguration process. */ | ||
3476 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
3477 | if (b43_status(dev) < B43_STAT_STARTED) { | ||
3478 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
3479 | goto out_unlock_mutex; | 3456 | goto out_unlock_mutex; |
3480 | } | ||
3481 | savedirqs = b43_interrupt_disable(dev, B43_IRQ_ALL); | ||
3482 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
3483 | b43_synchronize_irq(dev); | ||
3484 | |||
3485 | b43_mac_suspend(dev); | 3457 | b43_mac_suspend(dev); |
3486 | 3458 | ||
3487 | if (changed & BSS_CHANGED_BASIC_RATES) | 3459 | if (changed & BSS_CHANGED_BASIC_RATES) |
@@ -3495,13 +3467,7 @@ static void b43_op_bss_info_changed(struct ieee80211_hw *hw, | |||
3495 | } | 3467 | } |
3496 | 3468 | ||
3497 | b43_mac_enable(dev); | 3469 | b43_mac_enable(dev); |
3498 | 3470 | out_unlock_mutex: | |
3499 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
3500 | b43_interrupt_enable(dev, savedirqs); | ||
3501 | /* XXX: why? */ | ||
3502 | mmiowb(); | ||
3503 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
3504 | out_unlock_mutex: | ||
3505 | mutex_unlock(&wl->mutex); | 3471 | mutex_unlock(&wl->mutex); |
3506 | 3472 | ||
3507 | return; | 3473 | return; |