diff options
author | Bastien Nocera <hadess@hadess.net> | 2020-08-18 13:04:43 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-08-18 13:08:45 +0200 |
commit | adb6e6ac20eedcf1dce19dc75b224e63c0828ea1 (patch) | |
tree | 8c753fba2583f0eb5721f8cdb08e9232ace57535 /drivers/usb/core | |
parent | d54343a87732726b04ac5af873916b5ed4f52932 (diff) |
USB: Also match device drivers using the ->match vfunc
We only ever used the ID table matching before, but we should also support
open-coded match functions.
Fixes: 88b7381a939de ("USB: Select better matching USB drivers when available")
Signed-off-by: Bastien Nocera <hadess@hadess.net>
Cc: stable <stable@vger.kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20200818110445.509668-1-hadess@hadess.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/generic.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index b6f2d4b44754..2b2f1ab6e36a 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c @@ -205,8 +205,9 @@ static int __check_usb_generic(struct device_driver *drv, void *data) udrv = to_usb_device_driver(drv); if (udrv == &usb_generic_driver) return 0; - - return usb_device_match_id(udev, udrv->id_table) != NULL; + if (usb_device_match_id(udev, udrv->id_table) != NULL) + return 1; + return (udrv->match && udrv->match(udev)); } static bool usb_generic_driver_match(struct usb_device *udev) |