Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 253955
b: refs/heads/master
c: 6d0e0e8
h: refs/heads/master
i:
  253953: 2ec1144
  253951: 4e3be88
v: v3
  • Loading branch information
Alan Stern authored and Rafael J. Wysocki committed Jun 21, 2011
1 parent ada4ed4 commit 706ac05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 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: 8440f4b19494467883f8541b7aa28c7bbf6ac92b
refs/heads/master: 6d0e0e84f66d32c33511984dd3badd32364b863c
14 changes: 12 additions & 2 deletions trunk/drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static int async_error;
void device_pm_init(struct device *dev)
{
dev->power.is_prepared = false;
dev->power.is_suspended = false;
init_completion(&dev->power.completion);
complete_all(&dev->power.completion);
dev->power.wakeup = NULL;
Expand Down Expand Up @@ -517,6 +518,9 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
*/
dev->power.is_prepared = false;

if (!dev->power.is_suspended)
goto Unlock;

if (dev->pwr_domain) {
pm_dev_dbg(dev, state, "power domain ");
error = pm_op(dev, &dev->pwr_domain->ops, state);
Expand Down Expand Up @@ -552,6 +556,9 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
}

End:
dev->power.is_suspended = false;

Unlock:
device_unlock(dev);
complete_all(&dev->power.completion);

Expand Down Expand Up @@ -839,11 +846,11 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
device_lock(dev);

if (async_error)
goto End;
goto Unlock;

if (pm_wakeup_pending()) {
async_error = -EBUSY;
goto End;
goto Unlock;
}

if (dev->pwr_domain) {
Expand Down Expand Up @@ -881,6 +888,9 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
}

End:
dev->power.is_suspended = !error;

Unlock:
device_unlock(dev);
complete_all(&dev->power.completion);

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ struct dev_pm_info {
unsigned int can_wakeup:1;
unsigned int async_suspend:1;
bool is_prepared:1; /* Owned by the PM core */
bool is_suspended:1; /* Ditto */
spinlock_t lock;
#ifdef CONFIG_PM_SLEEP
struct list_head entry;
Expand Down

0 comments on commit 706ac05

Please sign in to comment.