lkml.org 
[lkml]   [2013]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 0/5] PM: Enable option of re-use runtime PM callbacks at system suspend
Date
On Friday, November 29, 2013 02:52:20 PM Rafael J. Wysocki wrote:
> On Friday, November 29, 2013 10:32:06 AM Ulf Hansson wrote:

[...]

> > For the same reasons, I believe we should trust drivers/subsystems, to
> > understand when it makes sense for them to re-use all of the runtime
> > PM callbacks during system suspend and not just the .runtime_suspend
> > callback.
> >
> > That is in principle what I and Alan, who came up with this idea, are
> > suggesting.
>
> The problem with it is, as I said, the subsystem-level code you're calling
> back through pm_generic_suspend_late_runtime() (and the other resume function)
> has to be implemented in a specific way for things to work. So it goes like
> this: "OK, now I'm not runtime-suspended, so I need to do something about that.
> Why don't I call back to the layer above me that has just called me (and that
> surely won't do anything after I return, right?), so that it does the right
> thing (which it surely will do, of course?) and calls my runtime PM callback
> as expected".
>
> And now suppose that your subsystem-level callbacks look like this (pseudo code):
>
> a_suspend_late(dev)
> {
> if (successful(pm_generic_suspend_late(dev)))
> do_X(dev);
> }
>
> a_runtime_suspend(dev)
> {
> if (successful(pm_generic_runtime_suspend(dev)))
> do_Y(dev);
> }
>
> Then, if the driver uses your pm_generic_suspend_late_runtime(), the actually
> executed code will be (assuming dev is not runtime-suspended):
>
> a_suspend_late(dev)
> driver->suspend_late(dev)
> a_runtime_suspend(dev)
> driver->runtime_suspend(dev)
> do_Y(dev)
> do_X(dev)
>
> So what if do_X(dev) after do_Y(dev) doesn't actually work?
>
> And what you actually want is
>
> driver->runtime_suspend(dev)
> do_Y(dev)

That should have been

driver->runtime_suspend(dev)
do_X(dev)

because do_Y(dev) is for runtime suspend. Sorry.

And of course, the subsystem-level code you're developing the driver for may not
do the do_X(dev) thing at all, in which case all will work. But what if someone
tries to use the driver with a different subsystem-level code (like a new PM
domain)?

Rafael



\
 
 \ /
  Last update: 2013-11-29 15:01    [W:0.078 / U:1.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site