All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] USB: Also check for ->match
@ 2020-07-25  9:14 Bastien Nocera
  2020-07-25  9:43 ` Sergei Shtylyov
  2020-07-25 14:51 ` Alan Stern
  0 siblings, 2 replies; 6+ messages in thread
From: Bastien Nocera @ 2020-07-25  9:14 UTC (permalink / raw)
  To: linux-usb; +Cc: Greg Kroah-Hartman, Alan Stern

We only ever used a the ID table matching before, but we should probably
also support an open-coded match function.

Fixes: 88b7381a939de ("USB: Select better matching USB drivers when available")
Signed-off-by: Bastien Nocera <hadess@hadess.net>
---
 drivers/usb/core/generic.c | 5 +++--
 1 file 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)


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-26  8:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25  9:14 [PATCH 2/3] USB: Also check for ->match Bastien Nocera
2020-07-25  9:43 ` Sergei Shtylyov
2020-07-25  9:47   ` Bastien Nocera
2020-07-25 14:51 ` Alan Stern
2020-07-25 15:14   ` Bastien Nocera
2020-07-26  8:37     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.