aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/driver.c33
-rw-r--r--drivers/usb/core/usb.h2
2 files changed, 23 insertions, 12 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2aded261f42c..f9196a0a9412 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -366,19 +366,8 @@ void usb_driver_release_interface(struct usb_driver *driver,
366EXPORT_SYMBOL(usb_driver_release_interface); 366EXPORT_SYMBOL(usb_driver_release_interface);
367 367
368/* returns 0 if no match, 1 if match */ 368/* returns 0 if no match, 1 if match */
369int usb_match_one_id(struct usb_interface *interface, 369int usb_match_device(struct usb_device *dev, const struct usb_device_id *id)
370 const struct usb_device_id *id)
371{ 370{
372 struct usb_host_interface *intf;
373 struct usb_device *dev;
374
375 /* proc_connectinfo in devio.c may call us with id == NULL. */
376 if (id == NULL)
377 return 0;
378
379 intf = interface->cur_altsetting;
380 dev = interface_to_usbdev(interface);
381
382 if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) && 371 if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) &&
383 id->idVendor != le16_to_cpu(dev->descriptor.idVendor)) 372 id->idVendor != le16_to_cpu(dev->descriptor.idVendor))
384 return 0; 373 return 0;
@@ -409,6 +398,26 @@ int usb_match_one_id(struct usb_interface *interface,
409 (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) 398 (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol))
410 return 0; 399 return 0;
411 400
401 return 1;
402}
403
404/* returns 0 if no match, 1 if match */
405int usb_match_one_id(struct usb_interface *interface,
406 const struct usb_device_id *id)
407{
408 struct usb_host_interface *intf;
409 struct usb_device *dev;
410
411 /* proc_connectinfo in devio.c may call us with id == NULL. */
412 if (id == NULL)
413 return 0;
414
415 intf = interface->cur_altsetting;
416 dev = interface_to_usbdev(interface);
417
418 if (!usb_match_device(dev, id))
419 return 0;
420
412 /* The interface class, subclass, and protocol should never be 421 /* The interface class, subclass, and protocol should never be
413 * checked for a match if the device class is Vendor Specific, 422 * checked for a match if the device class is Vendor Specific,
414 * unless the match record specifies the Vendor ID. */ 423 * unless the match record specifies the Vendor ID. */
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 17830a81be14..86692a23573f 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -21,6 +21,8 @@ extern int usb_set_configuration(struct usb_device *dev, int configuration);
21 21
22extern void usb_kick_khubd(struct usb_device *dev); 22extern void usb_kick_khubd(struct usb_device *dev);
23extern void usb_resume_root_hub(struct usb_device *dev); 23extern void usb_resume_root_hub(struct usb_device *dev);
24extern int usb_match_device(struct usb_device *dev,
25 const struct usb_device_id *id);
24 26
25extern int usb_hub_init(void); 27extern int usb_hub_init(void);
26extern void usb_hub_cleanup(void); 28extern void usb_hub_cleanup(void);