aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/zd1211rw/zd_usb.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2007-11-19 10:00:29 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:04:47 -0500
commit459c51ad6e1fc19e91a53798358433d3c08cd09d (patch)
treefb86feacf1b229cb4ab6b36b4d1deaf4983b1e45 /drivers/net/wireless/zd1211rw/zd_usb.c
parent0765af4493193149505f118d04d9300f0a15c8f5 (diff)
zd1211rw: port to mac80211
This seems to be working smoothly now. Let's not hold back the mac80211 transition any further. This patch ports the existing driver from softmac to mac80211. Many thanks to everyone who helped out with the porting efforts. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/zd1211rw/zd_usb.c')
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c282
1 files changed, 205 insertions, 77 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index c755b6923812..3429576a95f7 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -17,18 +17,16 @@
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/module.h>
21#include <linux/firmware.h> 20#include <linux/firmware.h>
22#include <linux/device.h> 21#include <linux/device.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/skbuff.h> 23#include <linux/skbuff.h>
25#include <linux/usb.h> 24#include <linux/usb.h>
26#include <linux/workqueue.h> 25#include <linux/workqueue.h>
27#include <net/ieee80211.h> 26#include <net/mac80211.h>
28#include <asm/unaligned.h> 27#include <asm/unaligned.h>
29 28
30#include "zd_def.h" 29#include "zd_def.h"
31#include "zd_netdev.h"
32#include "zd_mac.h" 30#include "zd_mac.h"
33#include "zd_usb.h" 31#include "zd_usb.h"
34 32
@@ -353,18 +351,6 @@ out:
353 spin_unlock(&intr->lock); 351 spin_unlock(&intr->lock);
354} 352}
355 353
356static inline void handle_retry_failed_int(struct urb *urb)
357{
358 struct zd_usb *usb = urb->context;
359 struct zd_mac *mac = zd_usb_to_mac(usb);
360 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
361
362 ieee->stats.tx_errors++;
363 ieee->ieee_stats.tx_retry_limit_exceeded++;
364 dev_dbg_f(urb_dev(urb), "retry failed interrupt\n");
365}
366
367
368static void int_urb_complete(struct urb *urb) 354static void int_urb_complete(struct urb *urb)
369{ 355{
370 int r; 356 int r;
@@ -400,7 +386,7 @@ static void int_urb_complete(struct urb *urb)
400 handle_regs_int(urb); 386 handle_regs_int(urb);
401 break; 387 break;
402 case USB_INT_ID_RETRY_FAILED: 388 case USB_INT_ID_RETRY_FAILED:
403 handle_retry_failed_int(urb); 389 zd_mac_tx_failed(zd_usb_to_hw(urb->context));
404 break; 390 break;
405 default: 391 default:
406 dev_dbg_f(urb_dev(urb), "error: urb %p unknown id %x\n", urb, 392 dev_dbg_f(urb_dev(urb), "error: urb %p unknown id %x\n", urb,
@@ -530,14 +516,10 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
530 unsigned int length) 516 unsigned int length)
531{ 517{
532 int i; 518 int i;
533 struct zd_mac *mac = zd_usb_to_mac(usb);
534 const struct rx_length_info *length_info; 519 const struct rx_length_info *length_info;
535 520
536 if (length < sizeof(struct rx_length_info)) { 521 if (length < sizeof(struct rx_length_info)) {
537 /* It's not a complete packet anyhow. */ 522 /* It's not a complete packet anyhow. */
538 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
539 ieee->stats.rx_errors++;
540 ieee->stats.rx_length_errors++;
541 return; 523 return;
542 } 524 }
543 length_info = (struct rx_length_info *) 525 length_info = (struct rx_length_info *)
@@ -561,13 +543,13 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
561 n = l+k; 543 n = l+k;
562 if (n > length) 544 if (n > length)
563 return; 545 return;
564 zd_mac_rx_irq(mac, buffer+l, k); 546 zd_mac_rx(zd_usb_to_hw(usb), buffer+l, k);
565 if (i >= 2) 547 if (i >= 2)
566 return; 548 return;
567 l = (n+3) & ~3; 549 l = (n+3) & ~3;
568 } 550 }
569 } else { 551 } else {
570 zd_mac_rx_irq(mac, buffer, length); 552 zd_mac_rx(zd_usb_to_hw(usb), buffer, length);
571 } 553 }
572} 554}
573 555
@@ -629,7 +611,7 @@ resubmit:
629 usb_submit_urb(urb, GFP_ATOMIC); 611 usb_submit_urb(urb, GFP_ATOMIC);
630} 612}
631 613
632static struct urb *alloc_urb(struct zd_usb *usb) 614static struct urb *alloc_rx_urb(struct zd_usb *usb)
633{ 615{
634 struct usb_device *udev = zd_usb_to_usbdev(usb); 616 struct usb_device *udev = zd_usb_to_usbdev(usb);
635 struct urb *urb; 617 struct urb *urb;
@@ -653,7 +635,7 @@ static struct urb *alloc_urb(struct zd_usb *usb)
653 return urb; 635 return urb;
654} 636}
655 637
656static void free_urb(struct urb *urb) 638static void free_rx_urb(struct urb *urb)
657{ 639{
658 if (!urb) 640 if (!urb)
659 return; 641 return;
@@ -671,11 +653,11 @@ int zd_usb_enable_rx(struct zd_usb *usb)
671 dev_dbg_f(zd_usb_dev(usb), "\n"); 653 dev_dbg_f(zd_usb_dev(usb), "\n");
672 654
673 r = -ENOMEM; 655 r = -ENOMEM;
674 urbs = kcalloc(URBS_COUNT, sizeof(struct urb *), GFP_KERNEL); 656 urbs = kcalloc(RX_URBS_COUNT, sizeof(struct urb *), GFP_KERNEL);
675 if (!urbs) 657 if (!urbs)
676 goto error; 658 goto error;
677 for (i = 0; i < URBS_COUNT; i++) { 659 for (i = 0; i < RX_URBS_COUNT; i++) {
678 urbs[i] = alloc_urb(usb); 660 urbs[i] = alloc_rx_urb(usb);
679 if (!urbs[i]) 661 if (!urbs[i])
680 goto error; 662 goto error;
681 } 663 }
@@ -688,10 +670,10 @@ int zd_usb_enable_rx(struct zd_usb *usb)
688 goto error; 670 goto error;
689 } 671 }
690 rx->urbs = urbs; 672 rx->urbs = urbs;
691 rx->urbs_count = URBS_COUNT; 673 rx->urbs_count = RX_URBS_COUNT;
692 spin_unlock_irq(&rx->lock); 674 spin_unlock_irq(&rx->lock);
693 675
694 for (i = 0; i < URBS_COUNT; i++) { 676 for (i = 0; i < RX_URBS_COUNT; i++) {
695 r = usb_submit_urb(urbs[i], GFP_KERNEL); 677 r = usb_submit_urb(urbs[i], GFP_KERNEL);
696 if (r) 678 if (r)
697 goto error_submit; 679 goto error_submit;
@@ -699,7 +681,7 @@ int zd_usb_enable_rx(struct zd_usb *usb)
699 681
700 return 0; 682 return 0;
701error_submit: 683error_submit:
702 for (i = 0; i < URBS_COUNT; i++) { 684 for (i = 0; i < RX_URBS_COUNT; i++) {
703 usb_kill_urb(urbs[i]); 685 usb_kill_urb(urbs[i]);
704 } 686 }
705 spin_lock_irq(&rx->lock); 687 spin_lock_irq(&rx->lock);
@@ -708,8 +690,8 @@ error_submit:
708 spin_unlock_irq(&rx->lock); 690 spin_unlock_irq(&rx->lock);
709error: 691error:
710 if (urbs) { 692 if (urbs) {
711 for (i = 0; i < URBS_COUNT; i++) 693 for (i = 0; i < RX_URBS_COUNT; i++)
712 free_urb(urbs[i]); 694 free_rx_urb(urbs[i]);
713 } 695 }
714 return r; 696 return r;
715} 697}
@@ -731,7 +713,7 @@ void zd_usb_disable_rx(struct zd_usb *usb)
731 713
732 for (i = 0; i < count; i++) { 714 for (i = 0; i < count; i++) {
733 usb_kill_urb(urbs[i]); 715 usb_kill_urb(urbs[i]);
734 free_urb(urbs[i]); 716 free_rx_urb(urbs[i]);
735 } 717 }
736 kfree(urbs); 718 kfree(urbs);
737 719
@@ -741,9 +723,142 @@ void zd_usb_disable_rx(struct zd_usb *usb)
741 spin_unlock_irqrestore(&rx->lock, flags); 723 spin_unlock_irqrestore(&rx->lock, flags);
742} 724}
743 725
726/**
727 * zd_usb_disable_tx - disable transmission
728 * @usb: the zd1211rw-private USB structure
729 *
730 * Frees all URBs in the free list and marks the transmission as disabled.
731 */
732void zd_usb_disable_tx(struct zd_usb *usb)
733{
734 struct zd_usb_tx *tx = &usb->tx;
735 unsigned long flags;
736 struct list_head *pos, *n;
737
738 spin_lock_irqsave(&tx->lock, flags);
739 list_for_each_safe(pos, n, &tx->free_urb_list) {
740 list_del(pos);
741 usb_free_urb(list_entry(pos, struct urb, urb_list));
742 }
743 tx->enabled = 0;
744 tx->submitted_urbs = 0;
745 /* The stopped state is ignored, relying on ieee80211_wake_queues()
746 * in a potentionally following zd_usb_enable_tx().
747 */
748 spin_unlock_irqrestore(&tx->lock, flags);
749}
750
751/**
752 * zd_usb_enable_tx - enables transmission
753 * @usb: a &struct zd_usb pointer
754 *
755 * This function enables transmission and prepares the &zd_usb_tx data
756 * structure.
757 */
758void zd_usb_enable_tx(struct zd_usb *usb)
759{
760 unsigned long flags;
761 struct zd_usb_tx *tx = &usb->tx;
762
763 spin_lock_irqsave(&tx->lock, flags);
764 tx->enabled = 1;
765 tx->submitted_urbs = 0;
766 ieee80211_wake_queues(zd_usb_to_hw(usb));
767 tx->stopped = 0;
768 spin_unlock_irqrestore(&tx->lock, flags);
769}
770
771/**
772 * alloc_tx_urb - provides an tx URB
773 * @usb: a &struct zd_usb pointer
774 *
775 * Allocates a new URB. If possible takes the urb from the free list in
776 * usb->tx.
777 */
778static struct urb *alloc_tx_urb(struct zd_usb *usb)
779{
780 struct zd_usb_tx *tx = &usb->tx;
781 unsigned long flags;
782 struct list_head *entry;
783 struct urb *urb;
784
785 spin_lock_irqsave(&tx->lock, flags);
786 if (list_empty(&tx->free_urb_list)) {
787 urb = usb_alloc_urb(0, GFP_ATOMIC);
788 goto out;
789 }
790 entry = tx->free_urb_list.next;
791 list_del(entry);
792 urb = list_entry(entry, struct urb, urb_list);
793out:
794 spin_unlock_irqrestore(&tx->lock, flags);
795 return urb;
796}
797
798/**
799 * free_tx_urb - frees a used tx URB
800 * @usb: a &struct zd_usb pointer
801 * @urb: URB to be freed
802 *
803 * Frees the the transmission URB, which means to put it on the free URB
804 * list.
805 */
806static void free_tx_urb(struct zd_usb *usb, struct urb *urb)
807{
808 struct zd_usb_tx *tx = &usb->tx;
809 unsigned long flags;
810
811 spin_lock_irqsave(&tx->lock, flags);
812 if (!tx->enabled) {
813 usb_free_urb(urb);
814 goto out;
815 }
816 list_add(&urb->urb_list, &tx->free_urb_list);
817out:
818 spin_unlock_irqrestore(&tx->lock, flags);
819}
820
821static void tx_dec_submitted_urbs(struct zd_usb *usb)
822{
823 struct zd_usb_tx *tx = &usb->tx;
824 unsigned long flags;
825
826 spin_lock_irqsave(&tx->lock, flags);
827 --tx->submitted_urbs;
828 if (tx->stopped && tx->submitted_urbs <= ZD_USB_TX_LOW) {
829 ieee80211_wake_queues(zd_usb_to_hw(usb));
830 tx->stopped = 0;
831 }
832 spin_unlock_irqrestore(&tx->lock, flags);
833}
834
835static void tx_inc_submitted_urbs(struct zd_usb *usb)
836{
837 struct zd_usb_tx *tx = &usb->tx;
838 unsigned long flags;
839
840 spin_lock_irqsave(&tx->lock, flags);
841 ++tx->submitted_urbs;
842 if (!tx->stopped && tx->submitted_urbs > ZD_USB_TX_HIGH) {
843 ieee80211_stop_queues(zd_usb_to_hw(usb));
844 tx->stopped = 1;
845 }
846 spin_unlock_irqrestore(&tx->lock, flags);
847}
848
849/**
850 * tx_urb_complete - completes the execution of an URB
851 * @urb: a URB
852 *
853 * This function is called if the URB has been transferred to a device or an
854 * error has happened.
855 */
744static void tx_urb_complete(struct urb *urb) 856static void tx_urb_complete(struct urb *urb)
745{ 857{
746 int r; 858 int r;
859 struct sk_buff *skb;
860 struct zd_tx_skb_control_block *cb;
861 struct zd_usb *usb;
747 862
748 switch (urb->status) { 863 switch (urb->status) {
749 case 0: 864 case 0:
@@ -761,9 +876,12 @@ static void tx_urb_complete(struct urb *urb)
761 goto resubmit; 876 goto resubmit;
762 } 877 }
763free_urb: 878free_urb:
764 usb_buffer_free(urb->dev, urb->transfer_buffer_length, 879 skb = (struct sk_buff *)urb->context;
765 urb->transfer_buffer, urb->transfer_dma); 880 zd_mac_tx_to_dev(skb, urb->status);
766 usb_free_urb(urb); 881 cb = (struct zd_tx_skb_control_block *)skb->cb;
882 usb = &zd_hw_mac(cb->hw)->chip.usb;
883 free_tx_urb(usb, urb);
884 tx_dec_submitted_urbs(usb);
767 return; 885 return;
768resubmit: 886resubmit:
769 r = usb_submit_urb(urb, GFP_ATOMIC); 887 r = usb_submit_urb(urb, GFP_ATOMIC);
@@ -773,43 +891,40 @@ resubmit:
773 } 891 }
774} 892}
775 893
776/* Puts the frame on the USB endpoint. It doesn't wait for 894/**
777 * completion. The frame must contain the control set. 895 * zd_usb_tx: initiates transfer of a frame of the device
896 *
897 * @usb: the zd1211rw-private USB structure
898 * @skb: a &struct sk_buff pointer
899 *
900 * This function tranmits a frame to the device. It doesn't wait for
901 * completion. The frame must contain the control set and have all the
902 * control set information available.
903 *
904 * The function returns 0 if the transfer has been successfully initiated.
778 */ 905 */
779int zd_usb_tx(struct zd_usb *usb, const u8 *frame, unsigned int length) 906int zd_usb_tx(struct zd_usb *usb, struct sk_buff *skb)
780{ 907{
781 int r; 908 int r;
782 struct usb_device *udev = zd_usb_to_usbdev(usb); 909 struct usb_device *udev = zd_usb_to_usbdev(usb);
783 struct urb *urb; 910 struct urb *urb;
784 void *buffer;
785 911
786 urb = usb_alloc_urb(0, GFP_ATOMIC); 912 urb = alloc_tx_urb(usb);
787 if (!urb) { 913 if (!urb) {
788 r = -ENOMEM; 914 r = -ENOMEM;
789 goto out; 915 goto out;
790 } 916 }
791 917
792 buffer = usb_buffer_alloc(zd_usb_to_usbdev(usb), length, GFP_ATOMIC,
793 &urb->transfer_dma);
794 if (!buffer) {
795 r = -ENOMEM;
796 goto error_free_urb;
797 }
798 memcpy(buffer, frame, length);
799
800 usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT), 918 usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT),
801 buffer, length, tx_urb_complete, NULL); 919 skb->data, skb->len, tx_urb_complete, skb);
802 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
803 920
804 r = usb_submit_urb(urb, GFP_ATOMIC); 921 r = usb_submit_urb(urb, GFP_ATOMIC);
805 if (r) 922 if (r)
806 goto error; 923 goto error;
924 tx_inc_submitted_urbs(usb);
807 return 0; 925 return 0;
808error: 926error:
809 usb_buffer_free(zd_usb_to_usbdev(usb), length, buffer, 927 free_tx_urb(usb, urb);
810 urb->transfer_dma);
811error_free_urb:
812 usb_free_urb(urb);
813out: 928out:
814 return r; 929 return r;
815} 930}
@@ -838,16 +953,20 @@ static inline void init_usb_rx(struct zd_usb *usb)
838 953
839static inline void init_usb_tx(struct zd_usb *usb) 954static inline void init_usb_tx(struct zd_usb *usb)
840{ 955{
841 /* FIXME: at this point we will allocate a fixed number of urb's for 956 struct zd_usb_tx *tx = &usb->tx;
842 * use in a cyclic scheme */ 957 spin_lock_init(&tx->lock);
958 tx->enabled = 0;
959 tx->stopped = 0;
960 INIT_LIST_HEAD(&tx->free_urb_list);
961 tx->submitted_urbs = 0;
843} 962}
844 963
845void zd_usb_init(struct zd_usb *usb, struct net_device *netdev, 964void zd_usb_init(struct zd_usb *usb, struct ieee80211_hw *hw,
846 struct usb_interface *intf) 965 struct usb_interface *intf)
847{ 966{
848 memset(usb, 0, sizeof(*usb)); 967 memset(usb, 0, sizeof(*usb));
849 usb->intf = usb_get_intf(intf); 968 usb->intf = usb_get_intf(intf);
850 usb_set_intfdata(usb->intf, netdev); 969 usb_set_intfdata(usb->intf, hw);
851 init_usb_interrupt(usb); 970 init_usb_interrupt(usb);
852 init_usb_tx(usb); 971 init_usb_tx(usb);
853 init_usb_rx(usb); 972 init_usb_rx(usb);
@@ -973,7 +1092,7 @@ int zd_usb_init_hw(struct zd_usb *usb)
973 return r; 1092 return r;
974 } 1093 }
975 1094
976 r = zd_mac_init_hw(mac); 1095 r = zd_mac_init_hw(mac->hw);
977 if (r) { 1096 if (r) {
978 dev_dbg_f(zd_usb_dev(usb), 1097 dev_dbg_f(zd_usb_dev(usb),
979 "couldn't initialize mac. Error number %d\n", r); 1098 "couldn't initialize mac. Error number %d\n", r);
@@ -987,9 +1106,9 @@ int zd_usb_init_hw(struct zd_usb *usb)
987static int probe(struct usb_interface *intf, const struct usb_device_id *id) 1106static int probe(struct usb_interface *intf, const struct usb_device_id *id)
988{ 1107{
989 int r; 1108 int r;
990 struct zd_usb *usb;
991 struct usb_device *udev = interface_to_usbdev(intf); 1109 struct usb_device *udev = interface_to_usbdev(intf);
992 struct net_device *netdev = NULL; 1110 struct zd_usb *usb;
1111 struct ieee80211_hw *hw = NULL;
993 1112
994 print_id(udev); 1113 print_id(udev);
995 1114
@@ -1007,57 +1126,65 @@ static int probe(struct usb_interface *intf, const struct usb_device_id *id)
1007 goto error; 1126 goto error;
1008 } 1127 }
1009 1128
1010 usb_reset_device(interface_to_usbdev(intf)); 1129 r = usb_reset_device(udev);
1130 if (r) {
1131 dev_err(&intf->dev,
1132 "couldn't reset usb device. Error number %d\n", r);
1133 goto error;
1134 }
1011 1135
1012 netdev = zd_netdev_alloc(intf); 1136 hw = zd_mac_alloc_hw(intf);
1013 if (netdev == NULL) { 1137 if (hw == NULL) {
1014 r = -ENOMEM; 1138 r = -ENOMEM;
1015 goto error; 1139 goto error;
1016 } 1140 }
1017 1141
1018 usb = &zd_netdev_mac(netdev)->chip.usb; 1142 usb = &zd_hw_mac(hw)->chip.usb;
1019 usb->is_zd1211b = (id->driver_info == DEVICE_ZD1211B) != 0; 1143 usb->is_zd1211b = (id->driver_info == DEVICE_ZD1211B) != 0;
1020 1144
1021 r = zd_mac_preinit_hw(zd_netdev_mac(netdev)); 1145 r = zd_mac_preinit_hw(hw);
1022 if (r) { 1146 if (r) {
1023 dev_dbg_f(&intf->dev, 1147 dev_dbg_f(&intf->dev,
1024 "couldn't initialize mac. Error number %d\n", r); 1148 "couldn't initialize mac. Error number %d\n", r);
1025 goto error; 1149 goto error;
1026 } 1150 }
1027 1151
1028 r = register_netdev(netdev); 1152 r = ieee80211_register_hw(hw);
1029 if (r) { 1153 if (r) {
1030 dev_dbg_f(&intf->dev, 1154 dev_dbg_f(&intf->dev,
1031 "couldn't register netdev. Error number %d\n", r); 1155 "couldn't register device. Error number %d\n", r);
1032 goto error; 1156 goto error;
1033 } 1157 }
1034 1158
1035 dev_dbg_f(&intf->dev, "successful\n"); 1159 dev_dbg_f(&intf->dev, "successful\n");
1036 dev_info(&intf->dev,"%s\n", netdev->name); 1160 dev_info(&intf->dev, "%s\n", wiphy_name(hw->wiphy));
1037 return 0; 1161 return 0;
1038error: 1162error:
1039 usb_reset_device(interface_to_usbdev(intf)); 1163 usb_reset_device(interface_to_usbdev(intf));
1040 zd_netdev_free(netdev); 1164 if (hw) {
1165 zd_mac_clear(zd_hw_mac(hw));
1166 ieee80211_free_hw(hw);
1167 }
1041 return r; 1168 return r;
1042} 1169}
1043 1170
1044static void disconnect(struct usb_interface *intf) 1171static void disconnect(struct usb_interface *intf)
1045{ 1172{
1046 struct net_device *netdev = zd_intf_to_netdev(intf); 1173 struct ieee80211_hw *hw = zd_intf_to_hw(intf);
1047 struct zd_mac *mac; 1174 struct zd_mac *mac;
1048 struct zd_usb *usb; 1175 struct zd_usb *usb;
1049 1176
1050 /* Either something really bad happened, or we're just dealing with 1177 /* Either something really bad happened, or we're just dealing with
1051 * a DEVICE_INSTALLER. */ 1178 * a DEVICE_INSTALLER. */
1052 if (netdev == NULL) 1179 if (hw == NULL)
1053 return; 1180 return;
1054 1181
1055 mac = zd_netdev_mac(netdev); 1182 mac = zd_hw_mac(hw);
1056 usb = &mac->chip.usb; 1183 usb = &mac->chip.usb;
1057 1184
1058 dev_dbg_f(zd_usb_dev(usb), "\n"); 1185 dev_dbg_f(zd_usb_dev(usb), "\n");
1059 1186
1060 zd_netdev_disconnect(netdev); 1187 ieee80211_unregister_hw(hw);
1061 1188
1062 /* Just in case something has gone wrong! */ 1189 /* Just in case something has gone wrong! */
1063 zd_usb_disable_rx(usb); 1190 zd_usb_disable_rx(usb);
@@ -1070,12 +1197,13 @@ static void disconnect(struct usb_interface *intf)
1070 */ 1197 */
1071 usb_reset_device(interface_to_usbdev(intf)); 1198 usb_reset_device(interface_to_usbdev(intf));
1072 1199
1073 zd_netdev_free(netdev); 1200 zd_mac_clear(mac);
1201 ieee80211_free_hw(hw);
1074 dev_dbg(&intf->dev, "disconnected\n"); 1202 dev_dbg(&intf->dev, "disconnected\n");
1075} 1203}
1076 1204
1077static struct usb_driver driver = { 1205static struct usb_driver driver = {
1078 .name = "zd1211rw", 1206 .name = KBUILD_MODNAME,
1079 .id_table = usb_ids, 1207 .id_table = usb_ids,
1080 .probe = probe, 1208 .probe = probe,
1081 .disconnect = disconnect, 1209 .disconnect = disconnect,