aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43legacy/main.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2007-12-16 13:21:06 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:07:25 -0500
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 aa723effcf22..14087fc20f3a 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,
1995static void b43legacy_chip_exit(struct b43legacy_wldev *dev) 1995static void b43legacy_chip_exit(struct b43legacy_wldev *dev)
1996{ 1996{
1997 b43legacy_radio_turn_off(dev, 1); 1997 b43legacy_radio_turn_off(dev, 1);
1998 b43legacy_leds_exit(dev);
1999 b43legacy_gpio_cleanup(dev); 1998 b43legacy_gpio_cleanup(dev);
2000 /* firmware is released later */ 1999 /* firmware is released later */
2001} 2000}
@@ -2025,11 +2024,10 @@ static int b43legacy_chip_init(struct b43legacy_wldev *dev)
2025 err = b43legacy_gpio_init(dev); 2024 err = b43legacy_gpio_init(dev);
2026 if (err) 2025 if (err)
2027 goto out; /* firmware is released later */ 2026 goto out; /* firmware is released later */
2028 b43legacy_leds_init(dev);
2029 2027
2030 err = b43legacy_upload_initvals(dev); 2028 err = b43legacy_upload_initvals(dev);
2031 if (err) 2029 if (err)
2032 goto err_leds_exit; 2030 goto err_gpio_clean;
2033 b43legacy_radio_turn_on(dev); 2031 b43legacy_radio_turn_on(dev);
2034 2032
2035 b43legacy_write16(dev, 0x03E6, 0x0000); 2033 b43legacy_write16(dev, 0x03E6, 0x0000);
@@ -2111,8 +2109,7 @@ out:
2111 2109
2112err_radio_off: 2110err_radio_off:
2113 b43legacy_radio_turn_off(dev, 1); 2111 b43legacy_radio_turn_off(dev, 1);
2114err_leds_exit: 2112err_gpio_clean:
2115 b43legacy_leds_exit(dev);
2116 b43legacy_gpio_cleanup(dev); 2113 b43legacy_gpio_cleanup(dev);
2117 goto out; 2114 goto out;
2118} 2115}
@@ -2969,10 +2966,7 @@ static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
2969 cancel_work_sync(&dev->restart_work); 2966 cancel_work_sync(&dev->restart_work);
2970 mutex_lock(&wl->mutex); 2967 mutex_lock(&wl->mutex);
2971 2968
2972 mutex_unlock(&dev->wl->mutex); 2969 b43legacy_leds_exit(dev);
2973 b43legacy_rfkill_exit(dev);
2974 mutex_lock(&dev->wl->mutex);
2975
2976 b43legacy_rng_exit(dev->wl); 2970 b43legacy_rng_exit(dev->wl);
2977 b43legacy_pio_free(dev); 2971 b43legacy_pio_free(dev);
2978 b43legacy_dma_free(dev); 2972 b43legacy_dma_free(dev);
@@ -3138,11 +3132,11 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
3138 memset(wl->mac_addr, 0, ETH_ALEN); 3132 memset(wl->mac_addr, 0, ETH_ALEN);
3139 b43legacy_upload_card_macaddress(dev); 3133 b43legacy_upload_card_macaddress(dev);
3140 b43legacy_security_init(dev); 3134 b43legacy_security_init(dev);
3141 b43legacy_rfkill_init(dev);
3142 b43legacy_rng_init(wl); 3135 b43legacy_rng_init(wl);
3143 3136
3144 b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED); 3137 b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED);
3145 3138
3139 b43legacy_leds_init(dev);
3146out: 3140out:
3147 return err; 3141 return err;
3148 3142
@@ -3231,6 +3225,10 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
3231 int did_init = 0; 3225 int did_init = 0;
3232 int err = 0; 3226 int err = 0;
3233 3227
3228 /* First register RFkill.
3229 * LEDs that are registered later depend on it. */
3230 b43legacy_rfkill_init(dev);
3231
3234 mutex_lock(&wl->mutex); 3232 mutex_lock(&wl->mutex);
3235 3233
3236 if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) { 3234 if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) {
@@ -3260,6 +3258,8 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw)
3260 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); 3258 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3261 struct b43legacy_wldev *dev = wl->current_dev; 3259 struct b43legacy_wldev *dev = wl->current_dev;
3262 3260
3261 b43legacy_rfkill_exit(dev);
3262
3263 mutex_lock(&wl->mutex); 3263 mutex_lock(&wl->mutex);
3264 if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) 3264 if (b43legacy_status(dev) >= B43legacy_STAT_STARTED)
3265 b43legacy_wireless_core_stop(dev); 3265 b43legacy_wireless_core_stop(dev);