On Thu, 2 Dec 2004, David Brownell wrote: > On Thursday 02 December 2004 9:22 am, Alan Stern wrote: > > Below is a composite of three patches pending for the usb-storage driver. > > Together they provide support for autosuspend. The inactivity timeout is > > controlled by a module parameter named "autosuspend"; its value gives the > > timeout in seconds (0 means no autosuspend). > > Cool! I'll have to take a look soon. (And at the hub autosuspend > patch too...) It's bigger than I'd have expected. Care to sketch > what those three patches do?
It's a little bigger than it needs to be, because I took the opportunity to reorder the #include lines in bunch of source files. Ignoring that aspect, the important changes only affect a few files: usb.h, usb.c, and scsiglue.c. Here's what the three patches do: 1: Allocate the usb-storage private data structure at the end of the SCSI host structure (exactly the same sort of thing as I did with the hcds!). This brings an additional advantage since the host structure is reference-counted and hence the private structure can now reap that benefit. 2: Allow the control thread to persist after disconnect() returns. The private structure needs refcounting for this to work; otherwise it might disappear while the control thread was still trying to use it. Note that there's nothing wrong with allowing the thread to live on after disconnection, so long as it doesn't try to access the device -- the only requirement is that the thread must exit before the module is unloaded. 3: Implement autosuspend and autoresume. These need the persistent control thread, because the thread is what calls usb_suspend_device and usb_resume_device. If disconnect() had to wait for the thread to exit, we would get deadlock if the thread was waiting to lock the device for a suspend. Alan Stern ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel