aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/process.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-03-28 17:30:21 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-03-28 17:30:21 -0400
commit1e73203cd1157a03facc41ffb54050f5b28e55bd (patch)
tree12781ea69aa706291949bb1a10141a8a043e09d9 /kernel/power/process.c
parent7b5179ac14dbad945647ac9e76bbbf14ed9e0dbe (diff)
PM / Sleep: Move disabling of usermode helpers to the freezer
The core suspend/hibernation code calls usermodehelper_disable() to avoid race conditions between the freezer and the starting of usermode helpers and each code path has to do that on its own. However, it is always called right before freeze_processes() and usermodehelper_enable() is always called right after thaw_processes(). For this reason, to avoid code duplication and to make the connection between usermodehelper_disable() and the freezer more visible, make freeze_processes() call it and remove the direct usermodehelper_disable() and usermodehelper_enable() calls from all suspend/hibernation code paths. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'kernel/power/process.c')
-rw-r--r--kernel/power/process.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 0d2aeb226108..56eaac7e88ab 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -16,6 +16,7 @@
16#include <linux/freezer.h> 16#include <linux/freezer.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19#include <linux/kmod.h>
19 20
20/* 21/*
21 * Timeout for stopping processes 22 * Timeout for stopping processes
@@ -122,6 +123,10 @@ int freeze_processes(void)
122{ 123{
123 int error; 124 int error;
124 125
126 error = usermodehelper_disable();
127 if (error)
128 return error;
129
125 if (!pm_freezing) 130 if (!pm_freezing)
126 atomic_inc(&system_freezing_cnt); 131 atomic_inc(&system_freezing_cnt);
127 132
@@ -187,6 +192,8 @@ void thaw_processes(void)
187 } while_each_thread(g, p); 192 } while_each_thread(g, p);
188 read_unlock(&tasklist_lock); 193 read_unlock(&tasklist_lock);
189 194
195 usermodehelper_enable();
196
190 schedule(); 197 schedule();
191 printk("done.\n"); 198 printk("done.\n");
192} 199}