summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-10-22 22:47:32 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-10-22 22:47:32 +0200
commit71be2114a5474a76edad95343d89b8731457fccd (patch)
tree7b8f80accc9354f39fabd5e63fd6194e808a4906 /kernel
parentPM: convert do_each_thread to for_each_process_thread (diff)
downloadlinux-71be2114a5474a76edad95343d89b8731457fccd.tar.xz
linux-71be2114a5474a76edad95343d89b8731457fccd.zip
PM / freezer: Clean up code after recent fixes
Clean up the code in process.c after recent changes to get rid of unnecessary labels and goto statements. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/process.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 7f0d4343af1b..5a6ec8678b9a 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -108,25 +108,27 @@ static int try_to_freeze_tasks(bool user_only)
return todo ? -EBUSY : 0;
}
+static bool __check_frozen_processes(void)
+{
+ struct task_struct *g, *p;
+
+ for_each_process_thread(g, p)
+ if (p != current && !freezer_should_skip(p) && !frozen(p))
+ return false;
+
+ return true;
+}
+
/*
* Returns true if all freezable tasks (except for current) are frozen already
*/
static bool check_frozen_processes(void)
{
- struct task_struct *g, *p;
- bool ret = true;
+ bool ret;
read_lock(&tasklist_lock);
- for_each_process_thread(g, p) {
- if (p != current && !freezer_should_skip(p) &&
- !frozen(p)) {
- ret = false;
- goto done;
- }
- }
-done:
+ ret = __check_frozen_processes();
read_unlock(&tasklist_lock);
-
return ret;
}
@@ -167,15 +169,14 @@ int freeze_processes(void)
* on the way out so we have to double check for race.
*/
if (oom_kills_count() != oom_kills_saved &&
- !check_frozen_processes()) {
+ !check_frozen_processes()) {
__usermodehelper_set_disable_depth(UMH_ENABLED);
printk("OOM in progress.");
error = -EBUSY;
- goto done;
+ } else {
+ printk("done.");
}
- printk("done.");
}
-done:
printk("\n");
BUG_ON(in_atomic());