summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/driver.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2019-10-16 11:39:30 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-12 11:01:55 -0800
commitaeebf2b5466506546c47ca68477d4aa8a96377a6 (patch)
tree83b03ebf1895240b526c3416468e21b4685cdde3 /drivers/usb/core/driver.c
parentc9d503370f240934f3c1c5da4c6c2452a7d05db2 (diff)
downloadlinux-stable-aeebf2b5466506546c47ca68477d4aa8a96377a6.tar.gz
linux-stable-aeebf2b5466506546c47ca68477d4aa8a96377a6.tar.bz2
linux-stable-aeebf2b5466506546c47ca68477d4aa8a96377a6.zip
USB: Implement usb_device_match_id()
Match a usb_device with a table of IDs. Signed-off-by: Bastien Nocera <hadess@hadess.net> Acked-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20191016093933.693-4-hadess@hadess.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/driver.c')
-rw-r--r--drivers/usb/core/driver.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index d3787d084937..697898327b44 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -800,6 +800,20 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
}
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)
{
/* devices and interfaces are handled separately */