aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/hwa-rc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/uwb/hwa-rc.c')
-rw-r--r--drivers/uwb/hwa-rc.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 3d26fa0f8ae1..559f8784acf3 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -51,16 +51,14 @@
51 * 51 *
52 * 52 *
53 */ 53 */
54#include <linux/version.h>
55#include <linux/init.h> 54#include <linux/init.h>
56#include <linux/module.h> 55#include <linux/module.h>
57#include <linux/usb.h> 56#include <linux/usb.h>
58#include <linux/usb/wusb.h> 57#include <linux/usb/wusb.h>
59#include <linux/usb/wusb-wa.h> 58#include <linux/usb/wusb-wa.h>
60#include <linux/uwb.h> 59#include <linux/uwb.h>
60
61#include "uwb-internal.h" 61#include "uwb-internal.h"
62#define D_LOCAL 1
63#include <linux/uwb/debug.h>
64 62
65/* The device uses commands and events from the WHCI specification, although 63/* The device uses commands and events from the WHCI specification, although
66 * reporting itself as WUSB compliant. */ 64 * reporting itself as WUSB compliant. */
@@ -631,17 +629,13 @@ void hwarc_neep_cb(struct urb *urb)
631 629
632 switch (result = urb->status) { 630 switch (result = urb->status) {
633 case 0: 631 case 0:
634 d_printf(3, dev, "NEEP: receive stat %d, %zu bytes\n",
635 urb->status, (size_t)urb->actual_length);
636 uwb_rc_neh_grok(hwarc->uwb_rc, urb->transfer_buffer, 632 uwb_rc_neh_grok(hwarc->uwb_rc, urb->transfer_buffer,
637 urb->actual_length); 633 urb->actual_length);
638 break; 634 break;
639 case -ECONNRESET: /* Not an error, but a controlled situation; */ 635 case -ECONNRESET: /* Not an error, but a controlled situation; */
640 case -ENOENT: /* (we killed the URB)...so, no broadcast */ 636 case -ENOENT: /* (we killed the URB)...so, no broadcast */
641 d_printf(2, dev, "NEEP: URB reset/noent %d\n", urb->status);
642 goto out; 637 goto out;
643 case -ESHUTDOWN: /* going away! */ 638 case -ESHUTDOWN: /* going away! */
644 d_printf(2, dev, "NEEP: URB down %d\n", urb->status);
645 goto out; 639 goto out;
646 default: /* On general errors, retry unless it gets ugly */ 640 default: /* On general errors, retry unless it gets ugly */
647 if (edc_inc(&hwarc->neep_edc, EDC_MAX_ERRORS, 641 if (edc_inc(&hwarc->neep_edc, EDC_MAX_ERRORS,
@@ -650,7 +644,6 @@ void hwarc_neep_cb(struct urb *urb)
650 dev_err(dev, "NEEP: URB error %d\n", urb->status); 644 dev_err(dev, "NEEP: URB error %d\n", urb->status);
651 } 645 }
652 result = usb_submit_urb(urb, GFP_ATOMIC); 646 result = usb_submit_urb(urb, GFP_ATOMIC);
653 d_printf(3, dev, "NEEP: submit %d\n", result);
654 if (result < 0) { 647 if (result < 0) {
655 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", 648 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
656 result); 649 result);
@@ -759,11 +752,11 @@ static int hwarc_get_version(struct uwb_rc *rc)
759 itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength); 752 itr_size = le16_to_cpu(usb_dev->actconfig->desc.wTotalLength);
760 while (itr_size >= sizeof(*hdr)) { 753 while (itr_size >= sizeof(*hdr)) {
761 hdr = (struct usb_descriptor_header *) itr; 754 hdr = (struct usb_descriptor_header *) itr;
762 d_printf(3, dev, "Extra device descriptor: " 755 dev_dbg(dev, "Extra device descriptor: "
763 "type %02x/%u bytes @ %zu (%zu left)\n", 756 "type %02x/%u bytes @ %zu (%zu left)\n",
764 hdr->bDescriptorType, hdr->bLength, 757 hdr->bDescriptorType, hdr->bLength,
765 (itr - usb_dev->rawdescriptors[actconfig_idx]), 758 (itr - usb_dev->rawdescriptors[actconfig_idx]),
766 itr_size); 759 itr_size);
767 if (hdr->bDescriptorType == USB_DT_CS_RADIO_CONTROL) 760 if (hdr->bDescriptorType == USB_DT_CS_RADIO_CONTROL)
768 goto found; 761 goto found;
769 itr += hdr->bLength; 762 itr += hdr->bLength;
@@ -795,8 +788,7 @@ found:
795 goto error; 788 goto error;
796 } 789 }
797 rc->version = version; 790 rc->version = version;
798 d_printf(3, dev, "Device supports WUSB protocol version 0x%04x \n", 791 dev_dbg(dev, "Device supports WUSB protocol version 0x%04x \n", rc->version);
799 rc->version);
800 result = 0; 792 result = 0;
801error: 793error:
802 return result; 794 return result;
@@ -877,11 +869,28 @@ static void hwarc_disconnect(struct usb_interface *iface)
877 uwb_rc_rm(uwb_rc); 869 uwb_rc_rm(uwb_rc);
878 usb_put_intf(hwarc->usb_iface); 870 usb_put_intf(hwarc->usb_iface);
879 usb_put_dev(hwarc->usb_dev); 871 usb_put_dev(hwarc->usb_dev);
880 d_printf(1, &hwarc->usb_iface->dev, "freed hwarc %p\n", hwarc);
881 kfree(hwarc); 872 kfree(hwarc);
882 uwb_rc_put(uwb_rc); /* when creating the device, refcount = 1 */ 873 uwb_rc_put(uwb_rc); /* when creating the device, refcount = 1 */
883} 874}
884 875
876static int hwarc_pre_reset(struct usb_interface *iface)
877{
878 struct hwarc *hwarc = usb_get_intfdata(iface);
879 struct uwb_rc *uwb_rc = hwarc->uwb_rc;
880
881 uwb_rc_pre_reset(uwb_rc);
882 return 0;
883}
884
885static int hwarc_post_reset(struct usb_interface *iface)
886{
887 struct hwarc *hwarc = usb_get_intfdata(iface);
888 struct uwb_rc *uwb_rc = hwarc->uwb_rc;
889
890 uwb_rc_post_reset(uwb_rc);
891 return 0;
892}
893
885/** USB device ID's that we handle */ 894/** USB device ID's that we handle */
886static struct usb_device_id hwarc_id_table[] = { 895static struct usb_device_id hwarc_id_table[] = {
887 /* D-Link DUB-1210 */ 896 /* D-Link DUB-1210 */
@@ -898,20 +907,16 @@ MODULE_DEVICE_TABLE(usb, hwarc_id_table);
898 907
899static struct usb_driver hwarc_driver = { 908static struct usb_driver hwarc_driver = {
900 .name = "hwa-rc", 909 .name = "hwa-rc",
910 .id_table = hwarc_id_table,
901 .probe = hwarc_probe, 911 .probe = hwarc_probe,
902 .disconnect = hwarc_disconnect, 912 .disconnect = hwarc_disconnect,
903 .id_table = hwarc_id_table, 913 .pre_reset = hwarc_pre_reset,
914 .post_reset = hwarc_post_reset,
904}; 915};
905 916
906static int __init hwarc_driver_init(void) 917static int __init hwarc_driver_init(void)
907{ 918{
908 int result; 919 return usb_register(&hwarc_driver);
909 result = usb_register(&hwarc_driver);
910 if (result < 0)
911 printk(KERN_ERR "HWA-RC: Cannot register USB driver: %d\n",
912 result);
913 return result;
914
915} 920}
916module_init(hwarc_driver_init); 921module_init(hwarc_driver_init);
917 922