diff options
Diffstat (limited to 'drivers/usb/core/driver.c')
| -rw-r--r-- | drivers/usb/core/driver.c | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index f536aebc958e..445455a4429b 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
| @@ -367,6 +367,7 @@ static int usb_probe_interface(struct device *dev) | |||
| 367 | return error; | 367 | return error; |
| 368 | 368 | ||
| 369 | err: | 369 | err: |
| 370 | usb_set_intfdata(intf, NULL); | ||
| 370 | intf->needs_remote_wakeup = 0; | 371 | intf->needs_remote_wakeup = 0; |
| 371 | intf->condition = USB_INTERFACE_UNBOUND; | 372 | intf->condition = USB_INTERFACE_UNBOUND; |
| 372 | usb_cancel_queued_reset(intf); | 373 | usb_cancel_queued_reset(intf); |
| @@ -606,30 +607,19 @@ int usb_match_device(struct usb_device *dev, const struct usb_device_id *id) | |||
| 606 | } | 607 | } |
| 607 | 608 | ||
| 608 | /* returns 0 if no match, 1 if match */ | 609 | /* returns 0 if no match, 1 if match */ |
| 609 | int usb_match_one_id(struct usb_interface *interface, | 610 | int usb_match_one_id_intf(struct usb_device *dev, |
| 610 | const struct usb_device_id *id) | 611 | struct usb_host_interface *intf, |
| 612 | const struct usb_device_id *id) | ||
| 611 | { | 613 | { |
| 612 | struct usb_host_interface *intf; | 614 | /* The interface class, subclass, protocol and number should never be |
| 613 | struct usb_device *dev; | ||
| 614 | |||
| 615 | /* proc_connectinfo in devio.c may call us with id == NULL. */ | ||
| 616 | if (id == NULL) | ||
| 617 | return 0; | ||
| 618 | |||
| 619 | intf = interface->cur_altsetting; | ||
| 620 | dev = interface_to_usbdev(interface); | ||
| 621 | |||
| 622 | if (!usb_match_device(dev, id)) | ||
| 623 | return 0; | ||
| 624 | |||
| 625 | /* The interface class, subclass, and protocol should never be | ||
| 626 | * checked for a match if the device class is Vendor Specific, | 615 | * checked for a match if the device class is Vendor Specific, |
| 627 | * unless the match record specifies the Vendor ID. */ | 616 | * unless the match record specifies the Vendor ID. */ |
| 628 | if (dev->descriptor.bDeviceClass == USB_CLASS_VENDOR_SPEC && | 617 | if (dev->descriptor.bDeviceClass == USB_CLASS_VENDOR_SPEC && |
| 629 | !(id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && | 618 | !(id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && |
| 630 | (id->match_flags & (USB_DEVICE_ID_MATCH_INT_CLASS | | 619 | (id->match_flags & (USB_DEVICE_ID_MATCH_INT_CLASS | |
| 631 | USB_DEVICE_ID_MATCH_INT_SUBCLASS | | 620 | USB_DEVICE_ID_MATCH_INT_SUBCLASS | |
| 632 | USB_DEVICE_ID_MATCH_INT_PROTOCOL))) | 621 | USB_DEVICE_ID_MATCH_INT_PROTOCOL | |
| 622 | USB_DEVICE_ID_MATCH_INT_NUMBER))) | ||
| 633 | return 0; | 623 | return 0; |
| 634 | 624 | ||
| 635 | if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) && | 625 | if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) && |
| @@ -644,8 +634,32 @@ int usb_match_one_id(struct usb_interface *interface, | |||
| 644 | (id->bInterfaceProtocol != intf->desc.bInterfaceProtocol)) | 634 | (id->bInterfaceProtocol != intf->desc.bInterfaceProtocol)) |
| 645 | return 0; | 635 | return 0; |
| 646 | 636 | ||
| 637 | if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_NUMBER) && | ||
| 638 | (id->bInterfaceNumber != intf->desc.bInterfaceNumber)) | ||
| 639 | return 0; | ||
| 640 | |||
| 647 | return 1; | 641 | return 1; |
| 648 | } | 642 | } |
| 643 | |||
| 644 | /* returns 0 if no match, 1 if match */ | ||
| 645 | int usb_match_one_id(struct usb_interface *interface, | ||
| 646 | const struct usb_device_id *id) | ||
| 647 | { | ||
| 648 | struct usb_host_interface *intf; | ||
| 649 | struct usb_device *dev; | ||
| 650 | |||
| 651 | /* proc_connectinfo in devio.c may call us with id == NULL. */ | ||
| 652 | if (id == NULL) | ||
| 653 | return 0; | ||
| 654 | |||
| 655 | intf = interface->cur_altsetting; | ||
| 656 | dev = interface_to_usbdev(interface); | ||
| 657 | |||
| 658 | if (!usb_match_device(dev, id)) | ||
| 659 | return 0; | ||
| 660 | |||
| 661 | return usb_match_one_id_intf(dev, intf, id); | ||
| 662 | } | ||
| 649 | EXPORT_SYMBOL_GPL(usb_match_one_id); | 663 | EXPORT_SYMBOL_GPL(usb_match_one_id); |
| 650 | 664 | ||
| 651 | /** | 665 | /** |
