Skip to content

Commit

Permalink
USB: Also match device drivers using the ->match vfunc
Browse files Browse the repository at this point in the history
We only ever used the ID table matching before, but we should also support
open-coded match functions.

Fixes: 88b7381 ("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>
  • Loading branch information
Bastien Nocera authored and Greg Kroah-Hartman committed Aug 18, 2020
1 parent d54343a commit adb6e6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/usb/core/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit adb6e6a

Please sign in to comment.