USB: core: add endpoint-blacklist quirk
[linux-2.6-microblaze.git] / drivers / usb / core / config.c
index 26bc05e..7df22bc 100644 (file)
@@ -256,6 +256,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
                struct usb_host_interface *ifp, int num_ep,
                unsigned char *buffer, int size)
 {
+       struct usb_device *udev = to_usb_device(ddev);
        unsigned char *buffer0 = buffer;
        struct usb_endpoint_descriptor *d;
        struct usb_host_endpoint *endpoint;
@@ -297,6 +298,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
                goto skip_to_next_endpoint_or_interface_descriptor;
        }
 
+       /* Ignore blacklisted endpoints */
+       if (udev->quirks & USB_QUIRK_ENDPOINT_BLACKLIST) {
+               if (usb_endpoint_is_blacklisted(udev, ifp, d)) {
+                       dev_warn(ddev, "config %d interface %d altsetting %d has a blacklisted endpoint with address 0x%X, skipping\n",
+                                       cfgno, inum, asnum,
+                                       d->bEndpointAddress);
+                       goto skip_to_next_endpoint_or_interface_descriptor;
+               }
+       }
+
        endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
        ++ifp->desc.bNumEndpoints;