diff options
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r-- | kernel/power/main.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index f710e36930cc..347d2cc88cd0 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kobject.h> | 11 | #include <linux/kobject.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/resume-trace.h> | 13 | #include <linux/resume-trace.h> |
14 | #include <linux/workqueue.h> | ||
14 | 15 | ||
15 | #include "power.h" | 16 | #include "power.h" |
16 | 17 | ||
@@ -217,8 +218,24 @@ static struct attribute_group attr_group = { | |||
217 | .attrs = g, | 218 | .attrs = g, |
218 | }; | 219 | }; |
219 | 220 | ||
221 | #ifdef CONFIG_PM_RUNTIME | ||
222 | struct workqueue_struct *pm_wq; | ||
223 | |||
224 | static int __init pm_start_workqueue(void) | ||
225 | { | ||
226 | pm_wq = create_freezeable_workqueue("pm"); | ||
227 | |||
228 | return pm_wq ? 0 : -ENOMEM; | ||
229 | } | ||
230 | #else | ||
231 | static inline int pm_start_workqueue(void) { return 0; } | ||
232 | #endif | ||
233 | |||
220 | static int __init pm_init(void) | 234 | static int __init pm_init(void) |
221 | { | 235 | { |
236 | int error = pm_start_workqueue(); | ||
237 | if (error) | ||
238 | return error; | ||
222 | power_kobj = kobject_create_and_add("power", NULL); | 239 | power_kobj = kobject_create_and_add("power", NULL); |
223 | if (!power_kobj) | 240 | if (!power_kobj) |
224 | return -ENOMEM; | 241 | return -ENOMEM; |