linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sergei Shtylyov <sergei.shtylyov@gmail.com>
Cc: Bastien Nocera <hadess@hadess.net>,
	linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [PATCH v8 3/3] USB: Fix device driver race
Date: Tue, 18 Aug 2020 19:25:04 +0200	[thread overview]
Message-ID: <20200818172504.GA746411@kroah.com> (raw)
In-Reply-To: <fdfc0146-5b7f-1805-3c35-68c662b2651d@gmail.com>

On Tue, Aug 18, 2020 at 08:06:20PM +0300, Sergei Shtylyov wrote:
> On 8/18/20 2:04 PM, Bastien Nocera wrote:
> 
> > When a new device with a specialised device driver is plugged in, the
> > new driver will be modprobe()'d but the driver core will attach the
> > "generic" driver to the device.
> > 
> > After that, nothing will trigger a reprobe when the modprobe()'d device
> > driver has finished initialising, as the device has the "generic"
> > driver attached to it.
> > 
> > Trigger a reprobe ourselves when new specialised drivers get registered.
> > 
> > Fixes: 88b7381a939d ("USB: Select better matching USB drivers when available")
> > Signed-off-by: Bastien Nocera <hadess@hadess.net>
> [...]
> >  drivers/usb/core/driver.c | 40 +++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 38 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
> > index f81606c6a35b..7e73e989645b 100644
> > --- a/drivers/usb/core/driver.c
> > +++ b/drivers/usb/core/driver.c
> [...]
> > @@ -934,13 +963,20 @@ int usb_register_device_driver(struct usb_device_driver *new_udriver,
> >  
> >  	retval = driver_register(&new_udriver->drvwrap.driver);
> >  
> > -	if (!retval)
> > +	if (!retval) {
> >  		pr_info("%s: registered new device driver %s\n",
> >  			usbcore_name, new_udriver->name);
> > -	else
> > +		/*
> > +		 * Check whether any device could be better served with
> > +		 * this new driver
> > +		 */
> > +		bus_for_each_dev(&usb_bus_type, NULL, new_udriver,
> > +				 __usb_bus_reprobe_drivers);
> > +	} else {
> >  		printk(KERN_ERR "%s: error %d registering device "
> >  			"	driver %s\n",
> 
>    Unrelated but... hm, this string literal seems weird. GregKH, would it be OK if we fix it?

Please do.

  reply	other threads:[~2020-08-18 17:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-08-18 17:29     ` Alan Stern
2020-08-18 20:49       ` Sergei Shtylyov
2020-08-19  5:55         ` 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=20200818172504.GA746411@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=hadess@hadess.net \
    --cc=linux-usb@vger.kernel.org \
    --cc=sergei.shtylyov@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /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;
as well as URLs for NNTP newsgroup(s).