Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 287259
b: refs/heads/master
c: 379e0be
h: refs/heads/master
i:
  287257: 4e058a7
  287255: 1018c27
v: v3
  • Loading branch information
Srivatsa S. Bhat authored and Rafael J. Wysocki committed Feb 4, 2012
1 parent 5fe6b81 commit 592b730
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 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: fe9161db2e6053da21e4649d77bbefaf3030b11d
refs/heads/master: 379e0be812ab8a2a351e784b0c987788f5123090
24 changes: 22 additions & 2 deletions trunk/kernel/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,28 @@ extern int pm_test_level;
#ifdef CONFIG_SUSPEND_FREEZER
static inline int suspend_freeze_processes(void)
{
int error = freeze_processes();
return error ? : freeze_kernel_threads();
int error;

error = freeze_processes();

/*
* freeze_processes() automatically thaws every task if freezing
* fails. So we need not do anything extra upon error.
*/
if (error)
goto Finish;

error = freeze_kernel_threads();

/*
* freeze_kernel_threads() thaws only kernel threads upon freezing
* failure. So we have to thaw the userspace tasks ourselves.
*/
if (error)
thaw_processes();

Finish:
return error;
}

static inline void suspend_thaw_processes(void)
Expand Down
7 changes: 5 additions & 2 deletions trunk/kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ int freeze_processes(void)
/**
* freeze_kernel_threads - Make freezable kernel threads go to the refrigerator.
*
* On success, returns 0. On failure, -errno and system is fully thawed.
* On success, returns 0. On failure, -errno and only the kernel threads are
* thawed, so as to give a chance to the caller to do additional cleanups
* (if any) before thawing the userspace tasks. So, it is the responsibility
* of the caller to thaw the userspace tasks, when the time is right.
*/
int freeze_kernel_threads(void)
{
Expand All @@ -159,7 +162,7 @@ int freeze_kernel_threads(void)
BUG_ON(in_atomic());

if (error)
thaw_processes();
thaw_kernel_threads();
return error;
}

Expand Down

0 comments on commit 592b730

Please sign in to comment.