Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256946
b: refs/heads/master
c: 4ecd6e6
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed Jul 11, 2011
1 parent c275878 commit 0057595
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 697a7f3727b53c7d4c927948bbe1f6afc4fabfde
refs/heads/master: 4ecd6e651dd25ebbf0cc53c68162c0ab08641725
30 changes: 30 additions & 0 deletions trunk/drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,33 @@ static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd)
}
}

/**
* resume_needed - Check whether to resume a device before system suspend.
* @dev: Device to check.
* @genpd: PM domain the device belongs to.
*
* There are two cases in which a device that can wake up the system from sleep
* states should be resumed by pm_genpd_prepare(): (1) if the device is enabled
* to wake up the system and it has to remain active for this purpose while the
* system is in the sleep state and (2) if the device is not enabled to wake up
* the system from sleep states and it generally doesn't generate wakeup signals
* by itself (those signals are generated on its behalf by other parts of the
* system). In the latter case it may be necessary to reconfigure the device's
* wakeup settings during system suspend, because it may have been set up to
* signal remote wakeup from the system's working state as needed by runtime PM.
* Return 'true' in either of the above cases.
*/
static bool resume_needed(struct device *dev, struct generic_pm_domain *genpd)
{
bool active_wakeup;

if (!device_can_wakeup(dev))
return false;

active_wakeup = genpd->active_wakeup && genpd->active_wakeup(dev);
return device_may_wakeup(dev) ? active_wakeup : !active_wakeup;
}

/**
* pm_genpd_prepare - Start power transition of a device in a PM domain.
* @dev: Device to start the transition of.
Expand Down Expand Up @@ -515,6 +542,9 @@ static int pm_genpd_prepare(struct device *dev)
return -EBUSY;
}

if (resume_needed(dev, genpd))
pm_runtime_resume(dev);

genpd_acquire_lock(genpd);

if (genpd->prepared_count++ == 0)
Expand Down

0 comments on commit 0057595

Please sign in to comment.