Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 291884
b: refs/heads/master
c: 65533bb
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed Mar 16, 2012
1 parent 6649ba5 commit f115911
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc85b20780562d404e18a47b9b55b4a5102ae53e
refs/heads/master: 65533bbf63b4f37723fdfedc73d0653958973323
31 changes: 21 additions & 10 deletions trunk/drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,10 @@ static int pm_genpd_prepare(struct device *dev)

genpd_acquire_lock(genpd);

if (genpd->prepared_count++ == 0)
if (genpd->prepared_count++ == 0) {
genpd->suspended_count = 0;
genpd->suspend_power_off = genpd->status == GPD_STATE_POWER_OFF;
}

genpd_release_lock(genpd);

Expand Down Expand Up @@ -1097,20 +1099,30 @@ static int pm_genpd_restore_noirq(struct device *dev)
* Since all of the "noirq" callbacks are executed sequentially, it is
* guaranteed that this function will never run twice in parallel for
* the same PM domain, so it is not necessary to use locking here.
*
* At this point suspended_count == 0 means we are being run for the
* first time for the given domain in the present cycle.
*/
genpd->status = GPD_STATE_POWER_OFF;
if (genpd->suspend_power_off) {
if (genpd->suspended_count++ == 0) {
/*
* The boot kernel might put the domain into the power on state,
* so make sure it really is powered off.
* The boot kernel might put the domain into arbitrary state,
* so make it appear as powered off to pm_genpd_poweron(), so
* that it tries to power it on in case it was really off.
*/
if (genpd->power_off)
genpd->power_off(genpd);
return 0;
genpd->status = GPD_STATE_POWER_OFF;
if (genpd->suspend_power_off) {
/*
* If the domain was off before the hibernation, make
* sure it will be off going forward.
*/
if (genpd->power_off)
genpd->power_off(genpd);

return 0;
}
}

pm_genpd_poweron(genpd);
genpd->suspended_count--;

return genpd_start_dev(genpd, dev);
}
Expand Down Expand Up @@ -1649,7 +1661,6 @@ void pm_genpd_init(struct generic_pm_domain *genpd,
genpd->poweroff_task = NULL;
genpd->resume_count = 0;
genpd->device_count = 0;
genpd->suspended_count = 0;
genpd->max_off_time_ns = -1;
genpd->domain.ops.runtime_suspend = pm_genpd_runtime_suspend;
genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume;
Expand Down

0 comments on commit f115911

Please sign in to comment.