Commit aeebf2b5 authored by Bastien Nocera's avatar Bastien Nocera Committed by Greg Kroah-Hartman

USB: Implement usb_device_match_id()

Match a usb_device with a table of IDs.
Signed-off-by: default avatarBastien Nocera <hadess@hadess.net>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20191016093933.693-4-hadess@hadess.netSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c9d50337
...@@ -800,6 +800,20 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface, ...@@ -800,6 +800,20 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
} }
EXPORT_SYMBOL_GPL(usb_match_id); EXPORT_SYMBOL_GPL(usb_match_id);
const struct usb_device_id *usb_device_match_id(struct usb_device *udev,
const struct usb_device_id *id)
{
if (!id)
return NULL;
for (; id->idVendor || id->idProduct ; id++) {
if (usb_match_device(udev, id))
return id;
}
return NULL;
}
static int usb_device_match(struct device *dev, struct device_driver *drv) static int usb_device_match(struct device *dev, struct device_driver *drv)
{ {
/* devices and interfaces are handled separately */ /* devices and interfaces are handled separately */
......
...@@ -69,6 +69,8 @@ extern int usb_match_one_id_intf(struct usb_device *dev, ...@@ -69,6 +69,8 @@ extern int usb_match_one_id_intf(struct usb_device *dev,
const struct usb_device_id *id); const struct usb_device_id *id);
extern int usb_match_device(struct usb_device *dev, extern int usb_match_device(struct usb_device *dev,
const struct usb_device_id *id); const struct usb_device_id *id);
extern const struct usb_device_id *usb_device_match_id(struct usb_device *udev,
const struct usb_device_id *id);
extern void usb_forced_unbind_intf(struct usb_interface *intf); extern void usb_forced_unbind_intf(struct usb_interface *intf);
extern void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev); extern void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment