On Fri, 15 Apr 2011, Alan Stern wrote: > On Fri, 15 Apr 2011, Guennadi Liakhovetski wrote: > > > Restore the initial RPM_SUSPENDED runtime pm status, when disabling, > > otherwise the following enable will not function. This happens, e.g., > > when unloading and reloading drivers. > > > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx> > > Cc: Simon Horman <horms@xxxxxxxxxxxx> > > Cc: Magnus Damm <damm@xxxxxxxxxxxxx> > > --- > > > > No, I do not claim to understand the thousand of states, flags, and > > counters, this just happens to fix the problem for me. Feel free to make a > > correct solution out of this. > > > > drivers/base/power/runtime.c | 4 +++- > > 1 files changed, 3 insertions(+), 1 deletions(-) > > > > diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c > > index 3172c60..83d6898 100644 > > --- a/drivers/base/power/runtime.c > > +++ b/drivers/base/power/runtime.c > > @@ -1012,8 +1012,10 @@ void __pm_runtime_disable(struct device *dev, bool check_resume) > > pm_runtime_put_noidle(dev); > > } > > > > - if (!dev->power.disable_depth++) > > + if (!dev->power.disable_depth++) { > > __pm_runtime_barrier(dev); > > + dev->power.runtime_status = RPM_SUSPENDED; > > + } > > > > out: > > spin_unlock_irq(&dev->power.lock); > > This certainly doesn't look right. Can you explain in more detail the > problem you are trying to solve? Yes, I can. On the first loading of an MMC driver, which does the standard pm_runtime_enable(&pdev->dev); ret = pm_runtime_resume(&pdev->dev); in .probe() and pm_runtime_disable(&pdev->dev); in .release() (see [1]), with an inserted card, on the first modprobe I see a full pm-runtime run down to platform_pm_runtime_resume() and to platform_pm_runtime_suspend() on rmmod. On a repeated modprobe platform_pm_runtime_resume() does not get called, because dev->power.runtime_status != RPM_SUSPENDED, instead, it is still RPM_ACTIVE, so, rpm_resume() exits prematurily. [1] http://thread.gmane.org/gmane.linux.kernel.mmc/7364 Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm