[PATCH] USB: usb driver binding fixes
There are problems lurking in the driver binding code for usb, with highlights being disagreements about: (a) locks: usb bus writelock v. BKL v. driver->serialize (b) driver: interface.driver v. interface.dev.driver Fixing those is going to take multiple patches, and I thought I'd start out with a small one that's relatively simple. This: - Cleans up locking. * Updates comments and kerneldoc to reflect that the usb bus writelock is what protects against conflicts when binding/unbinding drivers to devices. * Removes driver->serialize ... not needed, since it's only gotten when the bus writelock is held. * Removes incorrect "must have BKL" comments, and one bit of code that tried to use BKL not the writelock. - Removes inconsistencies about what driver is bound to the interface ... for now "interface.driver" is "the truth". * usb_probe_interface() will no longer clobber bindings established with usb_driver_claim_interface(). * usb_driver_release_interface() calls device_release_driver() for bindings established with probe(), so the driver model updates (sysfs etc) are done as expected. * usb_unbind_interface() doesn't usb_driver_release_interface(), since release() should eventually _always_ call unbind() (indirectly through device_release_driver). Essentially there are two driver binding models in USB today, and this patch makes them start to cooperate properly: - probe()/disconnect(), used by most drivers. This goes through the driver model core. - claim()/release(), used by CDC drivers (ACM, Ethernet) and audio to claim extra interfaces and by usbfs since it can't come in through probe(). Bypasses driver model. That interface.driver pointer can be removed by changing the claim()/release() code to use the driver model calls added for that purpose: device_{bind,release}_driver(). I didn't do that in this patch, since it'll have side effects like extra disconnect() calls that drivers will need to handle. A separate usbfs patch is needed to fix its driver binding; mostly just to use the right lock, but those changes were more extensive and uncovered other issues. (Like, I think, some that Duncan has been noticing ...)
Showing
Please register or sign in to comment