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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, 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.

Alan Stern

_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux