From: Alan Stern <stern@rowland.harvard.edu>
To: Bastien Nocera <hadess@hadess.net>
Cc: linux-usb@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 2/3] USB: Also check for ->match
Date: Sat, 25 Jul 2020 10:51:43 -0400 [thread overview]
Message-ID: <20200725145143.GB1421097@rowland.harvard.edu> (raw)
In-Reply-To: <25f9d978b791d25583b18f4b5d0a929e031fec1f.camel@hadess.net>
On Sat, Jul 25, 2020 at 11:14:07AM +0200, Bastien Nocera wrote:
> 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)
Acked-by: Alan Stern <stern@rowland.harvard.edu>
You know, at some point it would be nice to change the name of this
function. __check_usb_generic doesn't explain very well what the
function actually does: It checks to see whether the driver is
non-generic and matches the device. Something like
check_for_non_generic_match would be a lot better.
Alan Stern
next prev parent reply other threads:[~2020-07-25 14:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2020-07-25 15:14 ` Bastien Nocera
2020-07-26 8:37 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200725145143.GB1421097@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=gregkh@linuxfoundation.org \
--cc=hadess@hadess.net \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox