2 * Atheros AR9170 driver
6 * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2009, Christian Lamparter <chunkeey@web.de>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; see the file COPYING. If not, see
21 * http://www.gnu.org/licenses/.
23 * This file incorporates work covered by the following copyright and
25 * Copyright (c) 2007-2008 Atheros Communications, Inc.
27 * Permission to use, copy, modify, and/or distribute this software for any
28 * purpose with or without fee is hereby granted, provided that the above
29 * copyright notice and this permission notice appear in all copies.
31 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
32 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
33 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
34 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
35 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
36 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
37 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
40 #include <linux/module.h>
41 #include <linux/slab.h>
42 #include <linux/usb.h>
43 #include <linux/firmware.h>
44 #include <linux/etherdevice.h>
45 #include <net/mac80211.h>
51 MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>");
52 MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
53 MODULE_LICENSE("GPL");
54 MODULE_DESCRIPTION("Atheros AR9170 802.11n USB wireless");
55 MODULE_FIRMWARE("ar9170.fw");
56 MODULE_FIRMWARE("ar9170-1.fw");
57 MODULE_FIRMWARE("ar9170-2.fw");
59 enum ar9170_requirements {
60 AR9170_REQ_FW1_ONLY = 1,
63 static struct usb_device_id ar9170_usb_ids[] = {
65 { USB_DEVICE(0x0cf3, 0x9170) },
67 { USB_DEVICE(0x0cf3, 0x1001) },
68 /* TP-Link TL-WN821N v2 */
69 { USB_DEVICE(0x0cf3, 0x1002) },
71 { USB_DEVICE(0xcace, 0x0300) },
72 /* D-Link DWA 160 A1 */
73 { USB_DEVICE(0x07d1, 0x3c10) },
74 /* D-Link DWA 160 A2 */
75 { USB_DEVICE(0x07d1, 0x3a09) },
76 /* Netgear WNDA3100 */
77 { USB_DEVICE(0x0846, 0x9010) },
78 /* Netgear WN111 v2 */
79 { USB_DEVICE(0x0846, 0x9001) },
81 { USB_DEVICE(0x0ace, 0x1221) },
83 { USB_DEVICE(0x0586, 0x3417) },
85 { USB_DEVICE(0x0cde, 0x0023) },
87 { USB_DEVICE(0x0cde, 0x0026) },
88 /* Sphairon Homelink 1202 */
89 { USB_DEVICE(0x0cde, 0x0027) },
91 { USB_DEVICE(0x083a, 0xf522) },
93 { USB_DEVICE(0x2019, 0x5304) },
94 /* IO-Data WNGDNUS2 */
95 { USB_DEVICE(0x04bb, 0x093f) },
96 /* AVM FRITZ!WLAN USB Stick N */
97 { USB_DEVICE(0x057C, 0x8401) },
98 /* AVM FRITZ!WLAN USB Stick N 2.4 */
99 { USB_DEVICE(0x057C, 0x8402), .driver_info = AR9170_REQ_FW1_ONLY },
104 MODULE_DEVICE_TABLE(usb, ar9170_usb_ids);
106 static void ar9170_usb_submit_urb(struct ar9170_usb *aru)
112 if (unlikely(!IS_STARTED(&aru->common)))
115 spin_lock_irqsave(&aru->tx_urb_lock, flags);
116 if (atomic_read(&aru->tx_submitted_urbs) >= AR9170_NUM_TX_URBS) {
117 spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
120 atomic_inc(&aru->tx_submitted_urbs);
122 urb = usb_get_from_anchor(&aru->tx_pending);
124 atomic_dec(&aru->tx_submitted_urbs);
125 spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
129 spin_unlock_irqrestore(&aru->tx_urb_lock, flags);
131 aru->tx_pending_urbs--;
132 usb_anchor_urb(urb, &aru->tx_submitted);
134 err = usb_submit_urb(urb, GFP_ATOMIC);
136 if (ar9170_nag_limiter(&aru->common))
137 dev_err(&aru->udev->dev, "submit_urb failed (%d).\n",
140 usb_unanchor_urb(urb);
141 atomic_dec(&aru->tx_submitted_urbs);
142 ar9170_tx_callback(&aru->common, urb->context);
148 static void ar9170_usb_tx_urb_complete_frame(struct urb *urb)
150 struct sk_buff *skb = urb->context;
151 struct ar9170_usb *aru = (struct ar9170_usb *)
152 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
154 if (unlikely(!aru)) {
155 dev_kfree_skb_irq(skb);
159 atomic_dec(&aru->tx_submitted_urbs);
161 ar9170_tx_callback(&aru->common, skb);
163 ar9170_usb_submit_urb(aru);
166 static void ar9170_usb_tx_urb_complete(struct urb *urb)
170 static void ar9170_usb_irq_completed(struct urb *urb)
172 struct ar9170_usb *aru = urb->context;
174 switch (urb->status) {
175 /* everything is fine */
190 ar9170_handle_command_response(&aru->common, urb->transfer_buffer,
194 usb_anchor_urb(urb, &aru->rx_submitted);
195 if (usb_submit_urb(urb, GFP_ATOMIC)) {
196 usb_unanchor_urb(urb);
203 usb_buffer_free(aru->udev, 64, urb->transfer_buffer, urb->transfer_dma);
206 static void ar9170_usb_rx_completed(struct urb *urb)
208 struct sk_buff *skb = urb->context;
209 struct ar9170_usb *aru = (struct ar9170_usb *)
210 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
216 switch (urb->status) {
217 /* everything is fine */
232 skb_put(skb, urb->actual_length);
233 ar9170_rx(&aru->common, skb);
236 skb_reset_tail_pointer(skb);
239 usb_anchor_urb(urb, &aru->rx_submitted);
240 err = usb_submit_urb(urb, GFP_ATOMIC);
242 usb_unanchor_urb(urb);
249 dev_kfree_skb_irq(skb);
252 static int ar9170_usb_prep_rx_urb(struct ar9170_usb *aru,
253 struct urb *urb, gfp_t gfp)
257 skb = __dev_alloc_skb(AR9170_MAX_RX_BUFFER_SIZE + 32, gfp);
261 /* reserve some space for mac80211's radiotap */
262 skb_reserve(skb, 32);
264 usb_fill_bulk_urb(urb, aru->udev,
265 usb_rcvbulkpipe(aru->udev, AR9170_EP_RX),
266 skb->data, min(skb_tailroom(skb),
267 AR9170_MAX_RX_BUFFER_SIZE),
268 ar9170_usb_rx_completed, skb);
273 static int ar9170_usb_alloc_rx_irq_urb(struct ar9170_usb *aru)
275 struct urb *urb = NULL;
279 /* initialize interrupt endpoint */
280 urb = usb_alloc_urb(0, GFP_KERNEL);
284 ibuf = usb_buffer_alloc(aru->udev, 64, GFP_KERNEL, &urb->transfer_dma);
288 usb_fill_int_urb(urb, aru->udev,
289 usb_rcvintpipe(aru->udev, AR9170_EP_IRQ), ibuf,
290 64, ar9170_usb_irq_completed, aru, 1);
291 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
293 usb_anchor_urb(urb, &aru->rx_submitted);
294 err = usb_submit_urb(urb, GFP_KERNEL);
296 usb_unanchor_urb(urb);
297 usb_buffer_free(aru->udev, 64, urb->transfer_buffer,
306 static int ar9170_usb_alloc_rx_bulk_urbs(struct ar9170_usb *aru)
312 for (i = 0; i < AR9170_NUM_RX_URBS; i++) {
314 urb = usb_alloc_urb(0, GFP_KERNEL);
318 err = ar9170_usb_prep_rx_urb(aru, urb, GFP_KERNEL);
324 usb_anchor_urb(urb, &aru->rx_submitted);
325 err = usb_submit_urb(urb, GFP_KERNEL);
327 usb_unanchor_urb(urb);
328 dev_kfree_skb_any((void *) urb->transfer_buffer);
335 /* the device now waiting for a firmware. */
336 aru->common.state = AR9170_IDLE;
341 usb_kill_anchored_urbs(&aru->rx_submitted);
345 static int ar9170_usb_flush(struct ar9170 *ar)
347 struct ar9170_usb *aru = (void *) ar;
352 aru->common.state = AR9170_IDLE;
354 usb_wait_anchor_empty_timeout(&aru->tx_pending,
355 msecs_to_jiffies(800));
356 while ((urb = usb_get_from_anchor(&aru->tx_pending))) {
357 ar9170_tx_callback(&aru->common, (void *) urb->context);
361 /* lets wait a while until the tx - queues are dried out */
362 ret = usb_wait_anchor_empty_timeout(&aru->tx_submitted,
363 msecs_to_jiffies(100));
367 usb_kill_anchored_urbs(&aru->tx_submitted);
369 if (IS_ACCEPTING_CMD(ar))
370 aru->common.state = AR9170_STARTED;
375 static void ar9170_usb_cancel_urbs(struct ar9170_usb *aru)
379 aru->common.state = AR9170_UNKNOWN_STATE;
381 err = ar9170_usb_flush(&aru->common);
383 dev_err(&aru->udev->dev, "stuck tx urbs!\n");
385 usb_poison_anchored_urbs(&aru->tx_submitted);
386 usb_poison_anchored_urbs(&aru->rx_submitted);
389 static int ar9170_usb_exec_cmd(struct ar9170 *ar, enum ar9170_cmd cmd,
390 unsigned int plen, void *payload,
391 unsigned int outlen, void *out)
393 struct ar9170_usb *aru = (void *) ar;
394 struct urb *urb = NULL;
398 if (unlikely(!IS_ACCEPTING_CMD(ar)))
401 if (WARN_ON(plen > AR9170_MAX_CMD_LEN - 4))
404 urb = usb_alloc_urb(0, GFP_ATOMIC);
408 ar->cmdbuf[0] = cpu_to_le32(plen);
409 ar->cmdbuf[0] |= cpu_to_le32(cmd << 8);
410 /* writing multiple regs fills this buffer already */
411 if (plen && payload != (u8 *)(&ar->cmdbuf[1]))
412 memcpy(&ar->cmdbuf[1], payload, plen);
414 spin_lock_irqsave(&aru->common.cmdlock, flags);
415 aru->readbuf = (u8 *)out;
416 aru->readlen = outlen;
417 spin_unlock_irqrestore(&aru->common.cmdlock, flags);
419 usb_fill_int_urb(urb, aru->udev,
420 usb_sndbulkpipe(aru->udev, AR9170_EP_CMD),
421 aru->common.cmdbuf, plen + 4,
422 ar9170_usb_tx_urb_complete, NULL, 1);
424 usb_anchor_urb(urb, &aru->tx_submitted);
425 err = usb_submit_urb(urb, GFP_ATOMIC);
427 usb_unanchor_urb(urb);
433 err = wait_for_completion_timeout(&aru->cmd_wait, HZ);
439 if (aru->readlen != outlen) {
447 /* Maybe the device was removed in the second we were waiting? */
448 if (IS_STARTED(ar)) {
449 dev_err(&aru->udev->dev, "no command feedback "
450 "received (%d).\n", err);
452 /* provide some maybe useful debug information */
453 print_hex_dump_bytes("ar9170 cmd: ", DUMP_PREFIX_NONE,
454 aru->common.cmdbuf, plen + 4);
458 /* invalidate to avoid completing the next prematurely */
459 spin_lock_irqsave(&aru->common.cmdlock, flags);
462 spin_unlock_irqrestore(&aru->common.cmdlock, flags);
469 static int ar9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb)
471 struct ar9170_usb *aru = (struct ar9170_usb *) ar;
474 if (unlikely(!IS_STARTED(ar))) {
475 /* Seriously, what were you drink... err... thinking!? */
479 urb = usb_alloc_urb(0, GFP_ATOMIC);
483 usb_fill_bulk_urb(urb, aru->udev,
484 usb_sndbulkpipe(aru->udev, AR9170_EP_TX),
486 ar9170_usb_tx_urb_complete_frame, skb);
487 urb->transfer_flags |= URB_ZERO_PACKET;
489 usb_anchor_urb(urb, &aru->tx_pending);
490 aru->tx_pending_urbs++;
494 ar9170_usb_submit_urb(aru);
498 static void ar9170_usb_callback_cmd(struct ar9170 *ar, u32 len , void *buffer)
500 struct ar9170_usb *aru = (void *) ar;
504 if (unlikely(!buffer))
507 in = le32_to_cpup((__le32 *)buffer);
508 out = le32_to_cpu(ar->cmdbuf[0]);
510 /* mask off length byte */
513 if (aru->readlen >= 0) {
514 /* add expected length */
517 /* add obtained length */
522 * Some commands (e.g: AR9170_CMD_FREQUENCY) have a variable response
523 * length and we cannot predict the correct length in advance.
524 * So we only check if we provided enough space for the data.
526 if (unlikely(out < in)) {
527 dev_warn(&aru->udev->dev, "received invalid command response "
528 "got %d bytes, instead of %d bytes "
529 "and the resp length is %d bytes\n",
531 print_hex_dump_bytes("ar9170 invalid resp: ",
532 DUMP_PREFIX_OFFSET, buffer, len);
534 * Do not complete, then the command times out,
535 * and we get a stack trace from there.
540 spin_lock_irqsave(&aru->common.cmdlock, flags);
541 if (aru->readbuf && len > 0) {
542 memcpy(aru->readbuf, buffer + 4, len - 4);
545 complete(&aru->cmd_wait);
546 spin_unlock_irqrestore(&aru->common.cmdlock, flags);
549 static int ar9170_usb_upload(struct ar9170_usb *aru, const void *data,
550 size_t len, u32 addr, bool complete)
553 u8 *buf = kmalloc(4096, GFP_KERNEL);
559 transfer = min_t(int, len, 4096);
560 memcpy(buf, data, transfer);
562 err = usb_control_msg(aru->udev, usb_sndctrlpipe(aru->udev, 0),
563 0x30 /* FW DL */, 0x40 | USB_DIR_OUT,
564 addr >> 8, 0, buf, transfer, 1000);
578 err = usb_control_msg(aru->udev, usb_sndctrlpipe(aru->udev, 0),
579 0x31 /* FW DL COMPLETE */,
580 0x40 | USB_DIR_OUT, 0, 0, NULL, 0, 5000);
586 static int ar9170_usb_reset(struct ar9170_usb *aru)
588 int ret, lock = (aru->intf->condition != USB_INTERFACE_BINDING);
591 ret = usb_lock_device_for_reset(aru->udev, aru->intf);
593 dev_err(&aru->udev->dev, "unable to lock device "
594 "for reset (%d).\n", ret);
599 ret = usb_reset_device(aru->udev);
601 usb_unlock_device(aru->udev);
603 /* let it rest - for a second - */
609 static int ar9170_usb_upload_firmware(struct ar9170_usb *aru)
613 if (!aru->init_values)
614 goto upload_fw_start;
616 /* First, upload initial values to device RAM */
617 err = ar9170_usb_upload(aru, aru->init_values->data,
618 aru->init_values->size, 0x102800, false);
620 dev_err(&aru->udev->dev, "firmware part 1 "
621 "upload failed (%d).\n", err);
627 /* Then, upload the firmware itself and start it */
628 return ar9170_usb_upload(aru, aru->firmware->data, aru->firmware->size,
632 static int ar9170_usb_init_transport(struct ar9170_usb *aru)
634 struct ar9170 *ar = (void *) &aru->common;
637 ar9170_regwrite_begin(ar);
639 /* Set USB Rx stream mode MAX packet number to 2 */
640 ar9170_regwrite(AR9170_USB_REG_MAX_AGG_UPLOAD, 0x4);
642 /* Set USB Rx stream mode timeout to 10us */
643 ar9170_regwrite(AR9170_USB_REG_UPLOAD_TIME_CTL, 0x80);
645 ar9170_regwrite_finish();
647 err = ar9170_regwrite_result();
649 dev_err(&aru->udev->dev, "USB setup failed (%d).\n", err);
654 static void ar9170_usb_stop(struct ar9170 *ar)
656 struct ar9170_usb *aru = (void *) ar;
659 if (IS_ACCEPTING_CMD(ar))
660 aru->common.state = AR9170_STOPPED;
662 ret = ar9170_usb_flush(ar);
664 dev_err(&aru->udev->dev, "kill pending tx urbs.\n");
666 usb_poison_anchored_urbs(&aru->tx_submitted);
670 * So far we freed all tx urbs, but we won't dare to touch any rx urbs.
671 * Else we would end up with a unresponsive device...
675 static int ar9170_usb_open(struct ar9170 *ar)
677 struct ar9170_usb *aru = (void *) ar;
680 usb_unpoison_anchored_urbs(&aru->tx_submitted);
681 err = ar9170_usb_init_transport(aru);
683 usb_poison_anchored_urbs(&aru->tx_submitted);
687 aru->common.state = AR9170_IDLE;
691 static int ar9170_usb_init_device(struct ar9170_usb *aru)
695 err = ar9170_usb_alloc_rx_irq_urb(aru);
699 err = ar9170_usb_alloc_rx_bulk_urbs(aru);
703 err = ar9170_usb_upload_firmware(aru);
705 err = ar9170_echo_test(&aru->common, 0x60d43110);
707 /* force user invention, by disabling the device */
708 err = usb_driver_set_configuration(aru->udev, -1);
709 dev_err(&aru->udev->dev, "device is in a bad state. "
710 "please reconnect it!\n");
718 ar9170_usb_cancel_urbs(aru);
724 static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
726 struct device *parent = aru->udev->dev.parent;
728 /* unbind anything failed */
731 device_release_driver(&aru->udev->dev);
736 static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
738 struct ar9170_usb *aru = context;
744 dev_err(&aru->udev->dev, "firmware file not found.\n");
748 err = ar9170_usb_init_device(aru);
752 err = ar9170_usb_open(&aru->common);
756 err = ar9170_register(&aru->common, &aru->udev->dev);
758 ar9170_usb_stop(&aru->common);
765 ar9170_usb_cancel_urbs(aru);
768 ar9170_usb_firmware_failed(aru);
771 static void ar9170_usb_firmware_inits(const struct firmware *fw,
774 struct ar9170_usb *aru = context;
778 dev_err(&aru->udev->dev, "file with init values not found.\n");
779 ar9170_usb_firmware_failed(aru);
783 aru->init_values = fw;
785 /* ok so we have the init values -- get code for two-stage */
787 err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-2.fw",
788 &aru->udev->dev, GFP_KERNEL, aru,
789 ar9170_usb_firmware_finish);
791 ar9170_usb_firmware_failed(aru);
794 static void ar9170_usb_firmware_step2(const struct firmware *fw, void *context)
796 struct ar9170_usb *aru = context;
800 ar9170_usb_firmware_finish(fw, context);
804 if (aru->req_one_stage_fw) {
805 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
806 "not found and is required for this device\n");
807 ar9170_usb_firmware_failed(aru);
811 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
812 "not found, trying old firmware...\n");
814 err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-1.fw",
815 &aru->udev->dev, GFP_KERNEL, aru,
816 ar9170_usb_firmware_inits);
818 ar9170_usb_firmware_failed(aru);
821 static bool ar9170_requires_one_stage(const struct usb_device_id *id)
823 if (!id->driver_info)
825 if (id->driver_info == AR9170_REQ_FW1_ONLY)
830 static int ar9170_usb_probe(struct usb_interface *intf,
831 const struct usb_device_id *id)
833 struct ar9170_usb *aru;
835 struct usb_device *udev;
838 aru = ar9170_alloc(sizeof(*aru));
844 udev = interface_to_usbdev(intf);
850 aru->req_one_stage_fw = ar9170_requires_one_stage(id);
852 usb_set_intfdata(intf, aru);
853 SET_IEEE80211_DEV(ar->hw, &intf->dev);
855 init_usb_anchor(&aru->rx_submitted);
856 init_usb_anchor(&aru->tx_pending);
857 init_usb_anchor(&aru->tx_submitted);
858 init_completion(&aru->cmd_wait);
859 spin_lock_init(&aru->tx_urb_lock);
861 aru->tx_pending_urbs = 0;
862 atomic_set(&aru->tx_submitted_urbs, 0);
864 aru->common.stop = ar9170_usb_stop;
865 aru->common.flush = ar9170_usb_flush;
866 aru->common.open = ar9170_usb_open;
867 aru->common.tx = ar9170_usb_tx;
868 aru->common.exec_cmd = ar9170_usb_exec_cmd;
869 aru->common.callback_cmd = ar9170_usb_callback_cmd;
872 udev->reset_resume = 1;
873 #endif /* CONFIG_PM */
874 err = ar9170_usb_reset(aru);
878 return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw",
879 &aru->udev->dev, GFP_KERNEL, aru,
880 ar9170_usb_firmware_step2);
882 usb_set_intfdata(intf, NULL);
884 ieee80211_free_hw(ar->hw);
889 static void ar9170_usb_disconnect(struct usb_interface *intf)
891 struct ar9170_usb *aru = usb_get_intfdata(intf);
896 aru->common.state = AR9170_IDLE;
897 ar9170_unregister(&aru->common);
898 ar9170_usb_cancel_urbs(aru);
900 usb_put_dev(aru->udev);
901 usb_set_intfdata(intf, NULL);
902 ieee80211_free_hw(aru->common.hw);
904 release_firmware(aru->init_values);
905 release_firmware(aru->firmware);
909 static int ar9170_suspend(struct usb_interface *intf,
910 pm_message_t message)
912 struct ar9170_usb *aru = usb_get_intfdata(intf);
917 aru->common.state = AR9170_IDLE;
918 ar9170_usb_cancel_urbs(aru);
923 static int ar9170_resume(struct usb_interface *intf)
925 struct ar9170_usb *aru = usb_get_intfdata(intf);
931 usb_unpoison_anchored_urbs(&aru->rx_submitted);
932 usb_unpoison_anchored_urbs(&aru->tx_submitted);
934 err = ar9170_usb_init_device(aru);
938 err = ar9170_usb_open(&aru->common);
945 aru->common.state = AR9170_IDLE;
946 ar9170_usb_cancel_urbs(aru);
950 #endif /* CONFIG_PM */
952 static struct usb_driver ar9170_driver = {
954 .probe = ar9170_usb_probe,
955 .disconnect = ar9170_usb_disconnect,
956 .id_table = ar9170_usb_ids,
959 .suspend = ar9170_suspend,
960 .resume = ar9170_resume,
961 .reset_resume = ar9170_resume,
962 #endif /* CONFIG_PM */
965 static int __init ar9170_init(void)
967 return usb_register(&ar9170_driver);
970 static void __exit ar9170_exit(void)
972 usb_deregister(&ar9170_driver);
975 module_init(ar9170_init);
976 module_exit(ar9170_exit);