mirror of https://gitee.com/openkylin/linux.git
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: 88b7381a93
("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>
This commit is contained in:
parent
d54343a877
commit
adb6e6ac20
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue