diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-07-19 14:39:13 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-14 17:44:22 +0400 |
commit | a85e474e00d762b1a20d912c003daa64c42cc74e (patch) | |
tree | 081a8311f6ee82be98aae898a1eff5ee716f75a4 /drivers/usb/core/driver.c | |
parent | 96ff7eff36f9f756726dbde657b020cd4469de8d (diff) | |
download | linux-a85e474e00d762b1a20d912c003daa64c42cc74e.tar.xz |
usb: Add quirk detection based on interface information
commit 80da2e0df5af700518611b7d1cc4fc9945bcaf95 upstream.
When a whole class of devices (possibly from a specific vendor, or
across multiple vendors) require a quirk, explictly listing all devices
in the class make the quirks table unnecessarily large. Fix this by
allowing matching devices based on interface information.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/driver.c')
-rw-r--r-- | drivers/usb/core/driver.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 9a56635dc19c..4c96c6f3f324 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -530,22 +530,10 @@ int usb_match_device(struct usb_device *dev, const struct usb_device_id *id) } /* returns 0 if no match, 1 if match */ -int usb_match_one_id(struct usb_interface *interface, - const struct usb_device_id *id) +int usb_match_one_id_intf(struct usb_device *dev, + struct usb_host_interface *intf, + const struct usb_device_id *id) { - struct usb_host_interface *intf; - struct usb_device *dev; - - /* proc_connectinfo in devio.c may call us with id == NULL. */ - if (id == NULL) - return 0; - - intf = interface->cur_altsetting; - dev = interface_to_usbdev(interface); - - if (!usb_match_device(dev, id)) - return 0; - /* The interface class, subclass, and protocol should never be * checked for a match if the device class is Vendor Specific, * unless the match record specifies the Vendor ID. */ @@ -570,6 +558,26 @@ int usb_match_one_id(struct usb_interface *interface, return 1; } + +/* returns 0 if no match, 1 if match */ +int usb_match_one_id(struct usb_interface *interface, + const struct usb_device_id *id) +{ + struct usb_host_interface *intf; + struct usb_device *dev; + + /* proc_connectinfo in devio.c may call us with id == NULL. */ + if (id == NULL) + return 0; + + intf = interface->cur_altsetting; + dev = interface_to_usbdev(interface); + + if (!usb_match_device(dev, id)) + return 0; + + return usb_match_one_id_intf(dev, intf, id); +} EXPORT_SYMBOL_GPL(usb_match_one_id); /** |