aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/Kconfig54
-rw-r--r--drivers/net/wireless/b43/b43.h2
-rw-r--r--drivers/net/wireless/b43/leds.c4
-rw-r--r--drivers/net/wireless/b43/main.c24
-rw-r--r--drivers/net/wireless/b43/main.h20
-rw-r--r--drivers/net/wireless/b43/phy.c2
-rw-r--r--drivers/net/wireless/b43/rfkill.c48
-rw-r--r--drivers/net/wireless/b43/xmit.c27
-rw-r--r--drivers/net/wireless/b43/xmit.h65
-rw-r--r--drivers/net/wireless/b43legacy/dma.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/phy.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_plx.c6
-rw-r--r--drivers/net/wireless/ipw2200.c22
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c44
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c41
-rw-r--r--drivers/net/wireless/libertas/if_cs.c3
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c4
-rw-r--r--drivers/net/wireless/libertas/main.c4
-rw-r--r--drivers/net/wireless/libertas/wext.c2
-rw-r--r--drivers/net/wireless/netwave_cs.c2
-rw-r--r--drivers/net/wireless/p54usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c37
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c4
-rw-r--r--drivers/net/wireless/rtl8187_dev.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c10
32 files changed, 333 insertions, 154 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 2b733c582915..2c08c0a5a0df 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -68,7 +68,7 @@ config WAVELAN
68 <http://www.tldp.org/docs.html#howto>. Some more specific 68 <http://www.tldp.org/docs.html#howto>. Some more specific
69 information is contained in 69 information is contained in
70 <file:Documentation/networking/wavelan.txt> and in the source code 70 <file:Documentation/networking/wavelan.txt> and in the source code
71 <file:drivers/net/wavelan.p.h>. 71 <file:drivers/net/wireless/wavelan.p.h>.
72 72
73 You will also need the wireless tools package available from 73 You will also need the wireless tools package available from
74 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. 74 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
@@ -264,6 +264,7 @@ config IPW2200_DEBUG
264config LIBERTAS 264config LIBERTAS
265 tristate "Marvell 8xxx Libertas WLAN driver support" 265 tristate "Marvell 8xxx Libertas WLAN driver support"
266 depends on WLAN_80211 266 depends on WLAN_80211
267 select WIRELESS_EXT
267 select IEEE80211 268 select IEEE80211
268 select FW_LOADER 269 select FW_LOADER
269 ---help--- 270 ---help---
@@ -586,15 +587,66 @@ config ADM8211
586config P54_COMMON 587config P54_COMMON
587 tristate "Softmac Prism54 support" 588 tristate "Softmac Prism54 support"
588 depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL 589 depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL
590 ---help---
591 This is common code for isl38xx based cards.
592 This module does nothing by itself - the USB/PCI frontends
593 also need to be enabled in order to support any devices.
594
595 These devices require softmac firmware which can be found at
596 http://prism54.org/
597
598 If you choose to build a module, it'll be called p54common.
589 599
590config P54_USB 600config P54_USB
591 tristate "Prism54 USB support" 601 tristate "Prism54 USB support"
592 depends on P54_COMMON && USB 602 depends on P54_COMMON && USB
593 select CRC32 603 select CRC32
604 ---help---
605 This driver is for USB isl38xx based wireless cards.
606 These are USB based adapters found in devices such as:
607
608 3COM 3CRWE254G72
609 SMC 2862W-G
610 Accton 802.11g WN4501 USB
611 Siemens Gigaset USB
612 Netgear WG121
613 Netgear WG111
614 Medion 40900, Roper Europe
615 Shuttle PN15, Airvast WM168g, IOGear GWU513
616 Linksys WUSB54G
617 Linksys WUSB54G Portable
618 DLink DWL-G120 Spinnaker
619 DLink DWL-G122
620 Belkin F5D7050 ver 1000
621 Cohiba Proto board
622 SMC 2862W-G version 2
623 U.S. Robotics U5 802.11g Adapter
624 FUJITSU E-5400 USB D1700
625 Sagem XG703A
626 DLink DWL-G120 Cohiba
627 Spinnaker Proto board
628 Linksys WUSB54AG
629 Inventel UR054G
630 Spinnaker DUT
631
632 These devices require softmac firmware which can be found at
633 http://prism54.org/
634
635 If you choose to build a module, it'll be called p54usb.
594 636
595config P54_PCI 637config P54_PCI
596 tristate "Prism54 PCI support" 638 tristate "Prism54 PCI support"
597 depends on P54_COMMON && PCI 639 depends on P54_COMMON && PCI
640 ---help---
641 This driver is for PCI isl38xx based wireless cards.
642 This driver supports most devices that are supported by the
643 fullmac prism54 driver plus many devices which are not
644 supported by the fullmac driver/firmware.
645
646 This driver requires softmac firmware which can be found at
647 http://prism54.org/
648
649 If you choose to build a module, it'll be called p54pci.
598 650
599source "drivers/net/wireless/iwlwifi/Kconfig" 651source "drivers/net/wireless/iwlwifi/Kconfig"
600source "drivers/net/wireless/hostap/Kconfig" 652source "drivers/net/wireless/hostap/Kconfig"
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index a28ad230d63e..7b6fc1ab2b90 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -273,6 +273,8 @@ enum {
273#define B43_PHYTYPE_A 0x00 273#define B43_PHYTYPE_A 0x00
274#define B43_PHYTYPE_B 0x01 274#define B43_PHYTYPE_B 0x01
275#define B43_PHYTYPE_G 0x02 275#define B43_PHYTYPE_G 0x02
276#define B43_PHYTYPE_N 0x04
277#define B43_PHYTYPE_LP 0x05
276 278
277/* PHYRegisters */ 279/* PHYRegisters */
278#define B43_PHY_ILT_A_CTRL 0x0072 280#define B43_PHY_ILT_A_CTRL 0x0072
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c
index 19e588582c7c..6c0e2b9f7760 100644
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -163,6 +163,9 @@ static void b43_map_led(struct b43_wldev *dev,
163 b43_register_led(dev, &dev->led_radio, name, 163 b43_register_led(dev, &dev->led_radio, name,
164 b43_rfkill_led_name(dev), 164 b43_rfkill_led_name(dev),
165 led_index, activelow); 165 led_index, activelow);
166 /* Sync the RF-kill LED state with the switch state. */
167 if (dev->radio_hw_enable)
168 b43_led_turn_on(dev, led_index, activelow);
166 break; 169 break;
167 case B43_LED_WEIRD: 170 case B43_LED_WEIRD:
168 case B43_LED_ASSOC: 171 case B43_LED_ASSOC:
@@ -232,4 +235,5 @@ void b43_leds_exit(struct b43_wldev *dev)
232 b43_unregister_led(&dev->led_tx); 235 b43_unregister_led(&dev->led_tx);
233 b43_unregister_led(&dev->led_rx); 236 b43_unregister_led(&dev->led_rx);
234 b43_unregister_led(&dev->led_assoc); 237 b43_unregister_led(&dev->led_assoc);
238 b43_unregister_led(&dev->led_radio);
235} 239}
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 2b17c1dc46f1..1c93b4f4bfe3 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1566,7 +1566,7 @@ static void b43_release_firmware(struct b43_wldev *dev)
1566static void b43_print_fw_helptext(struct b43_wl *wl) 1566static void b43_print_fw_helptext(struct b43_wl *wl)
1567{ 1567{
1568 b43err(wl, "You must go to " 1568 b43err(wl, "You must go to "
1569 "http://linuxwireless.org/en/users/Drivers/bcm43xx#devicefirmware " 1569 "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware "
1570 "and download the correct firmware (version 4).\n"); 1570 "and download the correct firmware (version 4).\n");
1571} 1571}
1572 1572
@@ -2163,7 +2163,6 @@ static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna)
2163static void b43_chip_exit(struct b43_wldev *dev) 2163static void b43_chip_exit(struct b43_wldev *dev)
2164{ 2164{
2165 b43_radio_turn_off(dev, 1); 2165 b43_radio_turn_off(dev, 1);
2166 b43_leds_exit(dev);
2167 b43_gpio_cleanup(dev); 2166 b43_gpio_cleanup(dev);
2168 /* firmware is released later */ 2167 /* firmware is released later */
2169} 2168}
@@ -2191,11 +2190,10 @@ static int b43_chip_init(struct b43_wldev *dev)
2191 err = b43_gpio_init(dev); 2190 err = b43_gpio_init(dev);
2192 if (err) 2191 if (err)
2193 goto out; /* firmware is released later */ 2192 goto out; /* firmware is released later */
2194 b43_leds_init(dev);
2195 2193
2196 err = b43_upload_initvals(dev); 2194 err = b43_upload_initvals(dev);
2197 if (err) 2195 if (err)
2198 goto err_leds_exit; 2196 goto err_gpio_clean;
2199 b43_radio_turn_on(dev); 2197 b43_radio_turn_on(dev);
2200 2198
2201 b43_write16(dev, 0x03E6, 0x0000); 2199 b43_write16(dev, 0x03E6, 0x0000);
@@ -2271,8 +2269,7 @@ out:
2271 2269
2272err_radio_off: 2270err_radio_off:
2273 b43_radio_turn_off(dev, 1); 2271 b43_radio_turn_off(dev, 1);
2274err_leds_exit: 2272err_gpio_clean:
2275 b43_leds_exit(dev);
2276 b43_gpio_cleanup(dev); 2273 b43_gpio_cleanup(dev);
2277 return err; 2274 return err;
2278} 2275}
@@ -3273,10 +3270,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
3273 return; 3270 return;
3274 b43_set_status(dev, B43_STAT_UNINIT); 3271 b43_set_status(dev, B43_STAT_UNINIT);
3275 3272
3276 mutex_unlock(&dev->wl->mutex); 3273 b43_leds_exit(dev);
3277 b43_rfkill_exit(dev);
3278 mutex_lock(&dev->wl->mutex);
3279
3280 b43_rng_exit(dev->wl); 3274 b43_rng_exit(dev->wl);
3281 b43_pio_free(dev); 3275 b43_pio_free(dev);
3282 b43_dma_free(dev); 3276 b43_dma_free(dev);
@@ -3405,12 +3399,12 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
3405 memset(wl->mac_addr, 0, ETH_ALEN); 3399 memset(wl->mac_addr, 0, ETH_ALEN);
3406 b43_upload_card_macaddress(dev); 3400 b43_upload_card_macaddress(dev);
3407 b43_security_init(dev); 3401 b43_security_init(dev);
3408 b43_rfkill_init(dev);
3409 b43_rng_init(wl); 3402 b43_rng_init(wl);
3410 3403
3411 b43_set_status(dev, B43_STAT_INITIALIZED); 3404 b43_set_status(dev, B43_STAT_INITIALIZED);
3412 3405
3413 out: 3406 b43_leds_init(dev);
3407out:
3414 return err; 3408 return err;
3415 3409
3416 err_chip_exit: 3410 err_chip_exit:
@@ -3499,6 +3493,10 @@ static int b43_start(struct ieee80211_hw *hw)
3499 int did_init = 0; 3493 int did_init = 0;
3500 int err = 0; 3494 int err = 0;
3501 3495
3496 /* First register RFkill.
3497 * LEDs that are registered later depend on it. */
3498 b43_rfkill_init(dev);
3499
3502 mutex_lock(&wl->mutex); 3500 mutex_lock(&wl->mutex);
3503 3501
3504 if (b43_status(dev) < B43_STAT_INITIALIZED) { 3502 if (b43_status(dev) < B43_STAT_INITIALIZED) {
@@ -3528,6 +3526,8 @@ static void b43_stop(struct ieee80211_hw *hw)
3528 struct b43_wl *wl = hw_to_b43_wl(hw); 3526 struct b43_wl *wl = hw_to_b43_wl(hw);
3529 struct b43_wldev *dev = wl->current_dev; 3527 struct b43_wldev *dev = wl->current_dev;
3530 3528
3529 b43_rfkill_exit(dev);
3530
3531 mutex_lock(&wl->mutex); 3531 mutex_lock(&wl->mutex);
3532 if (b43_status(dev) >= B43_STAT_STARTED) 3532 if (b43_status(dev) >= B43_STAT_STARTED)
3533 b43_wireless_core_stop(dev); 3533 b43_wireless_core_stop(dev);
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index 284d17da17d1..08e2e56e48f4 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -39,11 +39,11 @@
39#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes)) 39#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes))
40 40
41/* Lightweight function to convert a frequency (in Mhz) to a channel number. */ 41/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
42static inline u8 b43_freq_to_channel_a(int freq) 42static inline u8 b43_freq_to_channel_5ghz(int freq)
43{ 43{
44 return ((freq - 5000) / 5); 44 return ((freq - 5000) / 5);
45} 45}
46static inline u8 b43_freq_to_channel_bg(int freq) 46static inline u8 b43_freq_to_channel_2ghz(int freq)
47{ 47{
48 u8 channel; 48 u8 channel;
49 49
@@ -54,19 +54,13 @@ static inline u8 b43_freq_to_channel_bg(int freq)
54 54
55 return channel; 55 return channel;
56} 56}
57static inline u8 b43_freq_to_channel(struct b43_wldev *dev, int freq)
58{
59 if (dev->phy.type == B43_PHYTYPE_A)
60 return b43_freq_to_channel_a(freq);
61 return b43_freq_to_channel_bg(freq);
62}
63 57
64/* Lightweight function to convert a channel number to a frequency (in Mhz). */ 58/* Lightweight function to convert a channel number to a frequency (in Mhz). */
65static inline int b43_channel_to_freq_a(u8 channel) 59static inline int b43_channel_to_freq_5ghz(u8 channel)
66{ 60{
67 return (5000 + (5 * channel)); 61 return (5000 + (5 * channel));
68} 62}
69static inline int b43_channel_to_freq_bg(u8 channel) 63static inline int b43_channel_to_freq_2ghz(u8 channel)
70{ 64{
71 int freq; 65 int freq;
72 66
@@ -77,12 +71,6 @@ static inline int b43_channel_to_freq_bg(u8 channel)
77 71
78 return freq; 72 return freq;
79} 73}
80static inline int b43_channel_to_freq(struct b43_wldev *dev, u8 channel)
81{
82 if (dev->phy.type == B43_PHYTYPE_A)
83 return b43_channel_to_freq_a(channel);
84 return b43_channel_to_freq_bg(channel);
85}
86 74
87static inline int b43_is_cck_rate(int rate) 75static inline int b43_is_cck_rate(int rate)
88{ 76{
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c
index 3d4ed647c311..7ff091e69f05 100644
--- a/drivers/net/wireless/b43/phy.c
+++ b/drivers/net/wireless/b43/phy.c
@@ -2214,7 +2214,7 @@ int b43_phy_init_tssi2dbm_table(struct b43_wldev *dev)
2214 } 2214 }
2215 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2215 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2216 if (dyn_tssi2dbm == NULL) { 2216 if (dyn_tssi2dbm == NULL) {
2217 b43err(dev->wl, "Could not allocate memory" 2217 b43err(dev->wl, "Could not allocate memory "
2218 "for tssi2dbm table\n"); 2218 "for tssi2dbm table\n");
2219 return -ENOMEM; 2219 return -ENOMEM;
2220 } 2220 }
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 9b1f905ffbf4..11f53cb1139e 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -25,6 +25,8 @@
25#include "rfkill.h" 25#include "rfkill.h"
26#include "b43.h" 26#include "b43.h"
27 27
28#include <linux/kmod.h>
29
28 30
29/* Returns TRUE, if the radio is enabled in hardware. */ 31/* Returns TRUE, if the radio is enabled in hardware. */
30static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) 32static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
@@ -50,7 +52,10 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
50 bool report_change = 0; 52 bool report_change = 0;
51 53
52 mutex_lock(&wl->mutex); 54 mutex_lock(&wl->mutex);
53 B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); 55 if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) {
56 mutex_unlock(&wl->mutex);
57 return;
58 }
54 enabled = b43_is_hw_radio_enabled(dev); 59 enabled = b43_is_hw_radio_enabled(dev);
55 if (unlikely(enabled != dev->radio_hw_enable)) { 60 if (unlikely(enabled != dev->radio_hw_enable)) {
56 dev->radio_hw_enable = enabled; 61 dev->radio_hw_enable = enabled;
@@ -60,8 +65,12 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
60 } 65 }
61 mutex_unlock(&wl->mutex); 66 mutex_unlock(&wl->mutex);
62 67
63 if (unlikely(report_change)) 68 /* send the radio switch event to the system - note both a key press
64 input_report_key(poll_dev->input, KEY_WLAN, enabled); 69 * and a release are required */
70 if (unlikely(report_change)) {
71 input_report_key(poll_dev->input, KEY_WLAN, 1);
72 input_report_key(poll_dev->input, KEY_WLAN, 0);
73 }
65} 74}
66 75
67/* Called when the RFKILL toggled in software. */ 76/* Called when the RFKILL toggled in software. */
@@ -69,13 +78,15 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state)
69{ 78{
70 struct b43_wldev *dev = data; 79 struct b43_wldev *dev = data;
71 struct b43_wl *wl = dev->wl; 80 struct b43_wl *wl = dev->wl;
72 int err = 0; 81 int err = -EBUSY;
73 82
74 if (!wl->rfkill.registered) 83 if (!wl->rfkill.registered)
75 return 0; 84 return 0;
76 85
77 mutex_lock(&wl->mutex); 86 mutex_lock(&wl->mutex);
78 B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); 87 if (b43_status(dev) < B43_STAT_INITIALIZED)
88 goto out_unlock;
89 err = 0;
79 switch (state) { 90 switch (state) {
80 case RFKILL_STATE_ON: 91 case RFKILL_STATE_ON:
81 if (!dev->radio_hw_enable) { 92 if (!dev->radio_hw_enable) {
@@ -127,15 +138,34 @@ void b43_rfkill_init(struct b43_wldev *dev)
127 rfk->rfkill->user_claim_unsupported = 1; 138 rfk->rfkill->user_claim_unsupported = 1;
128 139
129 rfk->poll_dev = input_allocate_polled_device(); 140 rfk->poll_dev = input_allocate_polled_device();
130 if (!rfk->poll_dev) 141 if (!rfk->poll_dev) {
131 goto err_free_rfk; 142 rfkill_free(rfk->rfkill);
143 goto err_freed_rfk;
144 }
145
132 rfk->poll_dev->private = dev; 146 rfk->poll_dev->private = dev;
133 rfk->poll_dev->poll = b43_rfkill_poll; 147 rfk->poll_dev->poll = b43_rfkill_poll;
134 rfk->poll_dev->poll_interval = 1000; /* msecs */ 148 rfk->poll_dev->poll_interval = 1000; /* msecs */
135 149
150 rfk->poll_dev->input->name = rfk->name;
151 rfk->poll_dev->input->id.bustype = BUS_HOST;
152 rfk->poll_dev->input->id.vendor = dev->dev->bus->boardinfo.vendor;
153 rfk->poll_dev->input->evbit[0] = BIT(EV_KEY);
154 set_bit(KEY_WLAN, rfk->poll_dev->input->keybit);
155
136 err = rfkill_register(rfk->rfkill); 156 err = rfkill_register(rfk->rfkill);
137 if (err) 157 if (err)
138 goto err_free_polldev; 158 goto err_free_polldev;
159
160#ifdef CONFIG_RFKILL_INPUT_MODULE
161 /* B43 RF-kill isn't useful without the rfkill-input subsystem.
162 * Try to load the module. */
163 err = request_module("rfkill-input");
164 if (err)
165 b43warn(wl, "Failed to load the rfkill-input module. "
166 "The built-in radio LED will not work.\n");
167#endif /* CONFIG_RFKILL_INPUT */
168
139 err = input_register_polled_device(rfk->poll_dev); 169 err = input_register_polled_device(rfk->poll_dev);
140 if (err) 170 if (err)
141 goto err_unreg_rfk; 171 goto err_unreg_rfk;
@@ -148,8 +178,7 @@ err_unreg_rfk:
148err_free_polldev: 178err_free_polldev:
149 input_free_polled_device(rfk->poll_dev); 179 input_free_polled_device(rfk->poll_dev);
150 rfk->poll_dev = NULL; 180 rfk->poll_dev = NULL;
151err_free_rfk: 181err_freed_rfk:
152 rfkill_free(rfk->rfkill);
153 rfk->rfkill = NULL; 182 rfk->rfkill = NULL;
154out_error: 183out_error:
155 rfk->registered = 0; 184 rfk->registered = 0;
@@ -168,6 +197,5 @@ void b43_rfkill_exit(struct b43_wldev *dev)
168 rfkill_unregister(rfk->rfkill); 197 rfkill_unregister(rfk->rfkill);
169 input_free_polled_device(rfk->poll_dev); 198 input_free_polled_device(rfk->poll_dev);
170 rfk->poll_dev = NULL; 199 rfk->poll_dev = NULL;
171 rfkill_free(rfk->rfkill);
172 rfk->rfkill = NULL; 200 rfk->rfkill = NULL;
173} 201}
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 0bd6f8a348a8..3307ba1856b1 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -531,21 +531,32 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
531 switch (chanstat & B43_RX_CHAN_PHYTYPE) { 531 switch (chanstat & B43_RX_CHAN_PHYTYPE) {
532 case B43_PHYTYPE_A: 532 case B43_PHYTYPE_A:
533 status.phymode = MODE_IEEE80211A; 533 status.phymode = MODE_IEEE80211A;
534 status.freq = chanid; 534 B43_WARN_ON(1);
535 status.channel = b43_freq_to_channel_a(chanid); 535 /* FIXME: We don't really know which value the "chanid" contains.
536 break; 536 * So the following assignment might be wrong. */
537 case B43_PHYTYPE_B: 537 status.channel = chanid;
538 status.phymode = MODE_IEEE80211B; 538 status.freq = b43_channel_to_freq_5ghz(status.channel);
539 status.freq = chanid + 2400;
540 status.channel = b43_freq_to_channel_bg(chanid + 2400);
541 break; 539 break;
542 case B43_PHYTYPE_G: 540 case B43_PHYTYPE_G:
543 status.phymode = MODE_IEEE80211G; 541 status.phymode = MODE_IEEE80211G;
542 /* chanid is the radio channel cookie value as used
543 * to tune the radio. */
544 status.freq = chanid + 2400; 544 status.freq = chanid + 2400;
545 status.channel = b43_freq_to_channel_bg(chanid + 2400); 545 status.channel = b43_freq_to_channel_2ghz(status.freq);
546 break;
547 case B43_PHYTYPE_N:
548 status.phymode = 0xDEAD /*FIXME MODE_IEEE80211N*/;
549 /* chanid is the SHM channel cookie. Which is the plain
550 * channel number in b43. */
551 status.channel = chanid;
552 if (chanstat & B43_RX_CHAN_5GHZ)
553 status.freq = b43_freq_to_channel_5ghz(status.freq);
554 else
555 status.freq = b43_freq_to_channel_2ghz(status.freq);
546 break; 556 break;
547 default: 557 default:
548 B43_WARN_ON(1); 558 B43_WARN_ON(1);
559 goto drop;
549 } 560 }
550 561
551 dev->stats.last_rx = jiffies; 562 dev->stats.last_rx = jiffies;
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index 03bddd251618..6dc079382f7f 100644
--- a/drivers/net/wireless/b43/xmit.h
+++ b/drivers/net/wireless/b43/xmit.h
@@ -142,49 +142,56 @@ struct b43_rxhdr_fw4 {
142} __attribute__ ((__packed__)); 142} __attribute__ ((__packed__));
143 143
144/* PHY RX Status 0 */ 144/* PHY RX Status 0 */
145#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ 145#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */
146#define B43_RX_PHYST0_PLCPHCF 0x0200 146#define B43_RX_PHYST0_PLCPHCF 0x0200
147#define B43_RX_PHYST0_PLCPFV 0x0100 147#define B43_RX_PHYST0_PLCPFV 0x0100
148#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ 148#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */
149#define B43_RX_PHYST0_LCRS 0x0040 149#define B43_RX_PHYST0_LCRS 0x0040
150#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ 150#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */
151#define B43_RX_PHYST0_UNSRATE 0x0010 151#define B43_RX_PHYST0_UNSRATE 0x0010
152#define B43_RX_PHYST0_CLIP 0x000C 152#define B43_RX_PHYST0_CLIP 0x000C
153#define B43_RX_PHYST0_CLIP_SHIFT 2 153#define B43_RX_PHYST0_CLIP_SHIFT 2
154#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */ 154#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */
155#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */ 155#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */
156#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */ 156#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */
157#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ 157#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */
158#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ 158#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */
159 159
160/* PHY RX Status 2 */ 160/* PHY RX Status 2 */
161#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ 161#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */
162#define B43_RX_PHYST2_LNAG_SHIFT 14 162#define B43_RX_PHYST2_LNAG_SHIFT 14
163#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ 163#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */
164#define B43_RX_PHYST2_PNAG_SHIFT 10 164#define B43_RX_PHYST2_PNAG_SHIFT 10
165#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */ 165#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */
166 166
167/* PHY RX Status 3 */ 167/* PHY RX Status 3 */
168#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */ 168#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */
169#define B43_RX_PHYST3_DIGG_SHIFT 11 169#define B43_RX_PHYST3_DIGG_SHIFT 11
170#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */ 170#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */
171 171
172/* MAC RX Status */ 172/* MAC RX Status */
173#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon send flag */ 173#define B43_RX_MAC_RXST_VALID 0x01000000 /* PHY RXST valid */
174#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */ 174#define B43_RX_MAC_TKIP_MICERR 0x00100000 /* TKIP MIC error */
175#define B43_RX_MAC_KEYIDX_SHIFT 5 175#define B43_RX_MAC_TKIP_MICATT 0x00080000 /* TKIP MIC attempted */
176#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */ 176#define B43_RX_MAC_AGGTYPE 0x00060000 /* Aggregation type */
177#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */ 177#define B43_RX_MAC_AGGTYPE_SHIFT 17
178#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */ 178#define B43_RX_MAC_AMSDU 0x00010000 /* A-MSDU mask */
179#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */ 179#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon sent flag */
180#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */ 180#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */
181#define B43_RX_MAC_KEYIDX_SHIFT 5
182#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */
183#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */
184#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */
185#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */
186#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */
181 187
182/* RX channel */ 188/* RX channel */
183#define B43_RX_CHAN_GAIN 0xFC00 /* Gain */ 189#define B43_RX_CHAN_40MHZ 0x1000 /* 40 Mhz channel width */
184#define B43_RX_CHAN_GAIN_SHIFT 10 190#define B43_RX_CHAN_5GHZ 0x0800 /* 5 Ghz band */
185#define B43_RX_CHAN_ID 0x03FC /* Channel ID */ 191#define B43_RX_CHAN_ID 0x07F8 /* Channel ID */
186#define B43_RX_CHAN_ID_SHIFT 2 192#define B43_RX_CHAN_ID_SHIFT 3
187#define B43_RX_CHAN_PHYTYPE 0x0003 /* PHY type */ 193#define B43_RX_CHAN_PHYTYPE 0x0007 /* PHY type */
194
188 195
189u8 b43_plcp_get_ratecode_cck(const u8 bitrate); 196u8 b43_plcp_get_ratecode_cck(const u8 bitrate);
190u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate); 197u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate);
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index 8cb3dc4c4745..83161d9af813 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -996,7 +996,7 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
996 996
997 err = ssb_dma_set_mask(dev->dev, dmamask); 997 err = ssb_dma_set_mask(dev->dev, dmamask);
998 if (err) { 998 if (err) {
999#ifdef BCM43XX_PIO 999#ifdef CONFIG_B43LEGACY_PIO
1000 b43legacywarn(dev->wl, "DMA for this device not supported. " 1000 b43legacywarn(dev->wl, "DMA for this device not supported. "
1001 "Falling back to PIO\n"); 1001 "Falling back to PIO\n");
1002 dev->__using_pio = 1; 1002 dev->__using_pio = 1;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 3bde1e9ab428..32d5e1785bda 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1419,7 +1419,7 @@ static void b43legacy_release_firmware(struct b43legacy_wldev *dev)
1419static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) 1419static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl)
1420{ 1420{
1421 b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/" 1421 b43legacyerr(wl, "You must go to http://linuxwireless.org/en/users/"
1422 "Drivers/bcm43xx#devicefirmware " 1422 "Drivers/b43#devicefirmware "
1423 "and download the correct firmware (version 3).\n"); 1423 "and download the correct firmware (version 3).\n");
1424} 1424}
1425 1425
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c
index 22a4b3d0186d..491e518e4aeb 100644
--- a/drivers/net/wireless/b43legacy/phy.c
+++ b/drivers/net/wireless/b43legacy/phy.c
@@ -2020,7 +2020,7 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev)
2020 phy->idle_tssi = 62; 2020 phy->idle_tssi = 62;
2021 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2021 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2022 if (dyn_tssi2dbm == NULL) { 2022 if (dyn_tssi2dbm == NULL) {
2023 b43legacyerr(dev->wl, "Could not allocate memory" 2023 b43legacyerr(dev->wl, "Could not allocate memory "
2024 "for tssi2dbm table\n"); 2024 "for tssi2dbm table\n");
2025 return -ENOMEM; 2025 return -ENOMEM;
2026 } 2026 }
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
index 35dbe4554513..76e9dd843faa 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
@@ -219,7 +219,7 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
219 ssize_t buf_size; 219 ssize_t buf_size;
220 ssize_t res; 220 ssize_t res;
221 unsigned long flags; 221 unsigned long flags;
222 u64 tsf; 222 unsigned long long tsf;
223 223
224 buf_size = min(count, sizeof (really_big_buffer) - 1); 224 buf_size = min(count, sizeof (really_big_buffer) - 1);
225 down(&big_buffer_sem); 225 down(&big_buffer_sem);
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index b37f1e348700..af3de3343650 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -2149,7 +2149,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm)
2149 } 2149 }
2150 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2150 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);
2151 if (dyn_tssi2dbm == NULL) { 2151 if (dyn_tssi2dbm == NULL) {
2152 printk(KERN_ERR PFX "Could not allocate memory" 2152 printk(KERN_ERR PFX "Could not allocate memory "
2153 "for tssi2dbm table\n"); 2153 "for tssi2dbm table\n");
2154 return -ENOMEM; 2154 return -ENOMEM;
2155 } 2155 }
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
index 040dc3e36410..cbf15d703201 100644
--- a/drivers/net/wireless/hostap/hostap_plx.c
+++ b/drivers/net/wireless/hostap/hostap_plx.c
@@ -608,7 +608,7 @@ static void prism2_plx_remove(struct pci_dev *pdev)
608 608
609MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); 609MODULE_DEVICE_TABLE(pci, prism2_plx_id_table);
610 610
611static struct pci_driver prism2_plx_drv_id = { 611static struct pci_driver prism2_plx_driver = {
612 .name = "hostap_plx", 612 .name = "hostap_plx",
613 .id_table = prism2_plx_id_table, 613 .id_table = prism2_plx_id_table,
614 .probe = prism2_plx_probe, 614 .probe = prism2_plx_probe,
@@ -618,13 +618,13 @@ static struct pci_driver prism2_plx_drv_id = {
618 618
619static int __init init_prism2_plx(void) 619static int __init init_prism2_plx(void)
620{ 620{
621 return pci_register_driver(&prism2_plx_drv_id); 621 return pci_register_driver(&prism2_plx_driver);
622} 622}
623 623
624 624
625static void __exit exit_prism2_plx(void) 625static void __exit exit_prism2_plx(void)
626{ 626{
627 pci_unregister_driver(&prism2_plx_drv_id); 627 pci_unregister_driver(&prism2_plx_driver);
628} 628}
629 629
630 630
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 54f44e5473c0..003f73f89efa 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d,
1233{ 1233{
1234 struct ipw_priv *priv = dev_get_drvdata(d); 1234 struct ipw_priv *priv = dev_get_drvdata(d);
1235 u32 log_len = ipw_get_event_log_len(priv); 1235 u32 log_len = ipw_get_event_log_len(priv);
1236 struct ipw_event log[log_len]; 1236 u32 log_size;
1237 struct ipw_event *log;
1237 u32 len = 0, i; 1238 u32 len = 0, i;
1238 1239
1240 /* not using min() because of its strict type checking */
1241 log_size = PAGE_SIZE / sizeof(*log) > log_len ?
1242 sizeof(*log) * log_len : PAGE_SIZE;
1243 log = kzalloc(log_size, GFP_KERNEL);
1244 if (!log) {
1245 IPW_ERROR("Unable to allocate memory for log\n");
1246 return 0;
1247 }
1248 log_len = log_size / sizeof(*log);
1239 ipw_capture_event_log(priv, log_len, log); 1249 ipw_capture_event_log(priv, log_len, log);
1240 1250
1241 len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); 1251 len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len);
@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d,
1244 "\n%08X%08X%08X", 1254 "\n%08X%08X%08X",
1245 log[i].time, log[i].event, log[i].data); 1255 log[i].time, log[i].event, log[i].data);
1246 len += snprintf(buf + len, PAGE_SIZE - len, "\n"); 1256 len += snprintf(buf + len, PAGE_SIZE - len, "\n");
1257 kfree(log);
1247 return len; 1258 return len;
1248} 1259}
1249 1260
@@ -4924,7 +4935,7 @@ static int ipw_queue_reset(struct ipw_priv *priv)
4924/** 4935/**
4925 * Reclaim Tx queue entries no more used by NIC. 4936 * Reclaim Tx queue entries no more used by NIC.
4926 * 4937 *
4927 * When FW adwances 'R' index, all entries between old and 4938 * When FW advances 'R' index, all entries between old and
4928 * new 'R' index need to be reclaimed. As result, some free space 4939 * new 'R' index need to be reclaimed. As result, some free space
4929 * forms. If there is enough free space (> low mark), wake Tx queue. 4940 * forms. If there is enough free space (> low mark), wake Tx queue.
4930 * 4941 *
@@ -10751,7 +10762,7 @@ static void ipw_bg_link_down(struct work_struct *work)
10751 mutex_unlock(&priv->mutex); 10762 mutex_unlock(&priv->mutex);
10752} 10763}
10753 10764
10754static int ipw_setup_deferred_work(struct ipw_priv *priv) 10765static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv)
10755{ 10766{
10756 int ret = 0; 10767 int ret = 0;
10757 10768
@@ -11600,7 +11611,8 @@ static void ipw_prom_free(struct ipw_priv *priv)
11600#endif 11611#endif
11601 11612
11602 11613
11603static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 11614static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11615 const struct pci_device_id *ent)
11604{ 11616{
11605 int err = 0; 11617 int err = 0;
11606 struct net_device *net_dev; 11618 struct net_device *net_dev;
@@ -11767,7 +11779,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11767 return err; 11779 return err;
11768} 11780}
11769 11781
11770static void ipw_pci_remove(struct pci_dev *pdev) 11782static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11771{ 11783{
11772 struct ipw_priv *priv = pci_get_drvdata(pdev); 11784 struct ipw_priv *priv = pci_get_drvdata(pdev);
11773 struct list_head *p, *q; 11785 struct list_head *p, *q;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 465da4f67ce7..0b3ec7e4d93b 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2915,6 +2915,10 @@ static void iwl_set_rate(struct iwl_priv *priv)
2915 int i; 2915 int i;
2916 2916
2917 hw = iwl_get_hw_mode(priv, priv->phymode); 2917 hw = iwl_get_hw_mode(priv, priv->phymode);
2918 if (!hw) {
2919 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
2920 return;
2921 }
2918 2922
2919 priv->active_rate = 0; 2923 priv->active_rate = 0;
2920 priv->active_rate_basic = 0; 2924 priv->active_rate_basic = 0;
@@ -4739,8 +4743,10 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4739 * when we loaded driver, and is now set to "enable". 4743 * when we loaded driver, and is now set to "enable".
4740 * After we're Alive, RF_KILL gets handled by 4744 * After we're Alive, RF_KILL gets handled by
4741 * iwl_rx_card_state_notif() */ 4745 * iwl_rx_card_state_notif() */
4742 if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) 4746 if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
4747 clear_bit(STATUS_RF_KILL_HW, &priv->status);
4743 queue_work(priv->workqueue, &priv->restart); 4748 queue_work(priv->workqueue, &priv->restart);
4749 }
4744 4750
4745 handled |= CSR_INT_BIT_RF_KILL; 4751 handled |= CSR_INT_BIT_RF_KILL;
4746 } 4752 }
@@ -6167,6 +6173,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
6167 mutex_lock(&priv->mutex); 6173 mutex_lock(&priv->mutex);
6168 6174
6169 if (rc) { 6175 if (rc) {
6176 iwl_rate_control_unregister(priv->hw);
6170 IWL_ERROR("Failed to register network " 6177 IWL_ERROR("Failed to register network "
6171 "device (error %d)\n", rc); 6178 "device (error %d)\n", rc);
6172 return; 6179 return;
@@ -6239,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv)
6239 /* Unblock any waiting calls */ 6246 /* Unblock any waiting calls */
6240 wake_up_interruptible_all(&priv->wait_command_queue); 6247 wake_up_interruptible_all(&priv->wait_command_queue);
6241 6248
6242 iwl_cancel_deferred_work(priv);
6243
6244 /* Wipe out the EXIT_PENDING status bit if we are not actually 6249 /* Wipe out the EXIT_PENDING status bit if we are not actually
6245 * exiting the module */ 6250 * exiting the module */
6246 if (!exit_pending) 6251 if (!exit_pending)
@@ -6315,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv)
6315 mutex_lock(&priv->mutex); 6320 mutex_lock(&priv->mutex);
6316 __iwl_down(priv); 6321 __iwl_down(priv);
6317 mutex_unlock(&priv->mutex); 6322 mutex_unlock(&priv->mutex);
6323
6324 iwl_cancel_deferred_work(priv);
6318} 6325}
6319 6326
6320#define MAX_HW_RESTARTS 5 6327#define MAX_HW_RESTARTS 5
@@ -6335,6 +6342,11 @@ static int __iwl_up(struct iwl_priv *priv)
6335 return 0; 6342 return 0;
6336 } 6343 }
6337 6344
6345 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
6346 IWL_ERROR("ucode not available for device bringup\n");
6347 return -EIO;
6348 }
6349
6338 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 6350 iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
6339 6351
6340 rc = iwl_hw_nic_init(priv); 6352 rc = iwl_hw_nic_init(priv);
@@ -6936,13 +6948,10 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6936 DECLARE_MAC_BUF(mac); 6948 DECLARE_MAC_BUF(mac);
6937 6949
6938 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); 6950 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type);
6939 if (conf->mac_addr)
6940 IWL_DEBUG_MAC80211("enter: MAC %s\n",
6941 print_mac(mac, conf->mac_addr));
6942 6951
6943 if (priv->interface_id) { 6952 if (priv->interface_id) {
6944 IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); 6953 IWL_DEBUG_MAC80211("leave - interface_id != 0\n");
6945 return 0; 6954 return -EOPNOTSUPP;
6946 } 6955 }
6947 6956
6948 spin_lock_irqsave(&priv->lock, flags); 6957 spin_lock_irqsave(&priv->lock, flags);
@@ -6951,6 +6960,12 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
6951 spin_unlock_irqrestore(&priv->lock, flags); 6960 spin_unlock_irqrestore(&priv->lock, flags);
6952 6961
6953 mutex_lock(&priv->mutex); 6962 mutex_lock(&priv->mutex);
6963
6964 if (conf->mac_addr) {
6965 IWL_DEBUG_MAC80211("Set: %s\n", print_mac(mac, conf->mac_addr));
6966 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
6967 }
6968
6954 iwl_set_mode(priv, conf->type); 6969 iwl_set_mode(priv, conf->type);
6955 6970
6956 IWL_DEBUG_MAC80211("leave\n"); 6971 IWL_DEBUG_MAC80211("leave\n");
@@ -8270,6 +8285,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8270{ 8285{
8271 iwl_hw_cancel_deferred_work(priv); 8286 iwl_hw_cancel_deferred_work(priv);
8272 8287
8288 cancel_delayed_work_sync(&priv->init_alive_start);
8273 cancel_delayed_work(&priv->scan_check); 8289 cancel_delayed_work(&priv->scan_check);
8274 cancel_delayed_work(&priv->alive_start); 8290 cancel_delayed_work(&priv->alive_start);
8275 cancel_delayed_work(&priv->post_associate); 8291 cancel_delayed_work(&priv->post_associate);
@@ -8569,10 +8585,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8569 8585
8570 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 8586 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
8571 8587
8572 mutex_lock(&priv->mutex);
8573 set_bit(STATUS_EXIT_PENDING, &priv->status); 8588 set_bit(STATUS_EXIT_PENDING, &priv->status);
8574 __iwl_down(priv); 8589
8575 mutex_unlock(&priv->mutex); 8590 iwl_down(priv);
8576 8591
8577 /* Free MAC hash list for ADHOC */ 8592 /* Free MAC hash list for ADHOC */
8578 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 8593 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -8631,12 +8646,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8631{ 8646{
8632 struct iwl_priv *priv = pci_get_drvdata(pdev); 8647 struct iwl_priv *priv = pci_get_drvdata(pdev);
8633 8648
8634 mutex_lock(&priv->mutex);
8635
8636 set_bit(STATUS_IN_SUSPEND, &priv->status); 8649 set_bit(STATUS_IN_SUSPEND, &priv->status);
8637 8650
8638 /* Take down the device; powers it off, etc. */ 8651 /* Take down the device; powers it off, etc. */
8639 __iwl_down(priv); 8652 iwl_down(priv);
8640 8653
8641 if (priv->mac80211_registered) 8654 if (priv->mac80211_registered)
8642 ieee80211_stop_queues(priv->hw); 8655 ieee80211_stop_queues(priv->hw);
@@ -8645,8 +8658,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8645 pci_disable_device(pdev); 8658 pci_disable_device(pdev);
8646 pci_set_power_state(pdev, PCI_D3hot); 8659 pci_set_power_state(pdev, PCI_D3hot);
8647 8660
8648 mutex_unlock(&priv->mutex);
8649
8650 return 0; 8661 return 0;
8651} 8662}
8652 8663
@@ -8704,8 +8715,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8704 8715
8705 printk(KERN_INFO "Coming out of suspend...\n"); 8716 printk(KERN_INFO "Coming out of suspend...\n");
8706 8717
8707 mutex_lock(&priv->mutex);
8708
8709 pci_set_power_state(pdev, PCI_D0); 8718 pci_set_power_state(pdev, PCI_D0);
8710 err = pci_enable_device(pdev); 8719 err = pci_enable_device(pdev);
8711 pci_restore_state(pdev); 8720 pci_restore_state(pdev);
@@ -8719,7 +8728,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8719 pci_write_config_byte(pdev, 0x41, 0x00); 8728 pci_write_config_byte(pdev, 0x41, 0x00);
8720 8729
8721 iwl_resume(priv); 8730 iwl_resume(priv);
8722 mutex_unlock(&priv->mutex);
8723 8731
8724 return 0; 8732 return 0;
8725} 8733}
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 9918780f5e86..15a45f471710 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -3003,6 +3003,10 @@ static void iwl_set_rate(struct iwl_priv *priv)
3003 int i; 3003 int i;
3004 3004
3005 hw = iwl_get_hw_mode(priv, priv->phymode); 3005 hw = iwl_get_hw_mode(priv, priv->phymode);
3006 if (!hw) {
3007 IWL_ERROR("Failed to set rate: unable to get hw mode\n");
3008 return;
3009 }
3006 3010
3007 priv->active_rate = 0; 3011 priv->active_rate = 0;
3008 priv->active_rate_basic = 0; 3012 priv->active_rate_basic = 0;
@@ -5055,8 +5059,10 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5055 * when we loaded driver, and is now set to "enable". 5059 * when we loaded driver, and is now set to "enable".
5056 * After we're Alive, RF_KILL gets handled by 5060 * After we're Alive, RF_KILL gets handled by
5057 * iwl_rx_card_state_notif() */ 5061 * iwl_rx_card_state_notif() */
5058 if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) 5062 if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
5063 clear_bit(STATUS_RF_KILL_HW, &priv->status);
5059 queue_work(priv->workqueue, &priv->restart); 5064 queue_work(priv->workqueue, &priv->restart);
5065 }
5060 5066
5061 handled |= CSR_INT_BIT_RF_KILL; 5067 handled |= CSR_INT_BIT_RF_KILL;
5062 } 5068 }
@@ -6523,6 +6529,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
6523 mutex_lock(&priv->mutex); 6529 mutex_lock(&priv->mutex);
6524 6530
6525 if (rc) { 6531 if (rc) {
6532 iwl_rate_control_unregister(priv->hw);
6526 IWL_ERROR("Failed to register network " 6533 IWL_ERROR("Failed to register network "
6527 "device (error %d)\n", rc); 6534 "device (error %d)\n", rc);
6528 return; 6535 return;
@@ -6594,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv)
6594 /* Unblock any waiting calls */ 6601 /* Unblock any waiting calls */
6595 wake_up_interruptible_all(&priv->wait_command_queue); 6602 wake_up_interruptible_all(&priv->wait_command_queue);
6596 6603
6597 iwl_cancel_deferred_work(priv);
6598
6599 /* Wipe out the EXIT_PENDING status bit if we are not actually 6604 /* Wipe out the EXIT_PENDING status bit if we are not actually
6600 * exiting the module */ 6605 * exiting the module */
6601 if (!exit_pending) 6606 if (!exit_pending)
@@ -6670,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv)
6670 mutex_lock(&priv->mutex); 6675 mutex_lock(&priv->mutex);
6671 __iwl_down(priv); 6676 __iwl_down(priv);
6672 mutex_unlock(&priv->mutex); 6677 mutex_unlock(&priv->mutex);
6678
6679 iwl_cancel_deferred_work(priv);
6673} 6680}
6674 6681
6675#define MAX_HW_RESTARTS 5 6682#define MAX_HW_RESTARTS 5
@@ -6691,6 +6698,11 @@ static int __iwl_up(struct iwl_priv *priv)
6691 return 0; 6698 return 0;
6692 } 6699 }
6693 6700
6701 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
6702 IWL_ERROR("ucode not available for device bringup\n");
6703 return -EIO;
6704 }
6705
6694 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 6706 iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
6695 6707
6696 rc = iwl_hw_nic_init(priv); 6708 rc = iwl_hw_nic_init(priv);
@@ -7326,9 +7338,6 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
7326 DECLARE_MAC_BUF(mac); 7338 DECLARE_MAC_BUF(mac);
7327 7339
7328 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); 7340 IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type);
7329 if (conf->mac_addr)
7330 IWL_DEBUG_MAC80211("enter: MAC %s\n",
7331 print_mac(mac, conf->mac_addr));
7332 7341
7333 if (priv->interface_id) { 7342 if (priv->interface_id) {
7334 IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); 7343 IWL_DEBUG_MAC80211("leave - interface_id != 0\n");
@@ -7341,6 +7350,11 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
7341 spin_unlock_irqrestore(&priv->lock, flags); 7350 spin_unlock_irqrestore(&priv->lock, flags);
7342 7351
7343 mutex_lock(&priv->mutex); 7352 mutex_lock(&priv->mutex);
7353
7354 if (conf->mac_addr) {
7355 IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr));
7356 memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
7357 }
7344 iwl_set_mode(priv, conf->type); 7358 iwl_set_mode(priv, conf->type);
7345 7359
7346 IWL_DEBUG_MAC80211("leave\n"); 7360 IWL_DEBUG_MAC80211("leave\n");
@@ -8864,6 +8878,7 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
8864{ 8878{
8865 iwl_hw_cancel_deferred_work(priv); 8879 iwl_hw_cancel_deferred_work(priv);
8866 8880
8881 cancel_delayed_work_sync(&priv->init_alive_start);
8867 cancel_delayed_work(&priv->scan_check); 8882 cancel_delayed_work(&priv->scan_check);
8868 cancel_delayed_work(&priv->alive_start); 8883 cancel_delayed_work(&priv->alive_start);
8869 cancel_delayed_work(&priv->post_associate); 8884 cancel_delayed_work(&priv->post_associate);
@@ -9164,10 +9179,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
9164 9179
9165 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 9180 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
9166 9181
9167 mutex_lock(&priv->mutex);
9168 set_bit(STATUS_EXIT_PENDING, &priv->status); 9182 set_bit(STATUS_EXIT_PENDING, &priv->status);
9169 __iwl_down(priv); 9183
9170 mutex_unlock(&priv->mutex); 9184 iwl_down(priv);
9171 9185
9172 /* Free MAC hash list for ADHOC */ 9186 /* Free MAC hash list for ADHOC */
9173 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 9187 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -9226,12 +9240,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9226{ 9240{
9227 struct iwl_priv *priv = pci_get_drvdata(pdev); 9241 struct iwl_priv *priv = pci_get_drvdata(pdev);
9228 9242
9229 mutex_lock(&priv->mutex);
9230
9231 set_bit(STATUS_IN_SUSPEND, &priv->status); 9243 set_bit(STATUS_IN_SUSPEND, &priv->status);
9232 9244
9233 /* Take down the device; powers it off, etc. */ 9245 /* Take down the device; powers it off, etc. */
9234 __iwl_down(priv); 9246 iwl_down(priv);
9235 9247
9236 if (priv->mac80211_registered) 9248 if (priv->mac80211_registered)
9237 ieee80211_stop_queues(priv->hw); 9249 ieee80211_stop_queues(priv->hw);
@@ -9240,8 +9252,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9240 pci_disable_device(pdev); 9252 pci_disable_device(pdev);
9241 pci_set_power_state(pdev, PCI_D3hot); 9253 pci_set_power_state(pdev, PCI_D3hot);
9242 9254
9243 mutex_unlock(&priv->mutex);
9244
9245 return 0; 9255 return 0;
9246} 9256}
9247 9257
@@ -9299,8 +9309,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9299 9309
9300 printk(KERN_INFO "Coming out of suspend...\n"); 9310 printk(KERN_INFO "Coming out of suspend...\n");
9301 9311
9302 mutex_lock(&priv->mutex);
9303
9304 pci_set_power_state(pdev, PCI_D0); 9312 pci_set_power_state(pdev, PCI_D0);
9305 err = pci_enable_device(pdev); 9313 err = pci_enable_device(pdev);
9306 pci_restore_state(pdev); 9314 pci_restore_state(pdev);
@@ -9314,7 +9322,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9314 pci_write_config_byte(pdev, 0x41, 0x00); 9322 pci_write_config_byte(pdev, 0x41, 0x00);
9315 9323
9316 iwl_resume(priv); 9324 iwl_resume(priv);
9317 mutex_unlock(&priv->mutex);
9318 9325
9319 return 0; 9326 return 0;
9320} 9327}
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index ec89dabc412c..ba4fc2b3bf0a 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -170,7 +170,8 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r
170#define IF_CS_H_IC_TX_OVER 0x0001 170#define IF_CS_H_IC_TX_OVER 0x0001
171#define IF_CS_H_IC_RX_OVER 0x0002 171#define IF_CS_H_IC_RX_OVER 0x0002
172#define IF_CS_H_IC_DNLD_OVER 0x0004 172#define IF_CS_H_IC_DNLD_OVER 0x0004
173#define IF_CS_H_IC_HOST_EVENT 0x0008 173#define IF_CS_H_IC_POWER_DOWN 0x0008
174#define IF_CS_H_IC_HOST_EVENT 0x0010
174#define IF_CS_H_IC_MASK 0x001f 175#define IF_CS_H_IC_MASK 0x001f
175 176
176#define IF_CS_H_INT_MASK 0x00000004 177#define IF_CS_H_INT_MASK 0x00000004
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index b24425f74883..4f1efb108c28 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -871,6 +871,10 @@ static int if_sdio_probe(struct sdio_func *func,
871 if (sscanf(func->card->info[i], 871 if (sscanf(func->card->info[i],
872 "ID: %x", &model) == 1) 872 "ID: %x", &model) == 1)
873 break; 873 break;
874 if (!strcmp(func->card->info[i], "IBIS Wireless SDIO Card")) {
875 model = 4;
876 break;
877 }
874 } 878 }
875 879
876 if (i == func->card->num_info) { 880 if (i == func->card->num_info) {
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 5ead08312e1e..1823b48a8ba7 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1165,8 +1165,6 @@ wlan_private *libertas_add_card(void *card, struct device *dmdev)
1165#ifdef WIRELESS_EXT 1165#ifdef WIRELESS_EXT
1166 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; 1166 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
1167#endif 1167#endif
1168#define NETIF_F_DYNALLOC 16
1169 dev->features |= NETIF_F_DYNALLOC;
1170 dev->flags |= IFF_BROADCAST | IFF_MULTICAST; 1168 dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
1171 dev->set_multicast_list = libertas_set_multicast_list; 1169 dev->set_multicast_list = libertas_set_multicast_list;
1172 1170
@@ -1348,8 +1346,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
1348#ifdef WIRELESS_EXT 1346#ifdef WIRELESS_EXT
1349 mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def; 1347 mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;
1350#endif 1348#endif
1351#define NETIF_F_DYNALLOC 16
1352
1353 /* Register virtual mesh interface */ 1349 /* Register virtual mesh interface */
1354 ret = register_netdev(mesh_dev); 1350 ret = register_netdev(mesh_dev);
1355 if (ret) { 1351 if (ret) {
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index c6f5aa3cb465..395b7882d4d6 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1528,7 +1528,7 @@ static int wlan_set_encodeext(struct net_device *dev,
1528 && (ext->key_len != KEY_LEN_WPA_TKIP)) 1528 && (ext->key_len != KEY_LEN_WPA_TKIP))
1529 || ((alg == IW_ENCODE_ALG_CCMP) 1529 || ((alg == IW_ENCODE_ALG_CCMP)
1530 && (ext->key_len != KEY_LEN_WPA_AES))) { 1530 && (ext->key_len != KEY_LEN_WPA_AES))) {
1531 lbs_deb_wext("invalid size %d for key of alg" 1531 lbs_deb_wext("invalid size %d for key of alg "
1532 "type %d\n", 1532 "type %d\n",
1533 ext->key_len, 1533 ext->key_len,
1534 alg); 1534 alg);
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 2402cb8dd328..d2fa079fbc4c 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -806,7 +806,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
806 for (i = 0; i < 6; i++) 806 for (i = 0; i < 6; i++)
807 dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i); 807 dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i);
808 808
809 printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx" 809 printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx, "
810 "id %c%c, hw_addr %s\n", 810 "id %c%c, hw_addr %s\n",
811 dev->name, dev->base_addr, dev->irq, 811 dev->name, dev->base_addr, dev->irq,
812 (u_long) ramBase, 812 (u_long) ramBase,
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c
index 755482a5a938..60d286eb0b8b 100644
--- a/drivers/net/wireless/p54usb.c
+++ b/drivers/net/wireless/p54usb.c
@@ -308,7 +308,7 @@ static int p54u_read_eeprom(struct ieee80211_hw *dev)
308 308
309 buf = kmalloc(0x2020, GFP_KERNEL); 309 buf = kmalloc(0x2020, GFP_KERNEL);
310 if (!buf) { 310 if (!buf) {
311 printk(KERN_ERR "prism54usb: cannot allocate memory for" 311 printk(KERN_ERR "prism54usb: cannot allocate memory for "
312 "eeprom readback!\n"); 312 "eeprom readback!\n");
313 return -ENOMEM; 313 return -ENOMEM;
314 } 314 }
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 277a020b35e9..18b1f9145389 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -257,7 +257,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, 257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev,
258 __le32 *mac) 258 __le32 *mac)
259{ 259{
260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, &mac, 260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac,
261 (3 * sizeof(__le16))); 261 (3 * sizeof(__le16)));
262} 262}
263 263
@@ -1032,7 +1032,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1032} 1032}
1033 1033
1034static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, 1034static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1035 int maxpacket, struct sk_buff *skb) 1035 struct sk_buff *skb)
1036{ 1036{
1037 int length; 1037 int length;
1038 1038
@@ -1041,7 +1041,7 @@ static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1041 * but it must _not_ be a multiple of the USB packet size. 1041 * but it must _not_ be a multiple of the USB packet size.
1042 */ 1042 */
1043 length = roundup(skb->len, 2); 1043 length = roundup(skb->len, 2);
1044 length += (2 * !(length % maxpacket)); 1044 length += (2 * !(length % rt2x00dev->usb_maxpacket));
1045 1045
1046 return length; 1046 return length;
1047} 1047}
@@ -1643,7 +1643,6 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1643 struct data_entry *beacon; 1643 struct data_entry *beacon;
1644 struct data_entry *guardian; 1644 struct data_entry *guardian;
1645 int pipe = usb_sndbulkpipe(usb_dev, 1); 1645 int pipe = usb_sndbulkpipe(usb_dev, 1);
1646 int max_packet = usb_maxpacket(usb_dev, pipe, 1);
1647 int length; 1646 int length;
1648 1647
1649 /* 1648 /*
@@ -1672,7 +1671,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1672 ring->desc_size), 1671 ring->desc_size),
1673 skb->len - ring->desc_size, control); 1672 skb->len - ring->desc_size, control);
1674 1673
1675 length = rt2500usb_get_tx_data_len(rt2x00dev, max_packet, skb); 1674 length = rt2500usb_get_tx_data_len(rt2x00dev, skb);
1676 1675
1677 usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, 1676 usb_fill_bulk_urb(beacon->priv, usb_dev, pipe,
1678 skb->data, length, rt2500usb_beacondone, beacon); 1677 skb->data, length, rt2500usb_beacondone, beacon);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index d1ad5251a77a..c8f16f161c28 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -418,7 +418,7 @@ struct rt2x00lib_ops {
418 int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, 418 int (*write_tx_data) (struct rt2x00_dev *rt2x00dev,
419 struct data_ring *ring, struct sk_buff *skb, 419 struct data_ring *ring, struct sk_buff *skb,
420 struct ieee80211_tx_control *control); 420 struct ieee80211_tx_control *control);
421 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, int maxpacket, 421 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev,
422 struct sk_buff *skb); 422 struct sk_buff *skb);
423 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, 423 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
424 unsigned int queue); 424 unsigned int queue);
@@ -599,6 +599,11 @@ struct rt2x00_dev {
599 u32 *rf; 599 u32 *rf;
600 600
601 /* 601 /*
602 * USB Max frame size (for rt2500usb & rt73usb).
603 */
604 u16 usb_maxpacket;
605
606 /*
602 * Current TX power value. 607 * Current TX power value.
603 */ 608 */
604 u16 tx_power; 609 u16 tx_power;
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 2780df00623c..04663eb31950 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -124,7 +124,10 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
124 struct data_entry *entry; 124 struct data_entry *entry;
125 struct data_desc *rxd; 125 struct data_desc *rxd;
126 struct sk_buff *skb; 126 struct sk_buff *skb;
127 struct ieee80211_hdr *hdr;
127 struct rxdata_entry_desc desc; 128 struct rxdata_entry_desc desc;
129 int header_size;
130 int align;
128 u32 word; 131 u32 word;
129 132
130 while (1) { 133 while (1) {
@@ -138,17 +141,26 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
138 memset(&desc, 0x00, sizeof(desc)); 141 memset(&desc, 0x00, sizeof(desc));
139 rt2x00dev->ops->lib->fill_rxdone(entry, &desc); 142 rt2x00dev->ops->lib->fill_rxdone(entry, &desc);
140 143
144 hdr = (struct ieee80211_hdr *)entry->data_addr;
145 header_size =
146 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
147
148 /*
149 * The data behind the ieee80211 header must be
150 * aligned on a 4 byte boundary.
151 */
152 align = header_size % 4;
153
141 /* 154 /*
142 * Allocate the sk_buffer, initialize it and copy 155 * Allocate the sk_buffer, initialize it and copy
143 * all data into it. 156 * all data into it.
144 */ 157 */
145 skb = dev_alloc_skb(desc.size + NET_IP_ALIGN); 158 skb = dev_alloc_skb(desc.size + align);
146 if (!skb) 159 if (!skb)
147 return; 160 return;
148 161
149 skb_reserve(skb, NET_IP_ALIGN); 162 skb_reserve(skb, align);
150 skb_put(skb, desc.size); 163 memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size);
151 memcpy(skb->data, entry->data_addr, desc.size);
152 164
153 /* 165 /*
154 * Send the frame to rt2x00lib for further processing. 166 * Send the frame to rt2x00lib for further processing.
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 73cc726c4046..568d73847dca 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -159,7 +159,6 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
159 interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); 159 interface_to_usbdev(rt2x00dev_usb(rt2x00dev));
160 struct data_entry *entry = rt2x00_get_data_entry(ring); 160 struct data_entry *entry = rt2x00_get_data_entry(ring);
161 int pipe = usb_sndbulkpipe(usb_dev, 1); 161 int pipe = usb_sndbulkpipe(usb_dev, 1);
162 int max_packet = usb_maxpacket(usb_dev, pipe, 1);
163 u32 length; 162 u32 length;
164 163
165 if (rt2x00_ring_full(ring)) { 164 if (rt2x00_ring_full(ring)) {
@@ -194,8 +193,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
194 * length of the data to usb_fill_bulk_urb. Pass the skb 193 * length of the data to usb_fill_bulk_urb. Pass the skb
195 * to the driver to determine what the length should be. 194 * to the driver to determine what the length should be.
196 */ 195 */
197 length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, 196 length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, skb);
198 max_packet, skb);
199 197
200 /* 198 /*
201 * Initialize URB and send the frame to the device. 199 * Initialize URB and send the frame to the device.
@@ -223,7 +221,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
223 struct data_ring *ring = entry->ring; 221 struct data_ring *ring = entry->ring;
224 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; 222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev;
225 struct sk_buff *skb; 223 struct sk_buff *skb;
224 struct ieee80211_hdr *hdr;
226 struct rxdata_entry_desc desc; 225 struct rxdata_entry_desc desc;
226 int header_size;
227 int frame_size; 227 int frame_size;
228 228
229 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || 229 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
@@ -245,19 +245,37 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
245 * Allocate a new sk buffer to replace the current one. 245 * Allocate a new sk buffer to replace the current one.
246 * If allocation fails, we should drop the current frame 246 * If allocation fails, we should drop the current frame
247 * so we can recycle the existing sk buffer for the new frame. 247 * so we can recycle the existing sk buffer for the new frame.
248 * As alignment we use 2 and not NET_IP_ALIGN because we need
249 * to be sure we have 2 bytes room in the head. (NET_IP_ALIGN
250 * can be 0 on some hardware). We use these 2 bytes for frame
251 * alignment later, we assume that the chance that
252 * header_size % 4 == 2 is bigger then header_size % 2 == 0
253 * and thus optimize alignment by reserving the 2 bytes in
254 * advance.
248 */ 255 */
249 frame_size = entry->ring->data_size + entry->ring->desc_size; 256 frame_size = entry->ring->data_size + entry->ring->desc_size;
250 skb = dev_alloc_skb(frame_size + NET_IP_ALIGN); 257 skb = dev_alloc_skb(frame_size + 2);
251 if (!skb) 258 if (!skb)
252 goto skip_entry; 259 goto skip_entry;
253 260
254 skb_reserve(skb, NET_IP_ALIGN); 261 skb_reserve(skb, 2);
255 skb_put(skb, frame_size); 262 skb_put(skb, frame_size);
256 263
257 /* 264 /*
258 * Trim the skb_buffer to only contain the valid 265 * The data behind the ieee80211 header must be
259 * frame data (so ignore the device's descriptor). 266 * aligned on a 4 byte boundary.
267 * After that trim the entire buffer down to only
268 * contain the valid frame data excluding the device
269 * descriptor.
260 */ 270 */
271 hdr = (struct ieee80211_hdr *)entry->skb->data;
272 header_size =
273 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
274
275 if (header_size % 4 == 0) {
276 skb_push(entry->skb, 2);
277 memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2);
278 }
261 skb_trim(entry->skb, desc.size); 279 skb_trim(entry->skb, desc.size);
262 280
263 /* 281 /*
@@ -490,6 +508,11 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
490 rt2x00dev->ops = ops; 508 rt2x00dev->ops = ops;
491 rt2x00dev->hw = hw; 509 rt2x00dev->hw = hw;
492 510
511 rt2x00dev->usb_maxpacket =
512 usb_maxpacket(usb_dev, usb_sndbulkpipe(usb_dev, 1), 1);
513 if (!rt2x00dev->usb_maxpacket)
514 rt2x00dev->usb_maxpacket = 1;
515
493 retval = rt2x00usb_alloc_reg(rt2x00dev); 516 retval = rt2x00usb_alloc_reg(rt2x00dev);
494 if (retval) 517 if (retval)
495 goto exit_free_device; 518 goto exit_free_device;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 01dbef19d651..ecae968ce091 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1738,6 +1738,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1738{ 1738{
1739 struct data_ring *ring; 1739 struct data_ring *ring;
1740 struct data_entry *entry; 1740 struct data_entry *entry;
1741 struct data_entry *entry_done;
1741 struct data_desc *txd; 1742 struct data_desc *txd;
1742 u32 word; 1743 u32 word;
1743 u32 reg; 1744 u32 reg;
@@ -1791,6 +1792,17 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1791 !rt2x00_get_field32(word, TXD_W0_VALID)) 1792 !rt2x00_get_field32(word, TXD_W0_VALID))
1792 return; 1793 return;
1793 1794
1795 entry_done = rt2x00_get_data_entry_done(ring);
1796 while (entry != entry_done) {
1797 /* Catch up. Just report any entries we missed as
1798 * failed. */
1799 WARNING(rt2x00dev,
1800 "TX status report missed for entry %p\n",
1801 entry_done);
1802 rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0);
1803 entry_done = rt2x00_get_data_entry_done(ring);
1804 }
1805
1794 /* 1806 /*
1795 * Obtain the status about this packet. 1807 * Obtain the status about this packet.
1796 */ 1808 */
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index dc640bf6b5eb..c0671c2e6e73 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1251,7 +1251,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1251} 1251}
1252 1252
1253static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, 1253static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1254 int maxpacket, struct sk_buff *skb) 1254 struct sk_buff *skb)
1255{ 1255{
1256 int length; 1256 int length;
1257 1257
@@ -1260,7 +1260,7 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1260 * but it must _not_ be a multiple of the USB packet size. 1260 * but it must _not_ be a multiple of the USB packet size.
1261 */ 1261 */
1262 length = roundup(skb->len, 4); 1262 length = roundup(skb->len, 4);
1263 length += (4 * !(length % maxpacket)); 1263 length += (4 * !(length % rt2x00dev->usb_maxpacket));
1264 1264
1265 return length; 1265 return length;
1266} 1266}
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index e454ae83e97a..bd1ab3b3afc0 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
38 {USB_DEVICE(0x0846, 0x6a00)}, 38 {USB_DEVICE(0x0846, 0x6a00)},
39 /* HP */ 39 /* HP */
40 {USB_DEVICE(0x03f0, 0xca02)}, 40 {USB_DEVICE(0x03f0, 0xca02)},
41 /* Sitecom */
42 {USB_DEVICE(0x0df6, 0x000d)},
41 {} 43 {}
42}; 44};
43 45
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a903645e157a..5298a8bf1129 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -1130,6 +1130,8 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
1130 __skb_trim(skb, skb->len - 1130 __skb_trim(skb, skb->len -
1131 (IEEE80211_FCS_LEN + sizeof(struct rx_status))); 1131 (IEEE80211_FCS_LEN + sizeof(struct rx_status)));
1132 1132
1133 ZD_ASSERT(IS_ALIGNED((unsigned long)skb->data, 4));
1134
1133 update_qual_rssi(mac, skb->data, skb->len, stats.signal, 1135 update_qual_rssi(mac, skb->data, skb->len, stats.signal,
1134 status->signal_strength); 1136 status->signal_strength);
1135 1137
@@ -1166,15 +1168,19 @@ static void do_rx(unsigned long mac_ptr)
1166int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length) 1168int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
1167{ 1169{
1168 struct sk_buff *skb; 1170 struct sk_buff *skb;
1171 unsigned int reserved =
1172 ALIGN(max_t(unsigned int,
1173 sizeof(struct zd_rt_hdr), ZD_PLCP_HEADER_SIZE), 4) -
1174 ZD_PLCP_HEADER_SIZE;
1169 1175
1170 skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length); 1176 skb = dev_alloc_skb(reserved + length);
1171 if (!skb) { 1177 if (!skb) {
1172 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); 1178 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
1173 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); 1179 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
1174 ieee->stats.rx_dropped++; 1180 ieee->stats.rx_dropped++;
1175 return -ENOMEM; 1181 return -ENOMEM;
1176 } 1182 }
1177 skb_reserve(skb, sizeof(struct zd_rt_hdr)); 1183 skb_reserve(skb, reserved);
1178 memcpy(__skb_put(skb, length), buffer, length); 1184 memcpy(__skb_put(skb, length), buffer, length);
1179 skb_queue_tail(&mac->rx_queue, skb); 1185 skb_queue_tail(&mac->rx_queue, skb);
1180 tasklet_schedule(&mac->rx_tasklet); 1186 tasklet_schedule(&mac->rx_tasklet);