aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/b43legacy/main.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2007-12-16 19:21:06 +0100
committerDavid S. Miller <davem@davemloft.net>2008-01-28 15:07:25 -0800
commit4ad36d780caf34630d1a4cc39f9bc11017f5b81d (patch)
treee108911eb96f8bf7379bc220a52723e03d8b41ee /drivers/net/wireless/b43legacy/main.c
parentb7c5678f0b1e6c385b0b308a9e8298edf3c91a20 (diff)
b43legacy: Fix rfkill radio LED
This fixes Bug #9414 for b43legacy. This patch is the equivalent of one submitted earlier for b43. Since addition of the rfkill callback, the LED associated with the off switch on the radio has not worked for several reasons: (1) Essential data in the rfkill structure were missing. (2) The rfkill structure was initialized after the LED initialization. (3) There was a minor memory leak if the radio LED structure was inited. Once the above problems were fixed, additional difficulties were noted: (4) The radio LED was in the wrong state at startup. (5) The radio switch had to be manipulated twice for each state change. (6) A circular mutex locking situation existed. (7) If rfkill-input is built as a module, it is not automatically loaded. This patch fixes all of the above and removes a couple of sparse warnings. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43legacy/main.c')
-rw-r--r--drivers/net/wireless/b43legacy/main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index aa723effcf2..14087fc20f3 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1995,7 +1995,6 @@ static void b43legacy_mgmtframe_txantenna(struct b43legacy_wldev *dev,
static void b43legacy_chip_exit(struct b43legacy_wldev *dev)
{
b43legacy_radio_turn_off(dev, 1);
- b43legacy_leds_exit(dev);
b43legacy_gpio_cleanup(dev);
/* firmware is released later */
}
@@ -2025,11 +2024,10 @@ static int b43legacy_chip_init(struct b43legacy_wldev *dev)
err = b43legacy_gpio_init(dev);
if (err)
goto out; /* firmware is released later */
- b43legacy_leds_init(dev);
err = b43legacy_upload_initvals(dev);
if (err)
- goto err_leds_exit;
+ goto err_gpio_clean;
b43legacy_radio_turn_on(dev);
b43legacy_write16(dev, 0x03E6, 0x0000);
@@ -2111,8 +2109,7 @@ out:
err_radio_off:
b43legacy_radio_turn_off(dev, 1);
-err_leds_exit:
- b43legacy_leds_exit(dev);
+err_gpio_clean:
b43legacy_gpio_cleanup(dev);
goto out;
}
@@ -2969,10 +2966,7 @@ static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
cancel_work_sync(&dev->restart_work);
mutex_lock(&wl->mutex);
- mutex_unlock(&dev->wl->mutex);
- b43legacy_rfkill_exit(dev);
- mutex_lock(&dev->wl->mutex);
-
+ b43legacy_leds_exit(dev);
b43legacy_rng_exit(dev->wl);
b43legacy_pio_free(dev);
b43legacy_dma_free(dev);
@@ -3138,11 +3132,11 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
memset(wl->mac_addr, 0, ETH_ALEN);
b43legacy_upload_card_macaddress(dev);
b43legacy_security_init(dev);
- b43legacy_rfkill_init(dev);
b43legacy_rng_init(wl);
b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED);
+ b43legacy_leds_init(dev);
out:
return err;
@@ -3231,6 +3225,10 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
int did_init = 0;
int err = 0;
+ /* First register RFkill.
+ * LEDs that are registered later depend on it. */
+ b43legacy_rfkill_init(dev);
+
mutex_lock(&wl->mutex);
if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) {
@@ -3260,6 +3258,8 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw)
struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
struct b43legacy_wldev *dev = wl->current_dev;
+ b43legacy_rfkill_exit(dev);
+
mutex_lock(&wl->mutex);
if (b43legacy_status(dev) >= B43legacy_STAT_STARTED)
b43legacy_wireless_core_stop(dev);