aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-07-16 17:59:03 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-16 17:59:03 -0400
commit5be808467347fc99bdd216883c5dbd123d6ad9d6 (patch)
tree7fe3f1ee051d261bb3739c5f9f1bb8489a0d6f71 /drivers/net
parent8910b49fbb8d4517a20bb3de7dc239dcfa7d2b6f (diff)
parent4cf92a3cd9117cb90ad9441172b9f42b67ee9d26 (diff)
Merge branch 'upstream-jgarzik' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into upstream
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/airo.c208
-rw-r--r--drivers/net/wireless/ipw2100.c11
-rw-r--r--drivers/net/wireless/ipw2200.c5
-rw-r--r--drivers/net/wireless/libertas/cmd.c2
-rw-r--r--drivers/net/wireless/libertas/rx.c1
-rw-r--r--drivers/net/wireless/libertas/version.h1
-rw-r--r--drivers/net/wireless/libertas/wext.c3
-rw-r--r--drivers/net/wireless/prism54/isl_ioctl.c22
-rw-r--r--drivers/net/wireless/rtl8187_rtl8225.c4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c88
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.h13
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c59
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.h3
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf.c3
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf.h2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_al2230.c12
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_al7230b.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_rf2959.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_uw2453.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c98
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.h3
21 files changed, 276 insertions, 268 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 2d3a180dada0..1c54908fdc4c 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -52,6 +52,8 @@
52 52
53#include "airo.h" 53#include "airo.h"
54 54
55#define DRV_NAME "airo"
56
55#ifdef CONFIG_PCI 57#ifdef CONFIG_PCI
56static struct pci_device_id card_ids[] = { 58static struct pci_device_id card_ids[] = {
57 { 0x14b9, 1, PCI_ANY_ID, PCI_ANY_ID, }, 59 { 0x14b9, 1, PCI_ANY_ID, PCI_ANY_ID, },
@@ -71,7 +73,7 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state);
71static int airo_pci_resume(struct pci_dev *pdev); 73static int airo_pci_resume(struct pci_dev *pdev);
72 74
73static struct pci_driver airo_driver = { 75static struct pci_driver airo_driver = {
74 .name = "airo", 76 .name = DRV_NAME,
75 .id_table = card_ids, 77 .id_table = card_ids,
76 .probe = airo_pci_probe, 78 .probe = airo_pci_probe,
77 .remove = __devexit_p(airo_pci_remove), 79 .remove = __devexit_p(airo_pci_remove),
@@ -1092,7 +1094,7 @@ static int get_dec_u16( char *buffer, int *start, int limit );
1092static void OUT4500( struct airo_info *, u16 register, u16 value ); 1094static void OUT4500( struct airo_info *, u16 register, u16 value );
1093static unsigned short IN4500( struct airo_info *, u16 register ); 1095static unsigned short IN4500( struct airo_info *, u16 register );
1094static u16 setup_card(struct airo_info*, u8 *mac, int lock); 1096static u16 setup_card(struct airo_info*, u8 *mac, int lock);
1095static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ); 1097static int enable_MAC(struct airo_info *ai, int lock);
1096static void disable_MAC(struct airo_info *ai, int lock); 1098static void disable_MAC(struct airo_info *ai, int lock);
1097static void enable_interrupts(struct airo_info*); 1099static void enable_interrupts(struct airo_info*);
1098static void disable_interrupts(struct airo_info*); 1100static void disable_interrupts(struct airo_info*);
@@ -1250,7 +1252,7 @@ static int flashputbuf(struct airo_info *ai);
1250static int flashrestart(struct airo_info *ai,struct net_device *dev); 1252static int flashrestart(struct airo_info *ai,struct net_device *dev);
1251 1253
1252#define airo_print(type, name, fmt, args...) \ 1254#define airo_print(type, name, fmt, args...) \
1253 { printk(type "airo(%s): " fmt "\n", name, ##args); } 1255 printk(type DRV_NAME "(%s): " fmt "\n", name, ##args)
1254 1256
1255#define airo_print_info(name, fmt, args...) \ 1257#define airo_print_info(name, fmt, args...) \
1256 airo_print(KERN_INFO, name, fmt, ##args) 1258 airo_print(KERN_INFO, name, fmt, ##args)
@@ -1926,28 +1928,54 @@ static int readStatsRid(struct airo_info*ai, StatsRid *sr, int rid, int lock) {
1926 return rc; 1928 return rc;
1927} 1929}
1928 1930
1931static void try_auto_wep(struct airo_info *ai)
1932{
1933 if (auto_wep && !(ai->flags & FLAG_RADIO_DOWN)) {
1934 ai->expires = RUN_AT(3*HZ);
1935 wake_up_interruptible(&ai->thr_wait);
1936 }
1937}
1938
1929static int airo_open(struct net_device *dev) { 1939static int airo_open(struct net_device *dev) {
1930 struct airo_info *info = dev->priv; 1940 struct airo_info *ai = dev->priv;
1931 Resp rsp; 1941 int rc = 0;
1932 1942
1933 if (test_bit(FLAG_FLASHING, &info->flags)) 1943 if (test_bit(FLAG_FLASHING, &ai->flags))
1934 return -EIO; 1944 return -EIO;
1935 1945
1936 /* Make sure the card is configured. 1946 /* Make sure the card is configured.
1937 * Wireless Extensions may postpone config changes until the card 1947 * Wireless Extensions may postpone config changes until the card
1938 * is open (to pipeline changes and speed-up card setup). If 1948 * is open (to pipeline changes and speed-up card setup). If
1939 * those changes are not yet commited, do it now - Jean II */ 1949 * those changes are not yet commited, do it now - Jean II */
1940 if (test_bit (FLAG_COMMIT, &info->flags)) { 1950 if (test_bit(FLAG_COMMIT, &ai->flags)) {
1941 disable_MAC(info, 1); 1951 disable_MAC(ai, 1);
1942 writeConfigRid(info, 1); 1952 writeConfigRid(ai, 1);
1943 } 1953 }
1944 1954
1945 if (info->wifidev != dev) { 1955 if (ai->wifidev != dev) {
1956 clear_bit(JOB_DIE, &ai->jobs);
1957 ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name);
1958 if (IS_ERR(ai->airo_thread_task))
1959 return (int)PTR_ERR(ai->airo_thread_task);
1960
1961 rc = request_irq(dev->irq, airo_interrupt, IRQF_SHARED,
1962 dev->name, dev);
1963 if (rc) {
1964 airo_print_err(dev->name,
1965 "register interrupt %d failed, rc %d",
1966 dev->irq, rc);
1967 set_bit(JOB_DIE, &ai->jobs);
1968 kthread_stop(ai->airo_thread_task);
1969 return rc;
1970 }
1971
1946 /* Power on the MAC controller (which may have been disabled) */ 1972 /* Power on the MAC controller (which may have been disabled) */
1947 clear_bit(FLAG_RADIO_DOWN, &info->flags); 1973 clear_bit(FLAG_RADIO_DOWN, &ai->flags);
1948 enable_interrupts(info); 1974 enable_interrupts(ai);
1975
1976 try_auto_wep(ai);
1949 } 1977 }
1950 enable_MAC(info, &rsp, 1); 1978 enable_MAC(ai, 1);
1951 1979
1952 netif_start_queue(dev); 1980 netif_start_queue(dev);
1953 return 0; 1981 return 0;
@@ -2338,14 +2366,13 @@ static int airo_set_mac_address(struct net_device *dev, void *p)
2338{ 2366{
2339 struct airo_info *ai = dev->priv; 2367 struct airo_info *ai = dev->priv;
2340 struct sockaddr *addr = p; 2368 struct sockaddr *addr = p;
2341 Resp rsp;
2342 2369
2343 readConfigRid(ai, 1); 2370 readConfigRid(ai, 1);
2344 memcpy (ai->config.macAddr, addr->sa_data, dev->addr_len); 2371 memcpy (ai->config.macAddr, addr->sa_data, dev->addr_len);
2345 set_bit (FLAG_COMMIT, &ai->flags); 2372 set_bit (FLAG_COMMIT, &ai->flags);
2346 disable_MAC(ai, 1); 2373 disable_MAC(ai, 1);
2347 writeConfigRid (ai, 1); 2374 writeConfigRid (ai, 1);
2348 enable_MAC(ai, &rsp, 1); 2375 enable_MAC(ai, 1);
2349 memcpy (ai->dev->dev_addr, addr->sa_data, dev->addr_len); 2376 memcpy (ai->dev->dev_addr, addr->sa_data, dev->addr_len);
2350 if (ai->wifidev) 2377 if (ai->wifidev)
2351 memcpy (ai->wifidev->dev_addr, addr->sa_data, dev->addr_len); 2378 memcpy (ai->wifidev->dev_addr, addr->sa_data, dev->addr_len);
@@ -2392,6 +2419,11 @@ static int airo_close(struct net_device *dev) {
2392 disable_MAC(ai, 1); 2419 disable_MAC(ai, 1);
2393#endif 2420#endif
2394 disable_interrupts( ai ); 2421 disable_interrupts( ai );
2422
2423 free_irq(dev->irq, dev);
2424
2425 set_bit(JOB_DIE, &ai->jobs);
2426 kthread_stop(ai->airo_thread_task);
2395 } 2427 }
2396 return 0; 2428 return 0;
2397} 2429}
@@ -2403,7 +2435,6 @@ void stop_airo_card( struct net_device *dev, int freeres )
2403 set_bit(FLAG_RADIO_DOWN, &ai->flags); 2435 set_bit(FLAG_RADIO_DOWN, &ai->flags);
2404 disable_MAC(ai, 1); 2436 disable_MAC(ai, 1);
2405 disable_interrupts(ai); 2437 disable_interrupts(ai);
2406 free_irq( dev->irq, dev );
2407 takedown_proc_entry( dev, ai ); 2438 takedown_proc_entry( dev, ai );
2408 if (test_bit(FLAG_REGISTERED, &ai->flags)) { 2439 if (test_bit(FLAG_REGISTERED, &ai->flags)) {
2409 unregister_netdev( dev ); 2440 unregister_netdev( dev );
@@ -2414,9 +2445,6 @@ void stop_airo_card( struct net_device *dev, int freeres )
2414 } 2445 }
2415 clear_bit(FLAG_REGISTERED, &ai->flags); 2446 clear_bit(FLAG_REGISTERED, &ai->flags);
2416 } 2447 }
2417 set_bit(JOB_DIE, &ai->jobs);
2418 kthread_stop(ai->airo_thread_task);
2419
2420 /* 2448 /*
2421 * Clean out tx queue 2449 * Clean out tx queue
2422 */ 2450 */
@@ -2554,8 +2582,7 @@ static int mpi_init_descriptors (struct airo_info *ai)
2554 * 2) Map PCI memory for issueing commands. 2582 * 2) Map PCI memory for issueing commands.
2555 * 3) Allocate memory (shared) to send and receive ethernet frames. 2583 * 3) Allocate memory (shared) to send and receive ethernet frames.
2556 */ 2584 */
2557static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci, 2585static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci)
2558 const char *name)
2559{ 2586{
2560 unsigned long mem_start, mem_len, aux_start, aux_len; 2587 unsigned long mem_start, mem_len, aux_start, aux_len;
2561 int rc = -1; 2588 int rc = -1;
@@ -2569,35 +2596,35 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci,
2569 aux_start = pci_resource_start(pci, 2); 2596 aux_start = pci_resource_start(pci, 2);
2570 aux_len = AUXMEMSIZE; 2597 aux_len = AUXMEMSIZE;
2571 2598
2572 if (!request_mem_region(mem_start, mem_len, name)) { 2599 if (!request_mem_region(mem_start, mem_len, DRV_NAME)) {
2573 airo_print_err(ai->dev->name, "Couldn't get region %x[%x] for %s", 2600 airo_print_err("", "Couldn't get region %x[%x]",
2574 (int)mem_start, (int)mem_len, name); 2601 (int)mem_start, (int)mem_len);
2575 goto out; 2602 goto out;
2576 } 2603 }
2577 if (!request_mem_region(aux_start, aux_len, name)) { 2604 if (!request_mem_region(aux_start, aux_len, DRV_NAME)) {
2578 airo_print_err(ai->dev->name, "Couldn't get region %x[%x] for %s", 2605 airo_print_err("", "Couldn't get region %x[%x]",
2579 (int)aux_start, (int)aux_len, name); 2606 (int)aux_start, (int)aux_len);
2580 goto free_region1; 2607 goto free_region1;
2581 } 2608 }
2582 2609
2583 ai->pcimem = ioremap(mem_start, mem_len); 2610 ai->pcimem = ioremap(mem_start, mem_len);
2584 if (!ai->pcimem) { 2611 if (!ai->pcimem) {
2585 airo_print_err(ai->dev->name, "Couldn't map region %x[%x] for %s", 2612 airo_print_err("", "Couldn't map region %x[%x]",
2586 (int)mem_start, (int)mem_len, name); 2613 (int)mem_start, (int)mem_len);
2587 goto free_region2; 2614 goto free_region2;
2588 } 2615 }
2589 ai->pciaux = ioremap(aux_start, aux_len); 2616 ai->pciaux = ioremap(aux_start, aux_len);
2590 if (!ai->pciaux) { 2617 if (!ai->pciaux) {
2591 airo_print_err(ai->dev->name, "Couldn't map region %x[%x] for %s", 2618 airo_print_err("", "Couldn't map region %x[%x]",
2592 (int)aux_start, (int)aux_len, name); 2619 (int)aux_start, (int)aux_len);
2593 goto free_memmap; 2620 goto free_memmap;
2594 } 2621 }
2595 2622
2596 /* Reserve PKTSIZE for each fid and 2K for the Rids */ 2623 /* Reserve PKTSIZE for each fid and 2K for the Rids */
2597 ai->shared = pci_alloc_consistent(pci, PCI_SHARED_LEN, &ai->shared_dma); 2624 ai->shared = pci_alloc_consistent(pci, PCI_SHARED_LEN, &ai->shared_dma);
2598 if (!ai->shared) { 2625 if (!ai->shared) {
2599 airo_print_err(ai->dev->name, "Couldn't alloc_consistent %d", 2626 airo_print_err("", "Couldn't alloc_consistent %d",
2600 PCI_SHARED_LEN); 2627 PCI_SHARED_LEN);
2601 goto free_auxmap; 2628 goto free_auxmap;
2602 } 2629 }
2603 2630
@@ -2742,7 +2769,7 @@ static int airo_networks_allocate(struct airo_info *ai)
2742 kzalloc(AIRO_MAX_NETWORK_COUNT * sizeof(BSSListElement), 2769 kzalloc(AIRO_MAX_NETWORK_COUNT * sizeof(BSSListElement),
2743 GFP_KERNEL); 2770 GFP_KERNEL);
2744 if (!ai->networks) { 2771 if (!ai->networks) {
2745 airo_print_warn(ai->dev->name, "Out of memory allocating beacons"); 2772 airo_print_warn("", "Out of memory allocating beacons");
2746 return -ENOMEM; 2773 return -ENOMEM;
2747 } 2774 }
2748 2775
@@ -2770,7 +2797,6 @@ static int airo_test_wpa_capable(struct airo_info *ai)
2770{ 2797{
2771 int status; 2798 int status;
2772 CapabilityRid cap_rid; 2799 CapabilityRid cap_rid;
2773 const char *name = ai->dev->name;
2774 2800
2775 status = readCapabilityRid(ai, &cap_rid, 1); 2801 status = readCapabilityRid(ai, &cap_rid, 1);
2776 if (status != SUCCESS) return 0; 2802 if (status != SUCCESS) return 0;
@@ -2778,12 +2804,12 @@ static int airo_test_wpa_capable(struct airo_info *ai)
2778 /* Only firmware versions 5.30.17 or better can do WPA */ 2804 /* Only firmware versions 5.30.17 or better can do WPA */
2779 if ((cap_rid.softVer > 0x530) 2805 if ((cap_rid.softVer > 0x530)
2780 || ((cap_rid.softVer == 0x530) && (cap_rid.softSubVer >= 17))) { 2806 || ((cap_rid.softVer == 0x530) && (cap_rid.softSubVer >= 17))) {
2781 airo_print_info(name, "WPA is supported."); 2807 airo_print_info("", "WPA is supported.");
2782 return 1; 2808 return 1;
2783 } 2809 }
2784 2810
2785 /* No WPA support */ 2811 /* No WPA support */
2786 airo_print_info(name, "WPA unsupported (only firmware versions 5.30.17" 2812 airo_print_info("", "WPA unsupported (only firmware versions 5.30.17"
2787 " and greater support WPA. Detected %s)", cap_rid.prodVer); 2813 " and greater support WPA. Detected %s)", cap_rid.prodVer);
2788 return 0; 2814 return 0;
2789} 2815}
@@ -2797,23 +2823,19 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2797 int i, rc; 2823 int i, rc;
2798 2824
2799 /* Create the network device object. */ 2825 /* Create the network device object. */
2800 dev = alloc_etherdev(sizeof(*ai)); 2826 dev = alloc_netdev(sizeof(*ai), "", ether_setup);
2801 if (!dev) { 2827 if (!dev) {
2802 airo_print_err("", "Couldn't alloc_etherdev"); 2828 airo_print_err("", "Couldn't alloc_etherdev");
2803 return NULL; 2829 return NULL;
2804 }
2805 if (dev_alloc_name(dev, dev->name) < 0) {
2806 airo_print_err("", "Couldn't get name!");
2807 goto err_out_free;
2808 } 2830 }
2809 2831
2810 ai = dev->priv; 2832 ai = dev->priv;
2811 ai->wifidev = NULL; 2833 ai->wifidev = NULL;
2812 ai->flags = 0; 2834 ai->flags = 1 << FLAG_RADIO_DOWN;
2813 ai->jobs = 0; 2835 ai->jobs = 0;
2814 ai->dev = dev; 2836 ai->dev = dev;
2815 if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) { 2837 if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) {
2816 airo_print_dbg(dev->name, "Found an MPI350 card"); 2838 airo_print_dbg("", "Found an MPI350 card");
2817 set_bit(FLAG_MPI, &ai->flags); 2839 set_bit(FLAG_MPI, &ai->flags);
2818 } 2840 }
2819 spin_lock_init(&ai->aux_lock); 2841 spin_lock_init(&ai->aux_lock);
@@ -2821,14 +2843,11 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2821 ai->config.len = 0; 2843 ai->config.len = 0;
2822 ai->pci = pci; 2844 ai->pci = pci;
2823 init_waitqueue_head (&ai->thr_wait); 2845 init_waitqueue_head (&ai->thr_wait);
2824 ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name);
2825 if (IS_ERR(ai->airo_thread_task))
2826 goto err_out_free;
2827 ai->tfm = NULL; 2846 ai->tfm = NULL;
2828 add_airo_dev(ai); 2847 add_airo_dev(ai);
2829 2848
2830 if (airo_networks_allocate (ai)) 2849 if (airo_networks_allocate (ai))
2831 goto err_out_thr; 2850 goto err_out_free;
2832 airo_networks_initialize (ai); 2851 airo_networks_initialize (ai);
2833 2852
2834 /* The Airo-specific entries in the device structure. */ 2853 /* The Airo-specific entries in the device structure. */
@@ -2851,27 +2870,22 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2851 dev->base_addr = port; 2870 dev->base_addr = port;
2852 2871
2853 SET_NETDEV_DEV(dev, dmdev); 2872 SET_NETDEV_DEV(dev, dmdev);
2873 SET_MODULE_OWNER(dev);
2854 2874
2855 reset_card (dev, 1); 2875 reset_card (dev, 1);
2856 msleep(400); 2876 msleep(400);
2857 2877
2858 rc = request_irq( dev->irq, airo_interrupt, IRQF_SHARED, dev->name, dev );
2859 if (rc) {
2860 airo_print_err(dev->name, "register interrupt %d failed, rc %d",
2861 irq, rc);
2862 goto err_out_nets;
2863 }
2864 if (!is_pcmcia) { 2878 if (!is_pcmcia) {
2865 if (!request_region( dev->base_addr, 64, dev->name )) { 2879 if (!request_region(dev->base_addr, 64, DRV_NAME)) {
2866 rc = -EBUSY; 2880 rc = -EBUSY;
2867 airo_print_err(dev->name, "Couldn't request region"); 2881 airo_print_err(dev->name, "Couldn't request region");
2868 goto err_out_irq; 2882 goto err_out_nets;
2869 } 2883 }
2870 } 2884 }
2871 2885
2872 if (test_bit(FLAG_MPI,&ai->flags)) { 2886 if (test_bit(FLAG_MPI,&ai->flags)) {
2873 if (mpi_map_card(ai, pci, dev->name)) { 2887 if (mpi_map_card(ai, pci)) {
2874 airo_print_err(dev->name, "Could not map memory"); 2888 airo_print_err("", "Could not map memory");
2875 goto err_out_res; 2889 goto err_out_res;
2876 } 2890 }
2877 } 2891 }
@@ -2899,6 +2913,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2899 ai->bssListRidLen = sizeof(BSSListRid) - sizeof(BSSListRidExtra); 2913 ai->bssListRidLen = sizeof(BSSListRid) - sizeof(BSSListRidExtra);
2900 } 2914 }
2901 2915
2916 strcpy(dev->name, "eth%d");
2902 rc = register_netdev(dev); 2917 rc = register_netdev(dev);
2903 if (rc) { 2918 if (rc) {
2904 airo_print_err(dev->name, "Couldn't register_netdev"); 2919 airo_print_err(dev->name, "Couldn't register_netdev");
@@ -2921,8 +2936,6 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2921 if (setup_proc_entry(dev, dev->priv) < 0) 2936 if (setup_proc_entry(dev, dev->priv) < 0)
2922 goto err_out_wifi; 2937 goto err_out_wifi;
2923 2938
2924 netif_start_queue(dev);
2925 SET_MODULE_OWNER(dev);
2926 return dev; 2939 return dev;
2927 2940
2928err_out_wifi: 2941err_out_wifi:
@@ -2940,14 +2953,9 @@ err_out_map:
2940err_out_res: 2953err_out_res:
2941 if (!is_pcmcia) 2954 if (!is_pcmcia)
2942 release_region( dev->base_addr, 64 ); 2955 release_region( dev->base_addr, 64 );
2943err_out_irq:
2944 free_irq(dev->irq, dev);
2945err_out_nets: 2956err_out_nets:
2946 airo_networks_free(ai); 2957 airo_networks_free(ai);
2947err_out_thr:
2948 del_airo_dev(ai); 2958 del_airo_dev(ai);
2949 set_bit(JOB_DIE, &ai->jobs);
2950 kthread_stop(ai->airo_thread_task);
2951err_out_free: 2959err_out_free:
2952 free_netdev(dev); 2960 free_netdev(dev);
2953 return NULL; 2961 return NULL;
@@ -3529,9 +3537,11 @@ static u16 IN4500( struct airo_info *ai, u16 reg ) {
3529 return rc; 3537 return rc;
3530} 3538}
3531 3539
3532static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ) { 3540static int enable_MAC(struct airo_info *ai, int lock)
3541{
3533 int rc; 3542 int rc;
3534 Cmd cmd; 3543 Cmd cmd;
3544 Resp rsp;
3535 3545
3536 /* FLAG_RADIO_OFF : Radio disabled via /proc or Wireless Extensions 3546 /* FLAG_RADIO_OFF : Radio disabled via /proc or Wireless Extensions
3537 * FLAG_RADIO_DOWN : Radio disabled via "ifconfig ethX down" 3547 * FLAG_RADIO_DOWN : Radio disabled via "ifconfig ethX down"
@@ -3547,7 +3557,7 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ) {
3547 if (!test_bit(FLAG_ENABLED, &ai->flags)) { 3557 if (!test_bit(FLAG_ENABLED, &ai->flags)) {
3548 memset(&cmd, 0, sizeof(cmd)); 3558 memset(&cmd, 0, sizeof(cmd));
3549 cmd.cmd = MAC_ENABLE; 3559 cmd.cmd = MAC_ENABLE;
3550 rc = issuecommand(ai, &cmd, rsp); 3560 rc = issuecommand(ai, &cmd, &rsp);
3551 if (rc == SUCCESS) 3561 if (rc == SUCCESS)
3552 set_bit(FLAG_ENABLED, &ai->flags); 3562 set_bit(FLAG_ENABLED, &ai->flags);
3553 } else 3563 } else
@@ -3557,8 +3567,12 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ) {
3557 up(&ai->sem); 3567 up(&ai->sem);
3558 3568
3559 if (rc) 3569 if (rc)
3560 airo_print_err(ai->dev->name, "%s: Cannot enable MAC, err=%d", 3570 airo_print_err(ai->dev->name, "Cannot enable MAC");
3561 __FUNCTION__, rc); 3571 else if ((rsp.status & 0xFF00) != 0) {
3572 airo_print_err(ai->dev->name, "Bad MAC enable reason=%x, "
3573 "rid=%x, offset=%d", rsp.rsp0, rsp.rsp1, rsp.rsp2);
3574 rc = ERROR;
3575 }
3562 return rc; 3576 return rc;
3563} 3577}
3564 3578
@@ -3902,12 +3916,9 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
3902 if ( status != SUCCESS ) return ERROR; 3916 if ( status != SUCCESS ) return ERROR;
3903 } 3917 }
3904 3918
3905 status = enable_MAC(ai, &rsp, lock); 3919 status = enable_MAC(ai, lock);
3906 if ( status != SUCCESS || (rsp.status & 0xFF00) != 0) { 3920 if (status != SUCCESS)
3907 airo_print_err(ai->dev->name, "Bad MAC enable reason = %x, rid = %x,"
3908 " offset = %d", rsp.rsp0, rsp.rsp1, rsp.rsp2 );
3909 return ERROR; 3921 return ERROR;
3910 }
3911 3922
3912 /* Grab the initial wep key, we gotta save it for auto_wep */ 3923 /* Grab the initial wep key, we gotta save it for auto_wep */
3913 rc = readWepKeyRid(ai, &wkr, 1, lock); 3924 rc = readWepKeyRid(ai, &wkr, 1, lock);
@@ -3919,10 +3930,7 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
3919 rc = readWepKeyRid(ai, &wkr, 0, lock); 3930 rc = readWepKeyRid(ai, &wkr, 0, lock);
3920 } while(lastindex != wkr.kindex); 3931 } while(lastindex != wkr.kindex);
3921 3932
3922 if (auto_wep) { 3933 try_auto_wep(ai);
3923 ai->expires = RUN_AT(3*HZ);
3924 wake_up_interruptible(&ai->thr_wait);
3925 }
3926 3934
3927 return SUCCESS; 3935 return SUCCESS;
3928} 3936}
@@ -4004,7 +4012,7 @@ static int bap_setup(struct airo_info *ai, u16 rid, u16 offset, int whichbap )
4004 } 4012 }
4005 if ( !(max_tries--) ) { 4013 if ( !(max_tries--) ) {
4006 airo_print_err(ai->dev->name, 4014 airo_print_err(ai->dev->name,
4007 "airo: BAP setup error too many retries\n"); 4015 "BAP setup error too many retries\n");
4008 return ERROR; 4016 return ERROR;
4009 } 4017 }
4010 // -- PC4500 missed it, try again 4018 // -- PC4500 missed it, try again
@@ -5152,7 +5160,6 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) {
5152 struct net_device *dev = dp->data; 5160 struct net_device *dev = dp->data;
5153 struct airo_info *ai = dev->priv; 5161 struct airo_info *ai = dev->priv;
5154 SsidRid SSID_rid; 5162 SsidRid SSID_rid;
5155 Resp rsp;
5156 int i; 5163 int i;
5157 int offset = 0; 5164 int offset = 0;
5158 5165
@@ -5177,7 +5184,7 @@ static void proc_SSID_on_close( struct inode *inode, struct file *file ) {
5177 SSID_rid.len = sizeof(SSID_rid); 5184 SSID_rid.len = sizeof(SSID_rid);
5178 disable_MAC(ai, 1); 5185 disable_MAC(ai, 1);
5179 writeSsidRid(ai, &SSID_rid, 1); 5186 writeSsidRid(ai, &SSID_rid, 1);
5180 enable_MAC(ai, &rsp, 1); 5187 enable_MAC(ai, 1);
5181} 5188}
5182 5189
5183static inline u8 hexVal(char c) { 5190static inline u8 hexVal(char c) {
@@ -5193,7 +5200,6 @@ static void proc_APList_on_close( struct inode *inode, struct file *file ) {
5193 struct net_device *dev = dp->data; 5200 struct net_device *dev = dp->data;
5194 struct airo_info *ai = dev->priv; 5201 struct airo_info *ai = dev->priv;
5195 APListRid APList_rid; 5202 APListRid APList_rid;
5196 Resp rsp;
5197 int i; 5203 int i;
5198 5204
5199 if ( !data->writelen ) return; 5205 if ( !data->writelen ) return;
@@ -5218,18 +5224,17 @@ static void proc_APList_on_close( struct inode *inode, struct file *file ) {
5218 } 5224 }
5219 disable_MAC(ai, 1); 5225 disable_MAC(ai, 1);
5220 writeAPListRid(ai, &APList_rid, 1); 5226 writeAPListRid(ai, &APList_rid, 1);
5221 enable_MAC(ai, &rsp, 1); 5227 enable_MAC(ai, 1);
5222} 5228}
5223 5229
5224/* This function wraps PC4500_writerid with a MAC disable */ 5230/* This function wraps PC4500_writerid with a MAC disable */
5225static int do_writerid( struct airo_info *ai, u16 rid, const void *rid_data, 5231static int do_writerid( struct airo_info *ai, u16 rid, const void *rid_data,
5226 int len, int dummy ) { 5232 int len, int dummy ) {
5227 int rc; 5233 int rc;
5228 Resp rsp;
5229 5234
5230 disable_MAC(ai, 1); 5235 disable_MAC(ai, 1);
5231 rc = PC4500_writerid(ai, rid, rid_data, len, 1); 5236 rc = PC4500_writerid(ai, rid, rid_data, len, 1);
5232 enable_MAC(ai, &rsp, 1); 5237 enable_MAC(ai, 1);
5233 return rc; 5238 return rc;
5234} 5239}
5235 5240
@@ -5260,7 +5265,6 @@ static int set_wep_key(struct airo_info *ai, u16 index,
5260 const char *key, u16 keylen, int perm, int lock ) { 5265 const char *key, u16 keylen, int perm, int lock ) {
5261 static const unsigned char macaddr[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 }; 5266 static const unsigned char macaddr[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 };
5262 WepKeyRid wkr; 5267 WepKeyRid wkr;
5263 Resp rsp;
5264 5268
5265 memset(&wkr, 0, sizeof(wkr)); 5269 memset(&wkr, 0, sizeof(wkr));
5266 if (keylen == 0) { 5270 if (keylen == 0) {
@@ -5280,7 +5284,7 @@ static int set_wep_key(struct airo_info *ai, u16 index,
5280 5284
5281 if (perm) disable_MAC(ai, lock); 5285 if (perm) disable_MAC(ai, lock);
5282 writeWepKeyRid(ai, &wkr, perm, lock); 5286 writeWepKeyRid(ai, &wkr, perm, lock);
5283 if (perm) enable_MAC(ai, &rsp, lock); 5287 if (perm) enable_MAC(ai, lock);
5284 return 0; 5288 return 0;
5285} 5289}
5286 5290
@@ -5548,7 +5552,6 @@ static int proc_close( struct inode *inode, struct file *file )
5548 changed. */ 5552 changed. */
5549static void timer_func( struct net_device *dev ) { 5553static void timer_func( struct net_device *dev ) {
5550 struct airo_info *apriv = dev->priv; 5554 struct airo_info *apriv = dev->priv;
5551 Resp rsp;
5552 5555
5553/* We don't have a link so try changing the authtype */ 5556/* We don't have a link so try changing the authtype */
5554 readConfigRid(apriv, 0); 5557 readConfigRid(apriv, 0);
@@ -5575,7 +5578,7 @@ static void timer_func( struct net_device *dev ) {
5575 } 5578 }
5576 set_bit (FLAG_COMMIT, &apriv->flags); 5579 set_bit (FLAG_COMMIT, &apriv->flags);
5577 writeConfigRid(apriv, 0); 5580 writeConfigRid(apriv, 0);
5578 enable_MAC(apriv, &rsp, 0); 5581 enable_MAC(apriv, 0);
5579 up(&apriv->sem); 5582 up(&apriv->sem);
5580 5583
5581/* Schedule check to see if the change worked */ 5584/* Schedule check to see if the change worked */
@@ -5597,8 +5600,10 @@ static int __devinit airo_pci_probe(struct pci_dev *pdev,
5597 dev = _init_airo_card(pdev->irq, pdev->resource[0].start, 0, pdev, &pdev->dev); 5600 dev = _init_airo_card(pdev->irq, pdev->resource[0].start, 0, pdev, &pdev->dev);
5598 else 5601 else
5599 dev = _init_airo_card(pdev->irq, pdev->resource[2].start, 0, pdev, &pdev->dev); 5602 dev = _init_airo_card(pdev->irq, pdev->resource[2].start, 0, pdev, &pdev->dev);
5600 if (!dev) 5603 if (!dev) {
5604 pci_disable_device(pdev);
5601 return -ENODEV; 5605 return -ENODEV;
5606 }
5602 5607
5603 pci_set_drvdata(pdev, dev); 5608 pci_set_drvdata(pdev, dev);
5604 return 0; 5609 return 0;
@@ -5610,6 +5615,8 @@ static void __devexit airo_pci_remove(struct pci_dev *pdev)
5610 5615
5611 airo_print_info(dev->name, "Unregistering..."); 5616 airo_print_info(dev->name, "Unregistering...");
5612 stop_airo_card(dev, 1); 5617 stop_airo_card(dev, 1);
5618 pci_disable_device(pdev);
5619 pci_set_drvdata(pdev, NULL);
5613} 5620}
5614 5621
5615static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) 5622static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state)
@@ -5646,7 +5653,6 @@ static int airo_pci_resume(struct pci_dev *pdev)
5646{ 5653{
5647 struct net_device *dev = pci_get_drvdata(pdev); 5654 struct net_device *dev = pci_get_drvdata(pdev);
5648 struct airo_info *ai = dev->priv; 5655 struct airo_info *ai = dev->priv;
5649 Resp rsp;
5650 pci_power_t prev_state = pdev->current_state; 5656 pci_power_t prev_state = pdev->current_state;
5651 5657
5652 pci_set_power_state(pdev, PCI_D0); 5658 pci_set_power_state(pdev, PCI_D0);
@@ -5679,7 +5685,7 @@ static int airo_pci_resume(struct pci_dev *pdev)
5679 ai->APList = NULL; 5685 ai->APList = NULL;
5680 } 5686 }
5681 writeConfigRid(ai, 0); 5687 writeConfigRid(ai, 0);
5682 enable_MAC(ai, &rsp, 0); 5688 enable_MAC(ai, 0);
5683 ai->power = PMSG_ON; 5689 ai->power = PMSG_ON;
5684 netif_device_attach(dev); 5690 netif_device_attach(dev);
5685 netif_wake_queue(dev); 5691 netif_wake_queue(dev);
@@ -5903,7 +5909,6 @@ static int airo_set_essid(struct net_device *dev,
5903 char *extra) 5909 char *extra)
5904{ 5910{
5905 struct airo_info *local = dev->priv; 5911 struct airo_info *local = dev->priv;
5906 Resp rsp;
5907 SsidRid SSID_rid; /* SSIDs */ 5912 SsidRid SSID_rid; /* SSIDs */
5908 5913
5909 /* Reload the list of current SSID */ 5914 /* Reload the list of current SSID */
@@ -5935,7 +5940,7 @@ static int airo_set_essid(struct net_device *dev,
5935 /* Write it to the card */ 5940 /* Write it to the card */
5936 disable_MAC(local, 1); 5941 disable_MAC(local, 1);
5937 writeSsidRid(local, &SSID_rid, 1); 5942 writeSsidRid(local, &SSID_rid, 1);
5938 enable_MAC(local, &rsp, 1); 5943 enable_MAC(local, 1);
5939 5944
5940 return 0; 5945 return 0;
5941} 5946}
@@ -6000,7 +6005,7 @@ static int airo_set_wap(struct net_device *dev,
6000 memcpy(APList_rid.ap[0], awrq->sa_data, ETH_ALEN); 6005 memcpy(APList_rid.ap[0], awrq->sa_data, ETH_ALEN);
6001 disable_MAC(local, 1); 6006 disable_MAC(local, 1);
6002 writeAPListRid(local, &APList_rid, 1); 6007 writeAPListRid(local, &APList_rid, 1);
6003 enable_MAC(local, &rsp, 1); 6008 enable_MAC(local, 1);
6004 } 6009 }
6005 return 0; 6010 return 0;
6006} 6011}
@@ -7454,7 +7459,6 @@ static int airo_config_commit(struct net_device *dev,
7454 char *extra) /* NULL */ 7459 char *extra) /* NULL */
7455{ 7460{
7456 struct airo_info *local = dev->priv; 7461 struct airo_info *local = dev->priv;
7457 Resp rsp;
7458 7462
7459 if (!test_bit (FLAG_COMMIT, &local->flags)) 7463 if (!test_bit (FLAG_COMMIT, &local->flags))
7460 return 0; 7464 return 0;
@@ -7479,7 +7483,7 @@ static int airo_config_commit(struct net_device *dev,
7479 if (down_interruptible(&local->sem)) 7483 if (down_interruptible(&local->sem))
7480 return -ERESTARTSYS; 7484 return -ERESTARTSYS;
7481 writeConfigRid(local, 0); 7485 writeConfigRid(local, 0);
7482 enable_MAC(local, &rsp, 0); 7486 enable_MAC(local, 0);
7483 if (test_bit (FLAG_RESET, &local->flags)) 7487 if (test_bit (FLAG_RESET, &local->flags))
7484 airo_set_promisc(local); 7488 airo_set_promisc(local);
7485 else 7489 else
@@ -7746,7 +7750,6 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
7746 unsigned char *iobuf; 7750 unsigned char *iobuf;
7747 int len; 7751 int len;
7748 struct airo_info *ai = dev->priv; 7752 struct airo_info *ai = dev->priv;
7749 Resp rsp;
7750 7753
7751 if (test_bit(FLAG_FLASHING, &ai->flags)) 7754 if (test_bit(FLAG_FLASHING, &ai->flags))
7752 return -EIO; 7755 return -EIO;
@@ -7758,7 +7761,7 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
7758 if (test_bit(FLAG_COMMIT, &ai->flags)) { 7761 if (test_bit(FLAG_COMMIT, &ai->flags)) {
7759 disable_MAC (ai, 1); 7762 disable_MAC (ai, 1);
7760 writeConfigRid (ai, 1); 7763 writeConfigRid (ai, 1);
7761 enable_MAC (ai, &rsp, 1); 7764 enable_MAC(ai, 1);
7762 } 7765 }
7763 break; 7766 break;
7764 case AIROGSLIST: ridcode = RID_SSID; break; 7767 case AIROGSLIST: ridcode = RID_SSID; break;
@@ -7815,7 +7818,6 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
7815 struct airo_info *ai = dev->priv; 7818 struct airo_info *ai = dev->priv;
7816 int ridcode; 7819 int ridcode;
7817 int enabled; 7820 int enabled;
7818 Resp rsp;
7819 static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); 7821 static int (* writer)(struct airo_info *, u16 rid, const void *, int, int);
7820 unsigned char *iobuf; 7822 unsigned char *iobuf;
7821 7823
@@ -7849,7 +7851,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
7849 * same with MAC off 7851 * same with MAC off
7850 */ 7852 */
7851 case AIROPMACON: 7853 case AIROPMACON:
7852 if (enable_MAC(ai, &rsp, 1) != 0) 7854 if (enable_MAC(ai, 1) != 0)
7853 return -EIO; 7855 return -EIO;
7854 return 0; 7856 return 0;
7855 7857
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index d51daf87450f..072ede71e575 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -1768,7 +1768,8 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
1768 1768
1769 if (priv->stop_rf_kill) { 1769 if (priv->stop_rf_kill) {
1770 priv->stop_rf_kill = 0; 1770 priv->stop_rf_kill = 0;
1771 queue_delayed_work(priv->workqueue, &priv->rf_kill, HZ); 1771 queue_delayed_work(priv->workqueue, &priv->rf_kill,
1772 round_jiffies(HZ));
1772 } 1773 }
1773 1774
1774 deferred = 1; 1775 deferred = 1;
@@ -2098,7 +2099,7 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status)
2098 /* Make sure the RF Kill check timer is running */ 2099 /* Make sure the RF Kill check timer is running */
2099 priv->stop_rf_kill = 0; 2100 priv->stop_rf_kill = 0;
2100 cancel_delayed_work(&priv->rf_kill); 2101 cancel_delayed_work(&priv->rf_kill);
2101 queue_delayed_work(priv->workqueue, &priv->rf_kill, HZ); 2102 queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ));
2102} 2103}
2103 2104
2104static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) 2105static void isr_scan_complete(struct ipw2100_priv *priv, u32 status)
@@ -4233,7 +4234,8 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio)
4233 /* Make sure the RF_KILL check timer is running */ 4234 /* Make sure the RF_KILL check timer is running */
4234 priv->stop_rf_kill = 0; 4235 priv->stop_rf_kill = 0;
4235 cancel_delayed_work(&priv->rf_kill); 4236 cancel_delayed_work(&priv->rf_kill);
4236 queue_delayed_work(priv->workqueue, &priv->rf_kill, HZ); 4237 queue_delayed_work(priv->workqueue, &priv->rf_kill,
4238 round_jiffies(HZ));
4237 } else 4239 } else
4238 schedule_reset(priv); 4240 schedule_reset(priv);
4239 } 4241 }
@@ -5969,7 +5971,8 @@ static void ipw2100_rf_kill(struct work_struct *work)
5969 if (rf_kill_active(priv)) { 5971 if (rf_kill_active(priv)) {
5970 IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); 5972 IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n");
5971 if (!priv->stop_rf_kill) 5973 if (!priv->stop_rf_kill)
5972 queue_delayed_work(priv->workqueue, &priv->rf_kill, HZ); 5974 queue_delayed_work(priv->workqueue, &priv->rf_kill,
5975 round_jiffies(HZ));
5973 goto exit_unlock; 5976 goto exit_unlock;
5974 } 5977 }
5975 5978
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 7cb2052a55a5..aa32a97380ec 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1751,7 +1751,7 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
1751 /* Make sure the RF_KILL check timer is running */ 1751 /* Make sure the RF_KILL check timer is running */
1752 cancel_delayed_work(&priv->rf_kill); 1752 cancel_delayed_work(&priv->rf_kill);
1753 queue_delayed_work(priv->workqueue, &priv->rf_kill, 1753 queue_delayed_work(priv->workqueue, &priv->rf_kill,
1754 2 * HZ); 1754 round_jiffies(2 * HZ));
1755 } else 1755 } else
1756 queue_work(priv->workqueue, &priv->up); 1756 queue_work(priv->workqueue, &priv->up);
1757 } 1757 }
@@ -4690,7 +4690,8 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4690 else if (priv->config & CFG_BACKGROUND_SCAN 4690 else if (priv->config & CFG_BACKGROUND_SCAN
4691 && priv->status & STATUS_ASSOCIATED) 4691 && priv->status & STATUS_ASSOCIATED)
4692 queue_delayed_work(priv->workqueue, 4692 queue_delayed_work(priv->workqueue,
4693 &priv->request_scan, HZ); 4693 &priv->request_scan,
4694 round_jiffies(HZ));
4694 4695
4695 /* Send an empty event to user space. 4696 /* Send an empty event to user space.
4696 * We don't send the received data on the event because 4697 * We don't send the received data on the event because
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 13f6528abb00..4a8f5dc70239 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -240,7 +240,7 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv,
240 if (*enable) 240 if (*enable)
241 penableRSN->enable = cpu_to_le16(cmd_enable_rsn); 241 penableRSN->enable = cpu_to_le16(cmd_enable_rsn);
242 else 242 else
243 penableRSN->enable = cpu_to_le16(cmd_enable_rsn); 243 penableRSN->enable = cpu_to_le16(cmd_disable_rsn);
244 } 244 }
245 245
246 lbs_deb_leave(LBS_DEB_CMD); 246 lbs_deb_leave(LBS_DEB_CMD);
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 88d9d2d787d5..769c86fb9509 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -439,7 +439,6 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
439 ret = 0; 439 ret = 0;
440 440
441done: 441done:
442 skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
443 lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); 442 lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
444 return ret; 443 return ret;
445} 444}
diff --git a/drivers/net/wireless/libertas/version.h b/drivers/net/wireless/libertas/version.h
deleted file mode 100644
index 8b137891791f..000000000000
--- a/drivers/net/wireless/libertas/version.h
+++ /dev/null
@@ -1 +0,0 @@
1
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index f42b796b5e47..2fcc3bf21081 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1719,9 +1719,6 @@ static int wlan_set_encodeext(struct net_device *dev,
1719 pkey->type = KEY_TYPE_ID_TKIP; 1719 pkey->type = KEY_TYPE_ID_TKIP;
1720 } else if (alg == IW_ENCODE_ALG_CCMP) { 1720 } else if (alg == IW_ENCODE_ALG_CCMP) {
1721 pkey->type = KEY_TYPE_ID_AES; 1721 pkey->type = KEY_TYPE_ID_AES;
1722 } else {
1723 ret = -EINVAL;
1724 goto out;
1725 } 1722 }
1726 1723
1727 /* If WPA isn't enabled yet, do that now */ 1724 /* If WPA isn't enabled yet, do that now */
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index 283be4a70524..585f5996d292 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -1853,7 +1853,6 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
1853 islpci_private *priv = netdev_priv(ndev); 1853 islpci_private *priv = netdev_priv(ndev);
1854 struct islpci_acl *acl = &priv->acl; 1854 struct islpci_acl *acl = &priv->acl;
1855 struct mac_entry *entry; 1855 struct mac_entry *entry;
1856 struct list_head *ptr;
1857 struct sockaddr *addr = (struct sockaddr *) extra; 1856 struct sockaddr *addr = (struct sockaddr *) extra;
1858 1857
1859 if (addr->sa_family != ARPHRD_ETHER) 1858 if (addr->sa_family != ARPHRD_ETHER)
@@ -1861,11 +1860,9 @@ prism54_del_mac(struct net_device *ndev, struct iw_request_info *info,
1861 1860
1862 if (down_interruptible(&acl->sem)) 1861 if (down_interruptible(&acl->sem))
1863 return -ERESTARTSYS; 1862 return -ERESTARTSYS;
1864 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) { 1863 list_for_each_entry(entry, &acl->mac_list, _list) {
1865 entry = list_entry(ptr, struct mac_entry, _list);
1866
1867 if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) { 1864 if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) {
1868 list_del(ptr); 1865 list_del(&entry->_list);
1869 acl->size--; 1866 acl->size--;
1870 kfree(entry); 1867 kfree(entry);
1871 up(&acl->sem); 1868 up(&acl->sem);
@@ -1883,7 +1880,6 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
1883 islpci_private *priv = netdev_priv(ndev); 1880 islpci_private *priv = netdev_priv(ndev);
1884 struct islpci_acl *acl = &priv->acl; 1881 struct islpci_acl *acl = &priv->acl;
1885 struct mac_entry *entry; 1882 struct mac_entry *entry;
1886 struct list_head *ptr;
1887 struct sockaddr *dst = (struct sockaddr *) extra; 1883 struct sockaddr *dst = (struct sockaddr *) extra;
1888 1884
1889 dwrq->length = 0; 1885 dwrq->length = 0;
@@ -1891,9 +1887,7 @@ prism54_get_mac(struct net_device *ndev, struct iw_request_info *info,
1891 if (down_interruptible(&acl->sem)) 1887 if (down_interruptible(&acl->sem))
1892 return -ERESTARTSYS; 1888 return -ERESTARTSYS;
1893 1889
1894 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) { 1890 list_for_each_entry(entry, &acl->mac_list, _list) {
1895 entry = list_entry(ptr, struct mac_entry, _list);
1896
1897 memcpy(dst->sa_data, entry->addr, ETH_ALEN); 1891 memcpy(dst->sa_data, entry->addr, ETH_ALEN);
1898 dst->sa_family = ARPHRD_ETHER; 1892 dst->sa_family = ARPHRD_ETHER;
1899 dwrq->length++; 1893 dwrq->length++;
@@ -1960,7 +1954,6 @@ prism54_get_policy(struct net_device *ndev, struct iw_request_info *info,
1960static int 1954static int
1961prism54_mac_accept(struct islpci_acl *acl, char *mac) 1955prism54_mac_accept(struct islpci_acl *acl, char *mac)
1962{ 1956{
1963 struct list_head *ptr;
1964 struct mac_entry *entry; 1957 struct mac_entry *entry;
1965 int res = 0; 1958 int res = 0;
1966 1959
@@ -1972,8 +1965,7 @@ prism54_mac_accept(struct islpci_acl *acl, char *mac)
1972 return 1; 1965 return 1;
1973 } 1966 }
1974 1967
1975 for (ptr = acl->mac_list.next; ptr != &acl->mac_list; ptr = ptr->next) { 1968 list_for_each_entry(entry, &acl->mac_list, _list) {
1976 entry = list_entry(ptr, struct mac_entry, _list);
1977 if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { 1969 if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
1978 res = 1; 1970 res = 1;
1979 break; 1971 break;
@@ -2216,11 +2208,9 @@ prism54_wpa_bss_ie_init(islpci_private *priv)
2216void 2208void
2217prism54_wpa_bss_ie_clean(islpci_private *priv) 2209prism54_wpa_bss_ie_clean(islpci_private *priv)
2218{ 2210{
2219 struct list_head *ptr, *n; 2211 struct islpci_bss_wpa_ie *bss, *n;
2220 2212
2221 list_for_each_safe(ptr, n, &priv->bss_wpa_list) { 2213 list_for_each_entry_safe(bss, n, &priv->bss_wpa_list, list) {
2222 struct islpci_bss_wpa_ie *bss;
2223 bss = list_entry(ptr, struct islpci_bss_wpa_ie, list);
2224 kfree(bss); 2214 kfree(bss);
2225 } 2215 }
2226} 2216}
diff --git a/drivers/net/wireless/rtl8187_rtl8225.c b/drivers/net/wireless/rtl8187_rtl8225.c
index e25a09f1b068..efc41207780e 100644
--- a/drivers/net/wireless/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/rtl8187_rtl8225.c
@@ -67,7 +67,7 @@ static void rtl8225_write_bitbang(struct ieee80211_hw *dev, u8 addr, u16 data)
67 msleep(2); 67 msleep(2);
68} 68}
69 69
70static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, u16 data) 70static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data)
71{ 71{
72 struct rtl8187_priv *priv = dev->priv; 72 struct rtl8187_priv *priv = dev->priv;
73 u16 reg80, reg82, reg84; 73 u16 reg80, reg82, reg84;
@@ -106,7 +106,7 @@ void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data)
106 struct rtl8187_priv *priv = dev->priv; 106 struct rtl8187_priv *priv = dev->priv;
107 107
108 if (priv->asic_rev) 108 if (priv->asic_rev)
109 rtl8225_write_8051(dev, addr, data); 109 rtl8225_write_8051(dev, addr, cpu_to_le16(data));
110 else 110 else
111 rtl8225_write_bitbang(dev, addr, data); 111 rtl8225_write_bitbang(dev, addr, data);
112} 112}
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 5b624bfc01a6..c39f1984b84d 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -49,8 +49,9 @@ void zd_chip_clear(struct zd_chip *chip)
49 ZD_MEMCLEAR(chip, sizeof(*chip)); 49 ZD_MEMCLEAR(chip, sizeof(*chip));
50} 50}
51 51
52static int scnprint_mac_oui(const u8 *addr, char *buffer, size_t size) 52static int scnprint_mac_oui(struct zd_chip *chip, char *buffer, size_t size)
53{ 53{
54 u8 *addr = zd_usb_to_netdev(&chip->usb)->dev_addr;
54 return scnprintf(buffer, size, "%02x-%02x-%02x", 55 return scnprintf(buffer, size, "%02x-%02x-%02x",
55 addr[0], addr[1], addr[2]); 56 addr[0], addr[1], addr[2]);
56} 57}
@@ -61,10 +62,10 @@ static int scnprint_id(struct zd_chip *chip, char *buffer, size_t size)
61 int i = 0; 62 int i = 0;
62 63
63 i = scnprintf(buffer, size, "zd1211%s chip ", 64 i = scnprintf(buffer, size, "zd1211%s chip ",
64 chip->is_zd1211b ? "b" : ""); 65 zd_chip_is_zd1211b(chip) ? "b" : "");
65 i += zd_usb_scnprint_id(&chip->usb, buffer+i, size-i); 66 i += zd_usb_scnprint_id(&chip->usb, buffer+i, size-i);
66 i += scnprintf(buffer+i, size-i, " "); 67 i += scnprintf(buffer+i, size-i, " ");
67 i += scnprint_mac_oui(chip->e2p_mac, buffer+i, size-i); 68 i += scnprint_mac_oui(chip, buffer+i, size-i);
68 i += scnprintf(buffer+i, size-i, " "); 69 i += scnprintf(buffer+i, size-i, " ");
69 i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i); 70 i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i);
70 i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c%c", chip->pa_type, 71 i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c%c", chip->pa_type,
@@ -366,64 +367,9 @@ error:
366 return r; 367 return r;
367} 368}
368 369
369static int _read_mac_addr(struct zd_chip *chip, u8 *mac_addr,
370 const zd_addr_t *addr)
371{
372 int r;
373 u32 parts[2];
374
375 r = zd_ioread32v_locked(chip, parts, (const zd_addr_t *)addr, 2);
376 if (r) {
377 dev_dbg_f(zd_chip_dev(chip),
378 "error: couldn't read e2p macs. Error number %d\n", r);
379 return r;
380 }
381
382 mac_addr[0] = parts[0];
383 mac_addr[1] = parts[0] >> 8;
384 mac_addr[2] = parts[0] >> 16;
385 mac_addr[3] = parts[0] >> 24;
386 mac_addr[4] = parts[1];
387 mac_addr[5] = parts[1] >> 8;
388
389 return 0;
390}
391
392static int read_e2p_mac_addr(struct zd_chip *chip)
393{
394 static const zd_addr_t addr[2] = { E2P_MAC_ADDR_P1, E2P_MAC_ADDR_P2 };
395
396 ZD_ASSERT(mutex_is_locked(&chip->mutex));
397 return _read_mac_addr(chip, chip->e2p_mac, (const zd_addr_t *)addr);
398}
399
400/* MAC address: if custom mac addresses are to to be used CR_MAC_ADDR_P1 and 370/* MAC address: if custom mac addresses are to to be used CR_MAC_ADDR_P1 and
401 * CR_MAC_ADDR_P2 must be overwritten 371 * CR_MAC_ADDR_P2 must be overwritten
402 */ 372 */
403void zd_get_e2p_mac_addr(struct zd_chip *chip, u8 *mac_addr)
404{
405 mutex_lock(&chip->mutex);
406 memcpy(mac_addr, chip->e2p_mac, ETH_ALEN);
407 mutex_unlock(&chip->mutex);
408}
409
410static int read_mac_addr(struct zd_chip *chip, u8 *mac_addr)
411{
412 static const zd_addr_t addr[2] = { CR_MAC_ADDR_P1, CR_MAC_ADDR_P2 };
413 return _read_mac_addr(chip, mac_addr, (const zd_addr_t *)addr);
414}
415
416int zd_read_mac_addr(struct zd_chip *chip, u8 *mac_addr)
417{
418 int r;
419
420 dev_dbg_f(zd_chip_dev(chip), "\n");
421 mutex_lock(&chip->mutex);
422 r = read_mac_addr(chip, mac_addr);
423 mutex_unlock(&chip->mutex);
424 return r;
425}
426
427int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr) 373int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr)
428{ 374{
429 int r; 375 int r;
@@ -444,12 +390,6 @@ int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr)
444 390
445 mutex_lock(&chip->mutex); 391 mutex_lock(&chip->mutex);
446 r = zd_iowrite32a_locked(chip, reqs, ARRAY_SIZE(reqs)); 392 r = zd_iowrite32a_locked(chip, reqs, ARRAY_SIZE(reqs));
447#ifdef DEBUG
448 {
449 u8 tmp[ETH_ALEN];
450 read_mac_addr(chip, tmp);
451 }
452#endif /* DEBUG */
453 mutex_unlock(&chip->mutex); 393 mutex_unlock(&chip->mutex);
454 return r; 394 return r;
455} 395}
@@ -809,7 +749,7 @@ out:
809 749
810static int hw_reset_phy(struct zd_chip *chip) 750static int hw_reset_phy(struct zd_chip *chip)
811{ 751{
812 return chip->is_zd1211b ? zd1211b_hw_reset_phy(chip) : 752 return zd_chip_is_zd1211b(chip) ? zd1211b_hw_reset_phy(chip) :
813 zd1211_hw_reset_phy(chip); 753 zd1211_hw_reset_phy(chip);
814} 754}
815 755
@@ -874,7 +814,7 @@ static int hw_init_hmac(struct zd_chip *chip)
874 if (r) 814 if (r)
875 return r; 815 return r;
876 816
877 return chip->is_zd1211b ? 817 return zd_chip_is_zd1211b(chip) ?
878 zd1211b_hw_init_hmac(chip) : zd1211_hw_init_hmac(chip); 818 zd1211b_hw_init_hmac(chip) : zd1211_hw_init_hmac(chip);
879} 819}
880 820
@@ -1136,8 +1076,15 @@ static int read_fw_regs_offset(struct zd_chip *chip)
1136 return 0; 1076 return 0;
1137} 1077}
1138 1078
1079/* Read mac address using pre-firmware interface */
1080int zd_chip_read_mac_addr_fw(struct zd_chip *chip, u8 *addr)
1081{
1082 dev_dbg_f(zd_chip_dev(chip), "\n");
1083 return zd_usb_read_fw(&chip->usb, E2P_MAC_ADDR_P1, addr,
1084 ETH_ALEN);
1085}
1139 1086
1140int zd_chip_init_hw(struct zd_chip *chip, u8 device_type) 1087int zd_chip_init_hw(struct zd_chip *chip)
1141{ 1088{
1142 int r; 1089 int r;
1143 u8 rf_type; 1090 u8 rf_type;
@@ -1145,7 +1092,6 @@ int zd_chip_init_hw(struct zd_chip *chip, u8 device_type)
1145 dev_dbg_f(zd_chip_dev(chip), "\n"); 1092 dev_dbg_f(zd_chip_dev(chip), "\n");
1146 1093
1147 mutex_lock(&chip->mutex); 1094 mutex_lock(&chip->mutex);
1148 chip->is_zd1211b = (device_type == DEVICE_ZD1211B) != 0;
1149 1095
1150#ifdef DEBUG 1096#ifdef DEBUG
1151 r = test_init(chip); 1097 r = test_init(chip);
@@ -1201,10 +1147,6 @@ int zd_chip_init_hw(struct zd_chip *chip, u8 device_type)
1201 goto out; 1147 goto out;
1202#endif /* DEBUG */ 1148#endif /* DEBUG */
1203 1149
1204 r = read_e2p_mac_addr(chip);
1205 if (r)
1206 goto out;
1207
1208 r = read_cal_int_tables(chip); 1150 r = read_cal_int_tables(chip);
1209 if (r) 1151 if (r)
1210 goto out; 1152 goto out;
@@ -1259,7 +1201,7 @@ static int update_channel_integration_and_calibration(struct zd_chip *chip,
1259 r = update_pwr_int(chip, channel); 1201 r = update_pwr_int(chip, channel);
1260 if (r) 1202 if (r)
1261 return r; 1203 return r;
1262 if (chip->is_zd1211b) { 1204 if (zd_chip_is_zd1211b(chip)) {
1263 static const struct zd_ioreq16 ioreqs[] = { 1205 static const struct zd_ioreq16 ioreqs[] = {
1264 { CR69, 0x28 }, 1206 { CR69, 0x28 },
1265 {}, 1207 {},
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 79d0288c193a..f4698576ab71 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -704,7 +704,6 @@ struct zd_chip {
704 struct mutex mutex; 704 struct mutex mutex;
705 /* Base address of FW_REG_ registers */ 705 /* Base address of FW_REG_ registers */
706 zd_addr_t fw_regs_base; 706 zd_addr_t fw_regs_base;
707 u8 e2p_mac[ETH_ALEN];
708 /* EepSetPoint in the vendor driver */ 707 /* EepSetPoint in the vendor driver */
709 u8 pwr_cal_values[E2P_CHANNEL_COUNT]; 708 u8 pwr_cal_values[E2P_CHANNEL_COUNT];
710 /* integration values in the vendor driver */ 709 /* integration values in the vendor driver */
@@ -715,7 +714,7 @@ struct zd_chip {
715 unsigned int pa_type:4, 714 unsigned int pa_type:4,
716 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, 715 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1,
717 new_phy_layout:1, al2230s_bit:1, 716 new_phy_layout:1, al2230s_bit:1,
718 is_zd1211b:1, supports_tx_led:1; 717 supports_tx_led:1;
719}; 718};
720 719
721static inline struct zd_chip *zd_usb_to_chip(struct zd_usb *usb) 720static inline struct zd_chip *zd_usb_to_chip(struct zd_usb *usb)
@@ -734,9 +733,15 @@ void zd_chip_init(struct zd_chip *chip,
734 struct net_device *netdev, 733 struct net_device *netdev,
735 struct usb_interface *intf); 734 struct usb_interface *intf);
736void zd_chip_clear(struct zd_chip *chip); 735void zd_chip_clear(struct zd_chip *chip);
737int zd_chip_init_hw(struct zd_chip *chip, u8 device_type); 736int zd_chip_read_mac_addr_fw(struct zd_chip *chip, u8 *addr);
737int zd_chip_init_hw(struct zd_chip *chip);
738int zd_chip_reset(struct zd_chip *chip); 738int zd_chip_reset(struct zd_chip *chip);
739 739
740static inline int zd_chip_is_zd1211b(struct zd_chip *chip)
741{
742 return chip->usb.is_zd1211b;
743}
744
740static inline int zd_ioread16v_locked(struct zd_chip *chip, u16 *values, 745static inline int zd_ioread16v_locked(struct zd_chip *chip, u16 *values,
741 const zd_addr_t *addresses, 746 const zd_addr_t *addresses,
742 unsigned int count) 747 unsigned int count)
@@ -825,8 +830,6 @@ static inline u8 _zd_chip_get_channel(struct zd_chip *chip)
825} 830}
826u8 zd_chip_get_channel(struct zd_chip *chip); 831u8 zd_chip_get_channel(struct zd_chip *chip);
827int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain); 832int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain);
828void zd_get_e2p_mac_addr(struct zd_chip *chip, u8 *mac_addr);
829int zd_read_mac_addr(struct zd_chip *chip, u8 *mac_addr);
830int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr); 833int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr);
831int zd_chip_switch_radio_on(struct zd_chip *chip); 834int zd_chip_switch_radio_on(struct zd_chip *chip);
832int zd_chip_switch_radio_off(struct zd_chip *chip); 835int zd_chip_switch_radio_off(struct zd_chip *chip);
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 6753d240c168..f6c487aa8246 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -86,38 +86,46 @@ out:
86 return r; 86 return r;
87} 87}
88 88
89int zd_mac_init_hw(struct zd_mac *mac, u8 device_type) 89int zd_mac_preinit_hw(struct zd_mac *mac)
90{ 90{
91 int r; 91 int r;
92 struct zd_chip *chip = &mac->chip;
93 u8 addr[ETH_ALEN]; 92 u8 addr[ETH_ALEN];
93
94 r = zd_chip_read_mac_addr_fw(&mac->chip, addr);
95 if (r)
96 return r;
97
98 memcpy(mac->netdev->dev_addr, addr, ETH_ALEN);
99 return 0;
100}
101
102int zd_mac_init_hw(struct zd_mac *mac)
103{
104 int r;
105 struct zd_chip *chip = &mac->chip;
94 u8 default_regdomain; 106 u8 default_regdomain;
95 107
96 r = zd_chip_enable_int(chip); 108 r = zd_chip_enable_int(chip);
97 if (r) 109 if (r)
98 goto out; 110 goto out;
99 r = zd_chip_init_hw(chip, device_type); 111 r = zd_chip_init_hw(chip);
100 if (r) 112 if (r)
101 goto disable_int; 113 goto disable_int;
102 114
103 zd_get_e2p_mac_addr(chip, addr);
104 r = zd_write_mac_addr(chip, addr);
105 if (r)
106 goto disable_int;
107 ZD_ASSERT(!irqs_disabled()); 115 ZD_ASSERT(!irqs_disabled());
108 spin_lock_irq(&mac->lock);
109 memcpy(mac->netdev->dev_addr, addr, ETH_ALEN);
110 spin_unlock_irq(&mac->lock);
111 116
112 r = zd_read_regdomain(chip, &default_regdomain); 117 r = zd_read_regdomain(chip, &default_regdomain);
113 if (r) 118 if (r)
114 goto disable_int; 119 goto disable_int;
115 if (!zd_regdomain_supported(default_regdomain)) { 120 if (!zd_regdomain_supported(default_regdomain)) {
116 dev_dbg_f(zd_mac_dev(mac), 121 /* The vendor driver overrides the regulatory domain and
117 "Regulatory Domain %#04x is not supported.\n", 122 * allowed channel registers and unconditionally restricts
118 default_regdomain); 123 * available channels to 1-11 everywhere. Match their
119 r = -EINVAL; 124 * questionable behaviour only for regdomains which we don't
120 goto disable_int; 125 * recognise. */
126 dev_warn(zd_mac_dev(mac), "Unrecognised regulatory domain: "
127 "%#04x. Defaulting to FCC.\n", default_regdomain);
128 default_regdomain = ZD_REGDOMAIN_FCC;
121 } 129 }
122 spin_lock_irq(&mac->lock); 130 spin_lock_irq(&mac->lock);
123 mac->regdomain = mac->default_regdomain = default_regdomain; 131 mac->regdomain = mac->default_regdomain = default_regdomain;
@@ -164,14 +172,25 @@ int zd_mac_open(struct net_device *netdev)
164{ 172{
165 struct zd_mac *mac = zd_netdev_mac(netdev); 173 struct zd_mac *mac = zd_netdev_mac(netdev);
166 struct zd_chip *chip = &mac->chip; 174 struct zd_chip *chip = &mac->chip;
175 struct zd_usb *usb = &chip->usb;
167 int r; 176 int r;
168 177
178 if (!usb->initialized) {
179 r = zd_usb_init_hw(usb);
180 if (r)
181 goto out;
182 }
183
169 tasklet_enable(&mac->rx_tasklet); 184 tasklet_enable(&mac->rx_tasklet);
170 185
171 r = zd_chip_enable_int(chip); 186 r = zd_chip_enable_int(chip);
172 if (r < 0) 187 if (r < 0)
173 goto out; 188 goto out;
174 189
190 r = zd_write_mac_addr(chip, netdev->dev_addr);
191 if (r)
192 goto disable_int;
193
175 r = zd_chip_set_basic_rates(chip, CR_RATES_80211B | CR_RATES_80211G); 194 r = zd_chip_set_basic_rates(chip, CR_RATES_80211B | CR_RATES_80211G);
176 if (r < 0) 195 if (r < 0)
177 goto disable_int; 196 goto disable_int;
@@ -251,9 +270,11 @@ int zd_mac_set_mac_address(struct net_device *netdev, void *p)
251 dev_dbg_f(zd_mac_dev(mac), 270 dev_dbg_f(zd_mac_dev(mac),
252 "Setting MAC to " MAC_FMT "\n", MAC_ARG(addr->sa_data)); 271 "Setting MAC to " MAC_FMT "\n", MAC_ARG(addr->sa_data));
253 272
254 r = zd_write_mac_addr(chip, addr->sa_data); 273 if (netdev->flags & IFF_UP) {
255 if (r) 274 r = zd_write_mac_addr(chip, addr->sa_data);
256 return r; 275 if (r)
276 return r;
277 }
257 278
258 spin_lock_irqsave(&mac->lock, flags); 279 spin_lock_irqsave(&mac->lock, flags);
259 memcpy(netdev->dev_addr, addr->sa_data, ETH_ALEN); 280 memcpy(netdev->dev_addr, addr->sa_data, ETH_ALEN);
@@ -855,7 +876,7 @@ static int fill_ctrlset(struct zd_mac *mac,
855 /* ZD1211B: Computing the length difference this way, gives us 876 /* ZD1211B: Computing the length difference this way, gives us
856 * flexibility to compute the packet length. 877 * flexibility to compute the packet length.
857 */ 878 */
858 cs->packet_length = cpu_to_le16(mac->chip.is_zd1211b ? 879 cs->packet_length = cpu_to_le16(zd_chip_is_zd1211b(&mac->chip) ?
859 packet_length - frag_len : packet_length); 880 packet_length - frag_len : packet_length);
860 881
861 /* 882 /*
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h
index faf4c7828d4e..9f9344eb50f9 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.h
+++ b/drivers/net/wireless/zd1211rw/zd_mac.h
@@ -189,7 +189,8 @@ int zd_mac_init(struct zd_mac *mac,
189 struct usb_interface *intf); 189 struct usb_interface *intf);
190void zd_mac_clear(struct zd_mac *mac); 190void zd_mac_clear(struct zd_mac *mac);
191 191
192int zd_mac_init_hw(struct zd_mac *mac, u8 device_type); 192int zd_mac_preinit_hw(struct zd_mac *mac);
193int zd_mac_init_hw(struct zd_mac *mac);
193 194
194int zd_mac_open(struct net_device *netdev); 195int zd_mac_open(struct net_device *netdev);
195int zd_mac_stop(struct net_device *netdev); 196int zd_mac_stop(struct net_device *netdev);
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c
index 7407409b60b1..abe5d38f7f4d 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf.c
@@ -34,7 +34,7 @@ static const char * const rfs[] = {
34 [AL2210_RF] = "AL2210_RF", 34 [AL2210_RF] = "AL2210_RF",
35 [MAXIM_NEW_RF] = "MAXIM_NEW_RF", 35 [MAXIM_NEW_RF] = "MAXIM_NEW_RF",
36 [UW2453_RF] = "UW2453_RF", 36 [UW2453_RF] = "UW2453_RF",
37 [UNKNOWN_A_RF] = "UNKNOWN_A_RF", 37 [AL2230S_RF] = "AL2230S_RF",
38 [RALINK_RF] = "RALINK_RF", 38 [RALINK_RF] = "RALINK_RF",
39 [INTERSIL_RF] = "INTERSIL_RF", 39 [INTERSIL_RF] = "INTERSIL_RF",
40 [RF2959_RF] = "RF2959_RF", 40 [RF2959_RF] = "RF2959_RF",
@@ -77,6 +77,7 @@ int zd_rf_init_hw(struct zd_rf *rf, u8 type)
77 r = zd_rf_init_rf2959(rf); 77 r = zd_rf_init_rf2959(rf);
78 break; 78 break;
79 case AL2230_RF: 79 case AL2230_RF:
80 case AL2230S_RF:
80 r = zd_rf_init_al2230(rf); 81 r = zd_rf_init_al2230(rf);
81 break; 82 break;
82 case AL7230B_RF: 83 case AL7230B_RF:
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.h b/drivers/net/wireless/zd1211rw/zd_rf.h
index c6dfd8227f6e..30502f26b71c 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf.h
+++ b/drivers/net/wireless/zd1211rw/zd_rf.h
@@ -26,7 +26,7 @@
26#define AL2210_RF 0x7 26#define AL2210_RF 0x7
27#define MAXIM_NEW_RF 0x8 27#define MAXIM_NEW_RF 0x8
28#define UW2453_RF 0x9 28#define UW2453_RF 0x9
29#define UNKNOWN_A_RF 0xa 29#define AL2230S_RF 0xa
30#define RALINK_RF 0xb 30#define RALINK_RF 0xb
31#define INTERSIL_RF 0xc 31#define INTERSIL_RF 0xc
32#define RF2959_RF 0xd 32#define RF2959_RF 0xd
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
index e7a4ecf7b6e2..006774de3202 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
@@ -21,6 +21,8 @@
21#include "zd_usb.h" 21#include "zd_usb.h"
22#include "zd_chip.h" 22#include "zd_chip.h"
23 23
24#define IS_AL2230S(chip) ((chip)->al2230s_bit || (chip)->rf.type == AL2230S_RF)
25
24static const u32 zd1211_al2230_table[][3] = { 26static const u32 zd1211_al2230_table[][3] = {
25 RF_CHANNEL( 1) = { 0x03f790, 0x033331, 0x00000d, }, 27 RF_CHANNEL( 1) = { 0x03f790, 0x033331, 0x00000d, },
26 RF_CHANNEL( 2) = { 0x03f790, 0x0b3331, 0x00000d, }, 28 RF_CHANNEL( 2) = { 0x03f790, 0x0b3331, 0x00000d, },
@@ -176,7 +178,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
176 if (r) 178 if (r)
177 return r; 179 return r;
178 180
179 if (chip->al2230s_bit) { 181 if (IS_AL2230S(chip)) {
180 r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s, 182 r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
181 ARRAY_SIZE(ioreqs_init_al2230s)); 183 ARRAY_SIZE(ioreqs_init_al2230s));
182 if (r) 184 if (r)
@@ -188,7 +190,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
188 return r; 190 return r;
189 191
190 /* improve band edge for AL2230S */ 192 /* improve band edge for AL2230S */
191 if (chip->al2230s_bit) 193 if (IS_AL2230S(chip))
192 r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS); 194 r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS);
193 else 195 else
194 r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS); 196 r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS);
@@ -314,7 +316,7 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
314 if (r) 316 if (r)
315 return r; 317 return r;
316 318
317 if (chip->al2230s_bit) { 319 if (IS_AL2230S(chip)) {
318 r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s, 320 r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
319 ARRAY_SIZE(ioreqs_init_al2230s)); 321 ARRAY_SIZE(ioreqs_init_al2230s));
320 if (r) 322 if (r)
@@ -328,7 +330,7 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
328 if (r) 330 if (r)
329 return r; 331 return r;
330 332
331 if (chip->al2230s_bit) 333 if (IS_AL2230S(chip))
332 r = zd_rfwrite_locked(chip, 0x241000, RF_RV_BITS); 334 r = zd_rfwrite_locked(chip, 0x241000, RF_RV_BITS);
333 else 335 else
334 r = zd_rfwrite_locked(chip, 0x25a000, RF_RV_BITS); 336 r = zd_rfwrite_locked(chip, 0x25a000, RF_RV_BITS);
@@ -422,7 +424,7 @@ int zd_rf_init_al2230(struct zd_rf *rf)
422 struct zd_chip *chip = zd_rf_to_chip(rf); 424 struct zd_chip *chip = zd_rf_to_chip(rf);
423 425
424 rf->switch_radio_off = al2230_switch_radio_off; 426 rf->switch_radio_off = al2230_switch_radio_off;
425 if (chip->is_zd1211b) { 427 if (zd_chip_is_zd1211b(chip)) {
426 rf->init_hw = zd1211b_al2230_init_hw; 428 rf->init_hw = zd1211b_al2230_init_hw;
427 rf->set_channel = zd1211b_al2230_set_channel; 429 rf->set_channel = zd1211b_al2230_set_channel;
428 rf->switch_radio_on = zd1211b_al2230_switch_radio_on; 430 rf->switch_radio_on = zd1211b_al2230_switch_radio_on;
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c b/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c
index f4e8b6ada854..73d0bb26f810 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c
@@ -473,7 +473,7 @@ int zd_rf_init_al7230b(struct zd_rf *rf)
473{ 473{
474 struct zd_chip *chip = zd_rf_to_chip(rf); 474 struct zd_chip *chip = zd_rf_to_chip(rf);
475 475
476 if (chip->is_zd1211b) { 476 if (zd_chip_is_zd1211b(chip)) {
477 rf->init_hw = zd1211b_al7230b_init_hw; 477 rf->init_hw = zd1211b_al7230b_init_hw;
478 rf->switch_radio_on = zd1211b_al7230b_switch_radio_on; 478 rf->switch_radio_on = zd1211b_al7230b_switch_radio_on;
479 rf->set_channel = zd1211b_al7230b_set_channel; 479 rf->set_channel = zd1211b_al7230b_set_channel;
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_rf2959.c b/drivers/net/wireless/zd1211rw/zd_rf_rf2959.c
index 2d736bdf707c..cc70d40684ea 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_rf2959.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_rf2959.c
@@ -265,7 +265,7 @@ int zd_rf_init_rf2959(struct zd_rf *rf)
265{ 265{
266 struct zd_chip *chip = zd_rf_to_chip(rf); 266 struct zd_chip *chip = zd_rf_to_chip(rf);
267 267
268 if (chip->is_zd1211b) { 268 if (zd_chip_is_zd1211b(chip)) {
269 dev_err(zd_chip_dev(chip), 269 dev_err(zd_chip_dev(chip),
270 "RF2959 is currently not supported for ZD1211B" 270 "RF2959 is currently not supported for ZD1211B"
271 " devices\n"); 271 " devices\n");
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c b/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
index 414e40d571ab..857dcf3eae61 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
@@ -486,7 +486,7 @@ static int uw2453_switch_radio_on(struct zd_rf *rf)
486 if (r) 486 if (r)
487 return r; 487 return r;
488 488
489 if (chip->is_zd1211b) 489 if (zd_chip_is_zd1211b(chip))
490 ioreqs[1].value = 0x7f; 490 ioreqs[1].value = 0x7f;
491 491
492 return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); 492 return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 740a2194fdde..a1a54748ccbd 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -71,6 +71,7 @@ static struct usb_device_id usb_ids[] = {
71 { USB_DEVICE(0x0586, 0x3412), .driver_info = DEVICE_ZD1211B }, 71 { USB_DEVICE(0x0586, 0x3412), .driver_info = DEVICE_ZD1211B },
72 { USB_DEVICE(0x0586, 0x3413), .driver_info = DEVICE_ZD1211B }, 72 { USB_DEVICE(0x0586, 0x3413), .driver_info = DEVICE_ZD1211B },
73 { USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B }, 73 { USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B },
74 { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B },
74 /* "Driverless" devices that need ejecting */ 75 /* "Driverless" devices that need ejecting */
75 { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, 76 { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
76 { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, 77 { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },
@@ -195,26 +196,27 @@ static u16 get_word(const void *data, u16 offset)
195 return le16_to_cpu(p[offset]); 196 return le16_to_cpu(p[offset]);
196} 197}
197 198
198static char *get_fw_name(char *buffer, size_t size, u8 device_type, 199static char *get_fw_name(struct zd_usb *usb, char *buffer, size_t size,
199 const char* postfix) 200 const char* postfix)
200{ 201{
201 scnprintf(buffer, size, "%s%s", 202 scnprintf(buffer, size, "%s%s",
202 device_type == DEVICE_ZD1211B ? 203 usb->is_zd1211b ?
203 FW_ZD1211B_PREFIX : FW_ZD1211_PREFIX, 204 FW_ZD1211B_PREFIX : FW_ZD1211_PREFIX,
204 postfix); 205 postfix);
205 return buffer; 206 return buffer;
206} 207}
207 208
208static int handle_version_mismatch(struct usb_device *udev, u8 device_type, 209static int handle_version_mismatch(struct zd_usb *usb,
209 const struct firmware *ub_fw) 210 const struct firmware *ub_fw)
210{ 211{
212 struct usb_device *udev = zd_usb_to_usbdev(usb);
211 const struct firmware *ur_fw = NULL; 213 const struct firmware *ur_fw = NULL;
212 int offset; 214 int offset;
213 int r = 0; 215 int r = 0;
214 char fw_name[128]; 216 char fw_name[128];
215 217
216 r = request_fw_file(&ur_fw, 218 r = request_fw_file(&ur_fw,
217 get_fw_name(fw_name, sizeof(fw_name), device_type, "ur"), 219 get_fw_name(usb, fw_name, sizeof(fw_name), "ur"),
218 &udev->dev); 220 &udev->dev);
219 if (r) 221 if (r)
220 goto error; 222 goto error;
@@ -237,11 +239,12 @@ error:
237 return r; 239 return r;
238} 240}
239 241
240static int upload_firmware(struct usb_device *udev, u8 device_type) 242static int upload_firmware(struct zd_usb *usb)
241{ 243{
242 int r; 244 int r;
243 u16 fw_bcdDevice; 245 u16 fw_bcdDevice;
244 u16 bcdDevice; 246 u16 bcdDevice;
247 struct usb_device *udev = zd_usb_to_usbdev(usb);
245 const struct firmware *ub_fw = NULL; 248 const struct firmware *ub_fw = NULL;
246 const struct firmware *uph_fw = NULL; 249 const struct firmware *uph_fw = NULL;
247 char fw_name[128]; 250 char fw_name[128];
@@ -249,7 +252,7 @@ static int upload_firmware(struct usb_device *udev, u8 device_type)
249 bcdDevice = get_bcdDevice(udev); 252 bcdDevice = get_bcdDevice(udev);
250 253
251 r = request_fw_file(&ub_fw, 254 r = request_fw_file(&ub_fw,
252 get_fw_name(fw_name, sizeof(fw_name), device_type, "ub"), 255 get_fw_name(usb, fw_name, sizeof(fw_name), "ub"),
253 &udev->dev); 256 &udev->dev);
254 if (r) 257 if (r)
255 goto error; 258 goto error;
@@ -264,7 +267,7 @@ static int upload_firmware(struct usb_device *udev, u8 device_type)
264 dev_warn(&udev->dev, "device has old bootcode, please " 267 dev_warn(&udev->dev, "device has old bootcode, please "
265 "report success or failure\n"); 268 "report success or failure\n");
266 269
267 r = handle_version_mismatch(udev, device_type, ub_fw); 270 r = handle_version_mismatch(usb, ub_fw);
268 if (r) 271 if (r)
269 goto error; 272 goto error;
270 } else { 273 } else {
@@ -275,7 +278,7 @@ static int upload_firmware(struct usb_device *udev, u8 device_type)
275 278
276 279
277 r = request_fw_file(&uph_fw, 280 r = request_fw_file(&uph_fw,
278 get_fw_name(fw_name, sizeof(fw_name), device_type, "uphr"), 281 get_fw_name(usb, fw_name, sizeof(fw_name), "uphr"),
279 &udev->dev); 282 &udev->dev);
280 if (r) 283 if (r)
281 goto error; 284 goto error;
@@ -294,6 +297,30 @@ error:
294 return r; 297 return r;
295} 298}
296 299
300/* Read data from device address space using "firmware interface" which does
301 * not require firmware to be loaded. */
302int zd_usb_read_fw(struct zd_usb *usb, zd_addr_t addr, u8 *data, u16 len)
303{
304 int r;
305 struct usb_device *udev = zd_usb_to_usbdev(usb);
306
307 r = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
308 USB_REQ_FIRMWARE_READ_DATA, USB_DIR_IN | 0x40, addr, 0,
309 data, len, 5000);
310 if (r < 0) {
311 dev_err(&udev->dev,
312 "read over firmware interface failed: %d\n", r);
313 return r;
314 } else if (r != len) {
315 dev_err(&udev->dev,
316 "incomplete read over firmware interface: %d/%d\n",
317 r, len);
318 return -EIO;
319 }
320
321 return 0;
322}
323
297#define urb_dev(urb) (&(urb)->dev->dev) 324#define urb_dev(urb) (&(urb)->dev->dev)
298 325
299static inline void handle_regs_int(struct urb *urb) 326static inline void handle_regs_int(struct urb *urb)
@@ -920,9 +947,42 @@ static int eject_installer(struct usb_interface *intf)
920 return 0; 947 return 0;
921} 948}
922 949
950int zd_usb_init_hw(struct zd_usb *usb)
951{
952 int r;
953 struct zd_mac *mac = zd_usb_to_mac(usb);
954
955 dev_dbg_f(zd_usb_dev(usb), "\n");
956
957 r = upload_firmware(usb);
958 if (r) {
959 dev_err(zd_usb_dev(usb),
960 "couldn't load firmware. Error number %d\n", r);
961 return r;
962 }
963
964 r = usb_reset_configuration(zd_usb_to_usbdev(usb));
965 if (r) {
966 dev_dbg_f(zd_usb_dev(usb),
967 "couldn't reset configuration. Error number %d\n", r);
968 return r;
969 }
970
971 r = zd_mac_init_hw(mac);
972 if (r) {
973 dev_dbg_f(zd_usb_dev(usb),
974 "couldn't initialize mac. Error number %d\n", r);
975 return r;
976 }
977
978 usb->initialized = 1;
979 return 0;
980}
981
923static int probe(struct usb_interface *intf, const struct usb_device_id *id) 982static int probe(struct usb_interface *intf, const struct usb_device_id *id)
924{ 983{
925 int r; 984 int r;
985 struct zd_usb *usb;
926 struct usb_device *udev = interface_to_usbdev(intf); 986 struct usb_device *udev = interface_to_usbdev(intf);
927 struct net_device *netdev = NULL; 987 struct net_device *netdev = NULL;
928 988
@@ -950,26 +1010,10 @@ static int probe(struct usb_interface *intf, const struct usb_device_id *id)
950 goto error; 1010 goto error;
951 } 1011 }
952 1012
953 r = upload_firmware(udev, id->driver_info); 1013 usb = &zd_netdev_mac(netdev)->chip.usb;
954 if (r) { 1014 usb->is_zd1211b = (id->driver_info == DEVICE_ZD1211B) != 0;
955 dev_err(&intf->dev,
956 "couldn't load firmware. Error number %d\n", r);
957 goto error;
958 }
959 1015
960 r = usb_reset_configuration(udev); 1016 r = zd_mac_preinit_hw(zd_netdev_mac(netdev));
961 if (r) {
962 dev_dbg_f(&intf->dev,
963 "couldn't reset configuration. Error number %d\n", r);
964 goto error;
965 }
966
967 /* At this point the interrupt endpoint is not generally enabled. We
968 * save the USB bandwidth until the network device is opened. But
969 * notify that the initialization of the MAC will require the
970 * interrupts to be temporary enabled.
971 */
972 r = zd_mac_init_hw(zd_netdev_mac(netdev), id->driver_info);
973 if (r) { 1017 if (r) {
974 dev_dbg_f(&intf->dev, 1018 dev_dbg_f(&intf->dev,
975 "couldn't initialize mac. Error number %d\n", r); 1019 "couldn't initialize mac. Error number %d\n", r);
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.h b/drivers/net/wireless/zd1211rw/zd_usb.h
index 506ea6a74393..961a7a12ad68 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.h
+++ b/drivers/net/wireless/zd1211rw/zd_usb.h
@@ -188,6 +188,7 @@ struct zd_usb {
188 struct zd_usb_rx rx; 188 struct zd_usb_rx rx;
189 struct zd_usb_tx tx; 189 struct zd_usb_tx tx;
190 struct usb_interface *intf; 190 struct usb_interface *intf;
191 u8 is_zd1211b:1, initialized:1;
191}; 192};
192 193
193#define zd_usb_dev(usb) (&usb->intf->dev) 194#define zd_usb_dev(usb) (&usb->intf->dev)
@@ -236,6 +237,8 @@ int zd_usb_iowrite16v(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs,
236 237
237int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits); 238int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits);
238 239
240int zd_usb_read_fw(struct zd_usb *usb, zd_addr_t addr, u8 *data, u16 len);
241
239extern struct workqueue_struct *zd_workqueue; 242extern struct workqueue_struct *zd_workqueue;
240 243
241#endif /* _ZD_USB_H */ 244#endif /* _ZD_USB_H */