On Tue, 21 Feb 2012, Sarah Sharp wrote: > Given that I shouldn't enable the timeouts if a driver sets the > disable_hub_initiated_lpm flag, I need to make sure the timeouts (and > probably device-initiated LPM as well) are disabled before we bind any > new drivers. The timeouts also need to be evaluated when a driver > unbinds. > > It seems like there are several places where I should disable LPM, let > some change occur, and then re-evaluate what the U1/U2 timeouts should > be. Some of those places I've identified are: This depends on what your criteria are going to be. For example, with communications class devices, you might want to leave the timeouts permanently disabled. > - usb_disable_device Why? This routine gets called only when the config is changed or the device is unplugged. > - usb_set_interface Only if you use a criterion based on the enabled endpoints. > - usb_set_configuration Okay, maybe -- see below. > - usb_reset_configuration This is like usb_set_interface; all it does is possibly change the set of enabled endpoints. > - usb_reset_device I suppose you might want to disable the timeouts during the reset and re-enable them afterward. It probably doesn't matter. > - where ever a new driver is bound > > Is there any function I'm missing? I also don't know exactly where to > handle checking the timeouts when a new driver binds. There's a note > at the end of usb_set_configuration that adding each device interface > causes the driver to be bound, and I could evaluate the timeouts there, > but I'm not sure where I need to handle drivers that are loaded some > time later after the interface is installed (say through a user running > modprobe for a blacklisted module). New drivers are bound in usb_probe_interface. There's also usb_driver_claim_interface, but with the exception of usbfs, it gets called only by drivers that are already bound to another interface on the same device. But of course, now you face the problem of what to do when usb_set_configuration changes a whole bunch of bindings at once. The easiest answer is to disable/enable the timeouts around each new binding. Then you wouldn't need to touch usb_set_configuration. Alan Stern -- 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