Re: [RFC PATCH] PM / Runtime: Allow to inactivate devices during system suspend

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

 



On Thu, 14 Nov 2013, Ulf Hansson wrote:

> > If you want a driver to do the same thing for runtime PM and system
> > suspend/resume, point its .suspend_late() and .runtime_suspend() to the
> > same routine and analogously for .runtime_resume() and .resume_early()
> > (that may not work for PCI, though, because of the _noirq stuff, but that's
> > the PCI bus type issue).
> 
> When your .suspend_late callback gets called, your device may be
> either active or inactive from runtime PM point of view. Just pointing
> the .suspend_late callback to the .runtime_suspend callback, simply
> wont work.
> 
> That would mean we might end up in trying to inactivate an already
> inactivated device, which I doubt is a good thing.:-) Some additional
> code will be needed to track the "runtime state" and to act
> accordingly. This is what drivers already tries to handle as of today,
> though so far mostly from their .suspend callbacks I believe.

You could write a "generic" suspend_late routine that would invoke the 
driver's runtime_suspend routine if the device's runtime PM status was 
RPM_ACTIVE.

> > Of course, the assumption behind .runtime_suspend() and .runtime_resume() is
> > that they will be run when the device is not in use, while system suspend
> > may actually happen when the device *is* in use and .suspend() should take
> > care of that if necessary.  So you may need .suspend() anyway.
> >
> > One important property of system suspend is that it can happen at any time
> > and that's why the .suspend() and .resume() callbacks are needed (and this
> > also means that they can't be the same as .runtime_suspend() and
> > .runtime_resume() in general).
> 
> I see your point and in most cases you are right. But, I am also sure
> that quite many drivers should be able to cope with only runtime PM
> callbacks. I have collected a bunch of examples that I can share, if
> you are interested?

All those drivers should be able to utilize this "generic" suspend_late 
routine.

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux