linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 1/3] USB: Also match device drivers using the ->match vfunc
@ 2020-08-18 11:04 Bastien Nocera
  2020-08-18 11:04 ` [PATCH v8 2/3] USB: Better name for __check_usb_generic() Bastien Nocera
  2020-08-18 11:04 ` [PATCH v8 3/3] USB: Fix device driver race Bastien Nocera
  0 siblings, 2 replies; 8+ messages in thread
From: Bastien Nocera @ 2020-08-18 11:04 UTC (permalink / raw)
  To: linux-usb; +Cc: Greg Kroah-Hartman, Alan Stern, Bastien Nocera

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>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes since v7:
- Reword commit subject

Changes since v2:
- Added Alan's ack

Changes since v1:
- Fixed typo in commit message


 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)
-- 
2.26.2


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

end of thread, other threads:[~2020-08-19  5:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-18 11:04 [PATCH v8 1/3] USB: Also match device drivers using the ->match vfunc Bastien Nocera
2020-08-18 11:04 ` [PATCH v8 2/3] USB: Better name for __check_usb_generic() Bastien Nocera
2020-08-18 11:04 ` [PATCH v8 3/3] USB: Fix device driver race Bastien Nocera
2020-08-18 17:06   ` Sergei Shtylyov
2020-08-18 17:25     ` Greg Kroah-Hartman
2020-08-18 17:29     ` Alan Stern
2020-08-18 20:49       ` Sergei Shtylyov
2020-08-19  5:55         ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).