[PATCH] USB: usb_set_configuration() rework (v2)
This is the latest update of the patch resolving bugs in how device configurations were reflected in the driver model. It addresses the last significant problems I know about in that area. - Moves code around so that usb_set_configuration() updates sysfs to reflect the current configuration. Previously, that only worked right for the initial configuration chosen by khubd. * Previous interfaces are inaccessible. The code to handle this moved from usb_disconnect() into usb_disable_device(), which is now called both on disconnect and set_configuration paths. * There are new interfaces. The code to handle this moved from usb_new_device() into usb_set_configuration(). * Resolves a double-refcount problem with USB interfaces, by not getting the extra reference in the first place and switching to use device_del() to disable interfaces. * Comments a similar double-refcount problem with usb devices (not interfaces). Its kerneldoc is updated appropriately. The main point being that calling usb_set_configuration() in driver probe() methods is even more of a no-no, since it'll self-deadlock. - Sysfs names for USB interfaces now include the configuation number, so that user mode code can't get as easily confused. Old style: "3-1:0" for configs 2 and 3 (interface zero). New style: "3-1:2.0" for config 2, "3-3:3.0" for config 3. - Moves usb_new_device() code around a bit, so that the device is visible in sysfs before usb_set_configuration() is called. (Before the devices for that config's interfaces appear.) - Makes the bConfigurationValue be writable through sysfs, so device configurations can be easily changed from user mode. (Or devices can be de-configured, by setting config 0.) There are devices that can benefit from this functionality; notably, cdc-acm modems need it right now, so that they can be told to use the non-proprietary configuration. (Since the old "change config in probe callback" trick won't work.)
Showing
Please register or sign in to comment