lkml.org 
[lkml]   [2011]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [linux-pm] [PATCH 3/5] PM: Support for system-wide power transitions in generic power domains
Date
On Monday, May 09, 2011, Alan Stern wrote:
> On Sun, 8 May 2011, Rafael J. Wysocki wrote:
>
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> >
> > Make generic power domains support system-wide power transitions
> > (system suspend and hibernation). Add suspend, resume, freeze and
> > thaw callbacks to be associated with struct generic_power_domain
> > objects and make pm_genpd_init() use them as appropriate.
>
> ...
>
> > Index: linux-2.6/drivers/base/power/domain.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/base/power/domain.c
> > +++ linux-2.6/drivers/base/power/domain.c
> > @@ -273,6 +273,280 @@ static int pm_genpd_runtime_resume(struc
> >
> > #endif /* CONFIG_PM_RUNTIME */
> >
> > +#ifdef CONFIG_PM_SLEEP
> > +
> > +/**
> > + * pm_genpd_powered_down - Check if power has been removed from a power domain.
> > + * @genpd: Power domain to check.
> > + */
> > +static bool pm_genpd_powered_down(struct generic_power_domain *genpd)
> > +{
> > + bool ret;
> > +
> > + mutex_lock(&genpd->lock);
> > + ret = genpd->power_is_off;
> > + mutex_unlock(&genpd->lock);
> > +
> > + return ret;
> > +}
>
> What is the purpose of the mutex? On the face of it, there's nothing
> to prevent another thread from changing the domain's power state in
> between the mutex_unlock() call and the return statement.

Now, that I think of it, the mutex isn't really necessary.

genpd->power_is_off is only changed by the runtime PM code that will
never be called during system suspend if genpd->power_is_off is set
already.

I'm going to post an update shortly, I'll include a fix for that in it.

Thanks,
Rafael


\
 
 \ /
  Last update: 2011-05-09 21:23    [W:0.086 / U:17.332 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site