Re: [PATCH 0/9] usb-serial: new driver-registration API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 24, 2012 at 05:25:42PM -0500, Alan Stern wrote:
> On Fri, 24 Feb 2012, Greg KH wrote:
> 
> > On Thu, Feb 23, 2012 at 02:55:34PM -0500, Alan Stern wrote:
> > > Greg:
> > > 
> > > This series of patches adds a new, simpler API to the usb-serial core
> > > for registering drivers, and changes all the existing drivers to use
> > > it.  Instead of making separate calls to register the usb_driver and
> > > one or more usb_serial drivers, everything can be done with a single
> > > function call.  Likewise for deregistration.
> > > 
> > > In addition, the order of registration is changed; the new routine will
> > > register the usb_driver first.  Currently each of the serial drivers
> > > registers its usb_driver last, which leaves a window for a bug: If a
> > > new dynamic-ID is added to the usb_serial driver before its usb_driver
> > > is registered (say by a udev script), it causes an oops.
> > > 
> > > This doesn't seem to be a very serious problem; so far there has been
> > > only one complaint about it.  For that reason, and because this is a
> > > somewhat lengthy set of changes, I'm not going to submit it for the
> > > stable kernels.
> > > 
> > > I have been able to test this only with the pl2303 driver.  All the 
> > > other drivers are merely compile-tested.
> > 
> > I'm trying to remember why the ordering was set up this way, there was a
> > good reason (good enough that we had to fix drivers that were doing it
> > backwards.)  But I can't remember it at the moment.
> 
> It has to do with binding of pre-existing devices.  If you don't take
> proper care when first registering the usb_driver, the core will try to
> bind that driver to all the pre-existing serial devices it matches.  
> But the bindings will fail, because usb-serial won't be able to find
> the appropriate usb_serial drivers.  As a result, the devices won't get
> bound at all.

Ah, yeah, that was it, thanks for figuring it out.

> > Worse case, we have to switch it back, or fix it up somehow differently,
> > this patch series will make it easier to do so in the future, so I'll go
> > queue it up.  Thanks for doing this work, it's much appreciated.
> 
> You're welcome.  Overall, it removes a lot of lines of duplicated code 
> from the source tree.

I think I can now create a module_usb_serial_driver() macro to clean
things up even more, now that we have reduced the init/exit module
functions to a single function call.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux