MALI: utgard: read parameters of power model from device tree
[firefly-linux-kernel-4.4.55.git] / drivers / uwb / hwa-rc.c
index 810c90ae2c5584fc57113813f2a9251422724840..e75bbe5a10cd23f9d5eba2a8ff839ea13747a175 100644 (file)
@@ -611,7 +611,16 @@ static
 int hwarc_reset(struct uwb_rc *uwb_rc)
 {
        struct hwarc *hwarc = uwb_rc->priv;
-       return usb_reset_device(hwarc->usb_dev);
+       int result;
+
+       /* device lock must be held when calling usb_reset_device. */
+       result = usb_lock_device_for_reset(hwarc->usb_dev, NULL);
+       if (result >= 0) {
+               result = usb_reset_device(hwarc->usb_dev);
+               usb_unlock_device(hwarc->usb_dev);
+       }
+
+       return result;
 }
 
 /**
@@ -709,8 +718,10 @@ static int hwarc_neep_init(struct uwb_rc *rc)
 
 error_neep_submit:
        usb_free_urb(hwarc->neep_urb);
+       hwarc->neep_urb = NULL;
 error_urb_alloc:
        free_page((unsigned long)hwarc->rd_buffer);
+       hwarc->rd_buffer = NULL;
 error_rd_buffer:
        return -ENOMEM;
 }
@@ -723,7 +734,10 @@ static void hwarc_neep_release(struct uwb_rc *rc)
 
        usb_kill_urb(hwarc->neep_urb);
        usb_free_urb(hwarc->neep_urb);
+       hwarc->neep_urb = NULL;
+
        free_page((unsigned long)hwarc->rd_buffer);
+       hwarc->rd_buffer = NULL;
 }
 
 /**
@@ -811,6 +825,9 @@ static int hwarc_probe(struct usb_interface *iface,
        struct hwarc *hwarc;
        struct device *dev = &iface->dev;
 
+       if (iface->cur_altsetting->desc.bNumEndpoints < 1)
+               return -ENODEV;
+
        result = -ENOMEM;
        uwb_rc = uwb_rc_alloc();
        if (uwb_rc == NULL) {
@@ -900,6 +917,12 @@ static const struct usb_device_id hwarc_id_table[] = {
        /* Intel i1480 (using firmware 1.3PA2-20070828) */
        { USB_DEVICE_AND_INTERFACE_INFO(0x8086, 0x0c3b, 0xe0, 0x01, 0x02),
          .driver_info = WUSB_QUIRK_WHCI_CMD_EVT },
+       /* Alereon 5310 */
+       { USB_DEVICE_AND_INTERFACE_INFO(0x13dc, 0x5310, 0xe0, 0x01, 0x02),
+         .driver_info = WUSB_QUIRK_WHCI_CMD_EVT },
+       /* Alereon 5611 */
+       { USB_DEVICE_AND_INTERFACE_INFO(0x13dc, 0x5611, 0xe0, 0x01, 0x02),
+         .driver_info = WUSB_QUIRK_WHCI_CMD_EVT },
        /* Generic match for the Radio Control interface */
        { USB_INTERFACE_INFO(0xe0, 0x01, 0x02), },
        { },