Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[B43]: LED triggers support

Drive the LEDs through the generic LED triggers.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Larry Finger <larry.finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Michael Buesch and committed by
David S. Miller
21954c36 20405c08

+230 -296
+6
drivers/net/wireless/b43/Kconfig
··· 61 61 62 62 If unsure, say N. 63 63 64 + # LED support 65 + config B43_LEDS 66 + bool 67 + depends on MAC80211_LEDS 68 + default y 69 + 64 70 config B43_DEBUG 65 71 bool "Broadcom 43xx debugging" 66 72 depends on B43
+2 -1
drivers/net/wireless/b43/Makefile
··· 3 3 b43-y += tables.o 4 4 b43-y += phy.o 5 5 b43-y += sysfs.o 6 - b43-y += leds.o 7 6 b43-y += xmit.o 8 7 b43-y += lo.o 8 + # b43 LED support 9 + b43-$(CONFIG_B43_LEDS) += leds.o 9 10 # b43 PCMCIA support 10 11 b43-$(CONFIG_B43_PCMCIA) += pcmcia.o 11 12 # b43 debugging
+4 -2
drivers/net/wireless/b43/b43.h
··· 696 696 /* Various statistics about the physical device. */ 697 697 struct b43_stats stats; 698 698 699 - #define B43_NR_LEDS 4 700 - struct b43_led leds[B43_NR_LEDS]; 699 + /* The device LEDs. */ 700 + struct b43_led led_tx; 701 + struct b43_led led_rx; 702 + struct b43_led led_assoc; 701 703 702 704 /* Reason code of the last interrupt. */ 703 705 u32 irq_reason;
+165 -232
drivers/net/wireless/b43/leds.c
··· 1 1 /* 2 2 3 3 Broadcom B43 wireless driver 4 + LED control 4 5 5 6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 6 - Stefano Brivio <st3@riseup.net> 7 - Michael Buesch <mb@bu3sch.de> 8 - Danny van Dyk <kugelfang@gentoo.org> 9 - Andreas Jaggi <andreas.jaggi@waterwave.ch> 7 + Copyright (c) 2005 Stefano Brivio <st3@riseup.net> 8 + Copyright (c) 2005-2007 Michael Buesch <mb@bu3sch.de> 9 + Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 10 + Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 10 11 11 12 This program is free software; you can redistribute it and/or modify 12 13 it under the terms of the GNU General Public License as published by ··· 28 27 29 28 #include "b43.h" 30 29 #include "leds.h" 31 - #include "main.h" 32 30 33 - static void b43_led_changestate(struct b43_led *led) 31 + 32 + static void b43_led_turn_on(struct b43_wldev *dev, u8 led_index, 33 + bool activelow) 34 34 { 35 - struct b43_wldev *dev = led->dev; 36 - const int index = led->index; 37 - u16 ledctl; 38 - 39 - B43_WARN_ON(!(index >= 0 && index < B43_NR_LEDS)); 40 - B43_WARN_ON(!led->blink_interval); 41 - ledctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); 42 - ledctl ^= (1 << index); 43 - b43_write16(dev, B43_MMIO_GPIO_CONTROL, ledctl); 44 - } 45 - 46 - static void b43_led_blink(unsigned long d) 47 - { 48 - struct b43_led *led = (struct b43_led *)d; 49 - struct b43_wldev *dev = led->dev; 35 + struct b43_wl *wl = dev->wl; 50 36 unsigned long flags; 37 + u16 ctl; 51 38 52 - spin_lock_irqsave(&dev->wl->leds_lock, flags); 53 - if (led->blink_interval) { 54 - b43_led_changestate(led); 55 - mod_timer(&led->blink_timer, jiffies + led->blink_interval); 56 - } 57 - spin_unlock_irqrestore(&dev->wl->leds_lock, flags); 39 + spin_lock_irqsave(&wl->leds_lock, flags); 40 + ctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); 41 + if (activelow) 42 + ctl &= ~(1 << led_index); 43 + else 44 + ctl |= (1 << led_index); 45 + b43_write16(dev, B43_MMIO_GPIO_CONTROL, ctl); 46 + spin_unlock_irqrestore(&wl->leds_lock, flags); 58 47 } 59 48 60 - static void b43_led_blink_start(struct b43_led *led, unsigned long interval) 49 + static void b43_led_turn_off(struct b43_wldev *dev, u8 led_index, 50 + bool activelow) 61 51 { 62 - if (led->blink_interval) 63 - return; 64 - led->blink_interval = interval; 65 - b43_led_changestate(led); 66 - led->blink_timer.expires = jiffies + interval; 67 - add_timer(&led->blink_timer); 52 + struct b43_wl *wl = dev->wl; 53 + unsigned long flags; 54 + u16 ctl; 55 + 56 + spin_lock_irqsave(&wl->leds_lock, flags); 57 + ctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); 58 + if (activelow) 59 + ctl |= (1 << led_index); 60 + else 61 + ctl &= ~(1 << led_index); 62 + b43_write16(dev, B43_MMIO_GPIO_CONTROL, ctl); 63 + spin_unlock_irqrestore(&wl->leds_lock, flags); 68 64 } 69 65 70 - static void b43_led_blink_stop(struct b43_led *led, int sync) 66 + /* Callback from the LED subsystem. */ 67 + static void b43_led_brightness_set(struct led_classdev *led_dev, 68 + enum led_brightness brightness) 71 69 { 70 + struct b43_led *led = container_of(led_dev, struct b43_led, led_dev); 72 71 struct b43_wldev *dev = led->dev; 73 - const int index = led->index; 74 - u16 ledctl; 72 + bool radio_enabled; 75 73 76 - if (!led->blink_interval) 77 - return; 78 - if (unlikely(sync)) 79 - del_timer_sync(&led->blink_timer); 80 - else 81 - del_timer(&led->blink_timer); 82 - led->blink_interval = 0; 74 + /* Checking the radio-enabled status here is slightly racy, 75 + * but we want to avoid the locking overhead and we don't care 76 + * whether the LED has the wrong state for a second. */ 77 + radio_enabled = (dev->phy.radio_on && dev->radio_hw_enable); 83 78 84 - /* Make sure the LED is turned off. */ 85 - B43_WARN_ON(!(index >= 0 && index < B43_NR_LEDS)); 86 - ledctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); 87 - if (led->activelow) 88 - ledctl |= (1 << index); 79 + if (brightness == LED_OFF || !radio_enabled) 80 + b43_led_turn_off(dev, led->index, led->activelow); 89 81 else 90 - ledctl &= ~(1 << index); 91 - b43_write16(dev, B43_MMIO_GPIO_CONTROL, ledctl); 82 + b43_led_turn_on(dev, led->index, led->activelow); 92 83 } 93 84 94 - static void b43_led_init_hardcoded(struct b43_wldev *dev, 95 - struct b43_led *led, int led_index) 85 + static int b43_register_led(struct b43_wldev *dev, struct b43_led *led, 86 + const char *name, char *default_trigger, 87 + u8 led_index, bool activelow) 96 88 { 97 - struct ssb_bus *bus = dev->dev->bus; 89 + int err; 98 90 99 - /* This function is called, if the behaviour (and activelow) 100 - * information for a LED is missing in the SPROM. 101 - * We hardcode the behaviour values for various devices here. 102 - * Note that the B43_LED_TEST_XXX behaviour values can 103 - * be used to figure out which led is mapped to which index. 104 - */ 91 + b43_led_turn_off(dev, led_index, activelow); 92 + if (led->dev) 93 + return -EEXIST; 94 + if (!default_trigger) 95 + return -EINVAL; 96 + led->dev = dev; 97 + led->index = led_index; 98 + led->activelow = activelow; 99 + strncpy(led->name, name, sizeof(led->name)); 105 100 106 - switch (led_index) { 107 - case 0: 108 - led->behaviour = B43_LED_ACTIVITY; 109 - led->activelow = 1; 110 - if (bus->boardinfo.vendor == PCI_VENDOR_ID_COMPAQ) 111 - led->behaviour = B43_LED_RADIO_ALL; 101 + led->led_dev.name = led->name; 102 + led->led_dev.default_trigger = default_trigger; 103 + led->led_dev.brightness_set = b43_led_brightness_set; 104 + 105 + err = led_classdev_register(dev->dev->dev, &led->led_dev); 106 + if (err) { 107 + b43warn(dev->wl, "LEDs: Failed to register %s\n", name); 108 + led->dev = NULL; 109 + return err; 110 + } 111 + return 0; 112 + } 113 + 114 + static void b43_unregister_led(struct b43_led *led) 115 + { 116 + if (!led->dev) 117 + return; 118 + led_classdev_unregister(&led->led_dev); 119 + b43_led_turn_off(led->dev, led->index, led->activelow); 120 + led->dev = NULL; 121 + } 122 + 123 + static void b43_map_led(struct b43_wldev *dev, 124 + u8 led_index, 125 + enum b43_led_behaviour behaviour, 126 + bool activelow) 127 + { 128 + struct ieee80211_hw *hw = dev->wl->hw; 129 + char name[B43_LED_MAX_NAME_LEN + 1]; 130 + 131 + /* Map the b43 specific LED behaviour value to the 132 + * generic LED triggers. */ 133 + switch (behaviour) { 134 + case B43_LED_INACTIVE: 112 135 break; 113 - case 1: 114 - led->behaviour = B43_LED_RADIO_B; 115 - if (bus->boardinfo.vendor == PCI_VENDOR_ID_ASUSTEK) 116 - led->behaviour = B43_LED_ASSOC; 136 + case B43_LED_OFF: 137 + b43_led_turn_off(dev, led_index, activelow); 117 138 break; 118 - case 2: 119 - led->behaviour = B43_LED_RADIO_A; 139 + case B43_LED_ON: 140 + b43_led_turn_on(dev, led_index, activelow); 120 141 break; 121 - case 3: 122 - led->behaviour = B43_LED_OFF; 142 + case B43_LED_ACTIVITY: 143 + case B43_LED_TRANSFER: 144 + case B43_LED_APTRANSFER: 145 + snprintf(name, sizeof(name), 146 + "b43-%s:tx", wiphy_name(hw->wiphy)); 147 + b43_register_led(dev, &dev->led_tx, name, 148 + ieee80211_get_tx_led_name(hw), 149 + led_index, activelow); 150 + snprintf(name, sizeof(name), 151 + "b43-%s:rx", wiphy_name(hw->wiphy)); 152 + b43_register_led(dev, &dev->led_rx, name, 153 + ieee80211_get_rx_led_name(hw), 154 + led_index, activelow); 155 + break; 156 + /*FIXME: We need another trigger for the "radio-on" LEDs below. 157 + * Wiggle that somehow into the rfkill subsystem. */ 158 + case B43_LED_RADIO_ALL: 159 + case B43_LED_RADIO_A: 160 + case B43_LED_RADIO_B: 161 + case B43_LED_MODE_BG: 162 + case B43_LED_WEIRD: 163 + case B43_LED_ASSOC: 164 + snprintf(name, sizeof(name), 165 + "b43-%s:assoc", wiphy_name(hw->wiphy)); 166 + b43_register_led(dev, &dev->led_assoc, name, 167 + ieee80211_get_assoc_led_name(hw), 168 + led_index, activelow); 123 169 break; 124 170 default: 125 - B43_WARN_ON(1); 171 + b43warn(dev->wl, "LEDs: Unknown behaviour 0x%02X\n", 172 + behaviour); 173 + break; 126 174 } 127 175 } 128 176 129 - int b43_leds_init(struct b43_wldev *dev) 177 + void b43_leds_init(struct b43_wldev *dev) 130 178 { 131 - struct b43_led *led; 179 + struct ssb_bus *bus = dev->dev->bus; 132 180 u8 sprom[4]; 133 181 int i; 182 + enum b43_led_behaviour behaviour; 183 + bool activelow; 134 184 135 - sprom[0] = dev->dev->bus->sprom.r1.gpio0; 136 - sprom[1] = dev->dev->bus->sprom.r1.gpio1; 137 - sprom[2] = dev->dev->bus->sprom.r1.gpio2; 138 - sprom[3] = dev->dev->bus->sprom.r1.gpio3; 185 + sprom[0] = bus->sprom.r1.gpio0; 186 + sprom[1] = bus->sprom.r1.gpio1; 187 + sprom[2] = bus->sprom.r1.gpio2; 188 + sprom[3] = bus->sprom.r1.gpio3; 139 189 140 - for (i = 0; i < B43_NR_LEDS; i++) { 141 - led = &(dev->leds[i]); 142 - led->index = i; 143 - led->dev = dev; 144 - setup_timer(&led->blink_timer, 145 - b43_led_blink, (unsigned long)led); 146 - 190 + for (i = 0; i < 4; i++) { 147 191 if (sprom[i] == 0xFF) { 148 - b43_led_init_hardcoded(dev, led, i); 192 + /* There is no LED information in the SPROM 193 + * for this LED. Hardcode it here. */ 194 + activelow = 0; 195 + switch (i) { 196 + case 0: 197 + behaviour = B43_LED_ACTIVITY; 198 + activelow = 1; 199 + if (bus->boardinfo.vendor == PCI_VENDOR_ID_COMPAQ) 200 + behaviour = B43_LED_RADIO_ALL; 201 + break; 202 + case 1: 203 + behaviour = B43_LED_RADIO_B; 204 + if (bus->boardinfo.vendor == PCI_VENDOR_ID_ASUSTEK) 205 + behaviour = B43_LED_ASSOC; 206 + break; 207 + case 2: 208 + behaviour = B43_LED_RADIO_A; 209 + break; 210 + case 3: 211 + behaviour = B43_LED_OFF; 212 + break; 213 + default: 214 + B43_WARN_ON(1); 215 + return; 216 + } 149 217 } else { 150 - led->behaviour = sprom[i] & B43_LED_BEHAVIOUR; 151 - led->activelow = !!(sprom[i] & B43_LED_ACTIVELOW); 218 + behaviour = sprom[i] & B43_LED_BEHAVIOUR; 219 + activelow = !!(sprom[i] & B43_LED_ACTIVELOW); 152 220 } 221 + b43_map_led(dev, i, behaviour, activelow); 153 222 } 154 - 155 - return 0; 156 223 } 157 224 158 225 void b43_leds_exit(struct b43_wldev *dev) 159 226 { 160 - struct b43_led *led; 161 - int i; 162 - 163 - for (i = 0; i < B43_NR_LEDS; i++) { 164 - led = &(dev->leds[i]); 165 - b43_led_blink_stop(led, 1); 166 - } 167 - b43_leds_switch_all(dev, 0); 168 - } 169 - 170 - void b43_leds_update(struct b43_wldev *dev, int activity) 171 - { 172 - struct b43_led *led; 173 - struct b43_phy *phy = &dev->phy; 174 - const int transferring = 175 - (jiffies - dev->stats.last_tx) < B43_LED_XFER_THRES; 176 - int i, turn_on; 177 - unsigned long interval = 0; 178 - u16 ledctl; 179 - unsigned long flags; 180 - bool radio_enabled = (phy->radio_on && dev->radio_hw_enable); 181 - 182 - spin_lock_irqsave(&dev->wl->leds_lock, flags); 183 - ledctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); 184 - for (i = 0; i < B43_NR_LEDS; i++) { 185 - led = &(dev->leds[i]); 186 - 187 - turn_on = 0; 188 - switch (led->behaviour) { 189 - case B43_LED_INACTIVE: 190 - continue; 191 - case B43_LED_OFF: 192 - break; 193 - case B43_LED_ON: 194 - turn_on = 1; 195 - break; 196 - case B43_LED_ACTIVITY: 197 - turn_on = activity; 198 - break; 199 - case B43_LED_RADIO_ALL: 200 - turn_on = radio_enabled; 201 - break; 202 - case B43_LED_RADIO_A: 203 - turn_on = (radio_enabled && phy->type == B43_PHYTYPE_A); 204 - break; 205 - case B43_LED_RADIO_B: 206 - turn_on = (radio_enabled && 207 - (phy->type == B43_PHYTYPE_B 208 - || phy->type == B43_PHYTYPE_G)); 209 - break; 210 - case B43_LED_MODE_BG: 211 - if (phy->type == B43_PHYTYPE_G 212 - && radio_enabled) 213 - turn_on = 1; 214 - break; 215 - case B43_LED_TRANSFER: 216 - if (transferring) 217 - b43_led_blink_start(led, B43_LEDBLINK_MEDIUM); 218 - else 219 - b43_led_blink_stop(led, 0); 220 - continue; 221 - case B43_LED_APTRANSFER: 222 - if (b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) { 223 - if (transferring) { 224 - interval = B43_LEDBLINK_FAST; 225 - turn_on = 1; 226 - } 227 - } else { 228 - turn_on = 1; 229 - if (0 /*TODO: not assoc */ ) 230 - interval = B43_LEDBLINK_SLOW; 231 - else if (transferring) 232 - interval = B43_LEDBLINK_FAST; 233 - else 234 - turn_on = 0; 235 - } 236 - if (turn_on) 237 - b43_led_blink_start(led, interval); 238 - else 239 - b43_led_blink_stop(led, 0); 240 - continue; 241 - case B43_LED_WEIRD: 242 - //TODO 243 - break; 244 - case B43_LED_ASSOC: 245 - if (1 /*dev->softmac->associated */ ) 246 - turn_on = 1; 247 - break; 248 - #ifdef CONFIG_B43_DEBUG 249 - case B43_LED_TEST_BLINKSLOW: 250 - b43_led_blink_start(led, B43_LEDBLINK_SLOW); 251 - continue; 252 - case B43_LED_TEST_BLINKMEDIUM: 253 - b43_led_blink_start(led, B43_LEDBLINK_MEDIUM); 254 - continue; 255 - case B43_LED_TEST_BLINKFAST: 256 - b43_led_blink_start(led, B43_LEDBLINK_FAST); 257 - continue; 258 - #endif /* CONFIG_B43_DEBUG */ 259 - default: 260 - B43_WARN_ON(1); 261 - }; 262 - 263 - if (led->activelow) 264 - turn_on = !turn_on; 265 - if (turn_on) 266 - ledctl |= (1 << i); 267 - else 268 - ledctl &= ~(1 << i); 269 - } 270 - b43_write16(dev, B43_MMIO_GPIO_CONTROL, ledctl); 271 - spin_unlock_irqrestore(&dev->wl->leds_lock, flags); 272 - } 273 - 274 - void b43_leds_switch_all(struct b43_wldev *dev, int on) 275 - { 276 - struct b43_led *led; 277 - u16 ledctl; 278 - int i; 279 - int bit_on; 280 - unsigned long flags; 281 - 282 - spin_lock_irqsave(&dev->wl->leds_lock, flags); 283 - ledctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); 284 - for (i = 0; i < B43_NR_LEDS; i++) { 285 - led = &(dev->leds[i]); 286 - if (led->behaviour == B43_LED_INACTIVE) 287 - continue; 288 - if (on) 289 - bit_on = led->activelow ? 0 : 1; 290 - else 291 - bit_on = led->activelow ? 1 : 0; 292 - if (bit_on) 293 - ledctl |= (1 << i); 294 - else 295 - ledctl &= ~(1 << i); 296 - } 297 - b43_write16(dev, B43_MMIO_GPIO_CONTROL, ledctl); 298 - spin_unlock_irqrestore(&dev->wl->leds_lock, flags); 227 + b43_unregister_led(&dev->led_tx); 228 + b43_unregister_led(&dev->led_rx); 229 + b43_unregister_led(&dev->led_assoc); 299 230 }
+36 -27
drivers/net/wireless/b43/leds.h
··· 1 1 #ifndef B43_LEDS_H_ 2 2 #define B43_LEDS_H_ 3 3 4 + struct b43_wldev; 5 + 6 + #ifdef CONFIG_B43_LEDS 7 + 4 8 #include <linux/types.h> 5 - #include <linux/timer.h> 9 + #include <linux/leds.h> 10 + 11 + 12 + #define B43_LED_MAX_NAME_LEN 31 6 13 7 14 struct b43_led { 8 - u8 behaviour; 9 - bool activelow; 10 - /* Index in the "leds" array in b43_wldev */ 11 - u8 index; 12 15 struct b43_wldev *dev; 13 - struct timer_list blink_timer; 14 - unsigned long blink_interval; 16 + /* The LED class device */ 17 + struct led_classdev led_dev; 18 + /* The index number of the LED. */ 19 + u8 index; 20 + /* If activelow is true, the LED is ON if the 21 + * bit is switched off. */ 22 + bool activelow; 23 + /* The unique name string for this LED device. */ 24 + char name[B43_LED_MAX_NAME_LEN + 1]; 15 25 }; 16 - 17 - /* Delay between state changes when blinking in jiffies */ 18 - #define B43_LEDBLINK_SLOW (HZ / 1) 19 - #define B43_LEDBLINK_MEDIUM (HZ / 4) 20 - #define B43_LEDBLINK_FAST (HZ / 8) 21 - 22 - #define B43_LED_XFER_THRES (HZ / 100) 23 26 24 27 #define B43_LED_BEHAVIOUR 0x7F 25 28 #define B43_LED_ACTIVELOW 0x80 26 - enum { /* LED behaviour values */ 29 + /* LED behaviour values */ 30 + enum b43_led_behaviour { 27 31 B43_LED_OFF, 28 32 B43_LED_ON, 29 33 B43_LED_ACTIVITY, ··· 40 36 B43_LED_WEIRD, //FIXME 41 37 B43_LED_ASSOC, 42 38 B43_LED_INACTIVE, 43 - 44 - /* Behaviour values for testing. 45 - * With these values it is easier to figure out 46 - * the real behaviour of leds, in case the SPROM 47 - * is missing information. 48 - */ 49 - B43_LED_TEST_BLINKSLOW, 50 - B43_LED_TEST_BLINKMEDIUM, 51 - B43_LED_TEST_BLINKFAST, 52 39 }; 53 40 54 - int b43_leds_init(struct b43_wldev *dev); 41 + void b43_leds_init(struct b43_wldev *dev); 55 42 void b43_leds_exit(struct b43_wldev *dev); 56 - void b43_leds_update(struct b43_wldev *dev, int activity); 57 - void b43_leds_switch_all(struct b43_wldev *dev, int on); 43 + 44 + 45 + #else /* CONFIG_B43_LEDS */ 46 + /* LED support disabled */ 47 + 48 + struct b43_led { 49 + /* empty */ 50 + }; 51 + 52 + static inline void b43_leds_init(struct b43_wldev *dev) 53 + { 54 + } 55 + static inline void b43_leds_exit(struct b43_wldev *dev) 56 + { 57 + } 58 + #endif /* CONFIG_B43_LEDS */ 58 59 59 60 #endif /* B43_LEDS_H_ */
+17 -34
drivers/net/wireless/b43/main.c
··· 84 84 module_param_named(long_retry, modparam_long_retry, int, 0444); 85 85 MODULE_PARM_DESC(long_retry, "Long-Retry-Limit (0 - 15)"); 86 86 87 - static int modparam_noleds; 88 - module_param_named(noleds, modparam_noleds, int, 0444); 89 - MODULE_PARM_DESC(noleds, "Turn off all LED activity"); 90 - 91 87 static char modparam_fwpostfix[16]; 92 88 module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); 93 89 MODULE_PARM_DESC(fwpostfix, "Postfix for the .fw files to load."); ··· 1387 1391 u32 reason; 1388 1392 u32 dma_reason[ARRAY_SIZE(dev->dma_reason)]; 1389 1393 u32 merged_dma_reason = 0; 1390 - int i, activity = 0; 1394 + int i; 1391 1395 unsigned long flags; 1392 1396 1393 1397 spin_lock_irqsave(&dev->wl->irq_lock, flags); ··· 1440 1444 handle_irq_beacon(dev); 1441 1445 if (reason & B43_IRQ_PMQ) 1442 1446 handle_irq_pmq(dev); 1443 - if (reason & B43_IRQ_TXFIFO_FLUSH_OK) ; 1444 - /*TODO*/ if (reason & B43_IRQ_NOISESAMPLE_OK) 1447 + if (reason & B43_IRQ_TXFIFO_FLUSH_OK) 1448 + ;/* TODO */ 1449 + if (reason & B43_IRQ_NOISESAMPLE_OK) 1445 1450 handle_irq_noise(dev); 1446 1451 1447 1452 /* Check the DMA reason registers for received data. */ ··· 1451 1454 b43_pio_rx(dev->pio.queue0); 1452 1455 else 1453 1456 b43_dma_rx(dev->dma.rx_ring0); 1454 - /* We intentionally don't set "activity" to 1, here. */ 1455 1457 } 1456 1458 B43_WARN_ON(dma_reason[1] & B43_DMAIRQ_RX_DONE); 1457 1459 B43_WARN_ON(dma_reason[2] & B43_DMAIRQ_RX_DONE); ··· 1459 1463 b43_pio_rx(dev->pio.queue3); 1460 1464 else 1461 1465 b43_dma_rx(dev->dma.rx_ring3); 1462 - activity = 1; 1463 1466 } 1464 1467 B43_WARN_ON(dma_reason[4] & B43_DMAIRQ_RX_DONE); 1465 1468 B43_WARN_ON(dma_reason[5] & B43_DMAIRQ_RX_DONE); 1466 1469 1467 - if (reason & B43_IRQ_TX_OK) { 1470 + if (reason & B43_IRQ_TX_OK) 1468 1471 handle_irq_transmit_status(dev); 1469 - activity = 1; 1470 - //TODO: In AP mode, this also causes sending of powersave responses. 1471 - } 1472 1472 1473 - if (!modparam_noleds) 1474 - b43_leds_update(dev, activity); 1475 1473 b43_interrupt_enable(dev, dev->irq_savedstate); 1476 1474 mmiowb(); 1477 1475 spin_unlock_irqrestore(&dev->wl->irq_lock, flags); ··· 1917 1927 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) 1918 1928 & ~B43_MACCTL_GPOUTSMSK); 1919 1929 1920 - b43_leds_switch_all(dev, 0); 1921 1930 b43_write16(dev, B43_MMIO_GPIO_MASK, b43_read16(dev, B43_MMIO_GPIO_MASK) 1922 1931 | 0x000F); 1923 1932 ··· 2162 2173 static void b43_chip_exit(struct b43_wldev *dev) 2163 2174 { 2164 2175 b43_radio_turn_off(dev); 2165 - if (!modparam_noleds) 2166 - b43_leds_exit(dev); 2176 + b43_leds_exit(dev); 2167 2177 b43_gpio_cleanup(dev); 2168 2178 /* firmware is released later */ 2169 2179 } ··· 2190 2202 err = b43_gpio_init(dev); 2191 2203 if (err) 2192 2204 goto out; /* firmware is released later */ 2205 + b43_leds_init(dev); 2206 + 2193 2207 err = b43_upload_initvals(dev); 2194 2208 if (err) 2195 - goto err_gpio_cleanup; 2209 + goto err_leds_exit; 2196 2210 b43_radio_turn_on(dev); 2197 2211 2198 2212 b43_write16(dev, 0x03E6, 0x0000); ··· 2265 2275 2266 2276 err = 0; 2267 2277 b43dbg(dev->wl, "Chip initialized\n"); 2268 - out: 2278 + out: 2269 2279 return err; 2270 2280 2271 - err_radio_off: 2281 + err_radio_off: 2272 2282 b43_radio_turn_off(dev); 2273 - err_gpio_cleanup: 2283 + err_leds_exit: 2284 + b43_leds_exit(dev); 2274 2285 b43_gpio_cleanup(dev); 2275 - goto out; 2286 + return err; 2276 2287 } 2277 2288 2278 2289 static void b43_periodic_every120sec(struct b43_wldev *dev) ··· 2360 2369 dev->radio_hw_enable = radio_hw_enable; 2361 2370 b43info(dev->wl, "Radio hardware status changed to %s\n", 2362 2371 radio_hw_enable ? "ENABLED" : "DISABLED"); 2363 - b43_leds_update(dev, 0); 2364 2372 } 2365 2373 } 2366 2374 ··· 3757 3767 } else 3758 3768 have_bphy = 1; 3759 3769 3760 - /* Initialize LEDs structs. */ 3761 - err = b43_leds_init(dev); 3762 - if (err) 3763 - goto err_powerdown; 3764 - 3765 3770 dev->phy.gmode = (have_gphy || have_bphy); 3766 3771 tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; 3767 3772 b43_wireless_core_reset(dev, tmp); 3768 3773 3769 3774 err = b43_phy_versioning(dev); 3770 3775 if (err) 3771 - goto err_leds_exit; 3776 + goto err_powerdown; 3772 3777 /* Check if this device supports multiband. */ 3773 3778 if (!pdev || 3774 3779 (pdev->device != 0x4312 && ··· 3792 3807 3793 3808 err = b43_validate_chipaccess(dev); 3794 3809 if (err) 3795 - goto err_leds_exit; 3810 + goto err_powerdown; 3796 3811 err = b43_setup_modes(dev, have_aphy, have_bphy, have_gphy); 3797 3812 if (err) 3798 - goto err_leds_exit; 3813 + goto err_powerdown; 3799 3814 3800 3815 /* Now set some default "current_dev" */ 3801 3816 if (!wl->current_dev) ··· 3810 3825 out: 3811 3826 return err; 3812 3827 3813 - err_leds_exit: 3814 - b43_leds_exit(dev); 3815 3828 err_powerdown: 3816 3829 ssb_bus_may_powerdown(bus); 3817 3830 return err;