Re: [linux-pm] Re: The evilness of struct usb_device->auto_pm

"Rafael J. Wysocki" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Friday, 28 September 2007 16:33, Alan Stern wrote:
> On Fri, 28 Sep 2007, Oliver Neukum wrote:
> 
> > > > > What exactly would you like to do?
> > > > 
> > > > Put the stuff into struct device and move the autosuspend code into
> > > > driver core.
> 
> Moving some of the data fields might be acceptable.  Moving the code is 
> premature at best.  You must always bear in mind that the autosuspend 
> model used by USB is not suitable for every type of device.  Each 
> subsystem needs to implement its own form of runtime PM; the core 
> should contain only the lowest-denominator common parts.

Well, that's what I've been always thinking.

> > > Well, I thought that it would be nicer if drivers handled autosuspend in a
> > > transparent (from the point of view of the core) way.
> > 
> > That is possible only for drivers which are leaves in the device tree.
> 
> Not true.  For example, the USB hub driver handles autosuspend 
> perfectly well.  The main issue is what to do when the autosuspend 
> notifications need to cross a subsystem boundary.
> 
> > > Now, it seems to follow from what you're saying that this is not possible in
> > > general, because of USB mass storage devices that need some special handling.
> > 
> > No, they need the ordinary handling. All a device's children must be suspended
> > if a device is suspended.
> > 
> > > I'm not familiar with the USB code, so can you please tell me how the USB
> > > autosuspend is handled at present and what exactly the problem with that is?
> > 
> > The drivers for interfaces manage a count. If all a device's interfaces' count
> > goes to zero, the device is suspended. The drivers are notified through the
> > normal suspend() method. But children of these devices are not notified.
> 
> That's because the notifications go up the device tree, not down.  When 
> a child is suspended, the parent is notified.  Then if the driver sees 
> that all the children are suspended, the parent can be suspended as 
> well.
> 
> Oliver has been trying to subvert this model by making usb-storage 
> responsible for suspending the SCSI disk and CD/DVD drivers, which are 
> located beneath it in the device tree.  I've been trying to convince 
> him that the proper way to handle things is to let the SCSI drivers 
> decide for themselves when their devices can be suspended, and then 
> have them inform usb-storage.

Yes, I think that the SCSI layer should decide.

I guess that the SCSI layer is not really autosuspend-aware, is it?

Greetings,
Rafael

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.