1 // SPDX-License-Identifier: GPL-2.0-only
3 * kernel/power/main.c - PM subsystem core functionality.
5 * Copyright (c) 2003 Patrick Mochel
6 * Copyright (c) 2003 Open Source Development Lab
9 #include <linux/export.h>
10 #include <linux/kobject.h>
11 #include <linux/string.h>
12 #include <linux/pm-trace.h>
13 #include <linux/workqueue.h>
14 #include <linux/debugfs.h>
15 #include <linux/seq_file.h>
16 #include <linux/suspend.h>
17 #include <linux/syscalls.h>
18 #include <linux/pm_runtime.h>
22 #ifdef CONFIG_PM_SLEEP
24 void lock_system_sleep(void)
26 current->flags |= PF_FREEZER_SKIP;
27 mutex_lock(&system_transition_mutex);
29 EXPORT_SYMBOL_GPL(lock_system_sleep);
31 void unlock_system_sleep(void)
34 * Don't use freezer_count() because we don't want the call to
35 * try_to_freeze() here.
38 * Fundamentally, we just don't need it, because freezing condition
39 * doesn't come into effect until we release the
40 * system_transition_mutex lock, since the freezer always works with
41 * system_transition_mutex held.
43 * More importantly, in the case of hibernation,
44 * unlock_system_sleep() gets called in snapshot_read() and
45 * snapshot_write() when the freezing condition is still in effect.
46 * Which means, if we use try_to_freeze() here, it would make them
47 * enter the refrigerator, thus causing hibernation to lockup.
49 current->flags &= ~PF_FREEZER_SKIP;
50 mutex_unlock(&system_transition_mutex);
52 EXPORT_SYMBOL_GPL(unlock_system_sleep);
54 void ksys_sync_helper(void)
61 elapsed_msecs = ktime_to_ms(ktime_sub(ktime_get(), start));
62 pr_info("Filesystems sync: %ld.%03ld seconds\n",
63 elapsed_msecs / MSEC_PER_SEC, elapsed_msecs % MSEC_PER_SEC);
65 EXPORT_SYMBOL_GPL(ksys_sync_helper);
67 /* Routines for PM-transition notifications */
69 static BLOCKING_NOTIFIER_HEAD(pm_chain_head);
71 int register_pm_notifier(struct notifier_block *nb)
73 return blocking_notifier_chain_register(&pm_chain_head, nb);
75 EXPORT_SYMBOL_GPL(register_pm_notifier);
77 int unregister_pm_notifier(struct notifier_block *nb)
79 return blocking_notifier_chain_unregister(&pm_chain_head, nb);
81 EXPORT_SYMBOL_GPL(unregister_pm_notifier);
83 int pm_notifier_call_chain_robust(unsigned long val_up, unsigned long val_down)
87 ret = blocking_notifier_call_chain_robust(&pm_chain_head, val_up, val_down, NULL);
89 return notifier_to_errno(ret);
92 int pm_notifier_call_chain(unsigned long val)
94 return blocking_notifier_call_chain(&pm_chain_head, val, NULL);
97 /* If set, devices may be suspended and resumed asynchronously. */
98 int pm_async_enabled = 1;
100 static ssize_t pm_async_show(struct kobject *kobj, struct kobj_attribute *attr,
103 return sprintf(buf, "%d\n", pm_async_enabled);
106 static ssize_t pm_async_store(struct kobject *kobj, struct kobj_attribute *attr,
107 const char *buf, size_t n)
111 if (kstrtoul(buf, 10, &val))
117 pm_async_enabled = val;
121 power_attr(pm_async);
123 #ifdef CONFIG_SUSPEND
124 static ssize_t mem_sleep_show(struct kobject *kobj, struct kobj_attribute *attr,
130 for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++) {
131 if (i >= PM_SUSPEND_MEM && cxl_mem_active())
133 if (mem_sleep_states[i]) {
134 const char *label = mem_sleep_states[i];
136 if (mem_sleep_current == i)
137 s += sprintf(s, "[%s] ", label);
139 s += sprintf(s, "%s ", label);
143 /* Convert the last space to a newline if needed. */
150 static suspend_state_t decode_suspend_state(const char *buf, size_t n)
152 suspend_state_t state;
156 p = memchr(buf, '\n', n);
157 len = p ? p - buf : n;
159 for (state = PM_SUSPEND_MIN; state < PM_SUSPEND_MAX; state++) {
160 const char *label = mem_sleep_states[state];
162 if (label && len == strlen(label) && !strncmp(buf, label, len))
166 return PM_SUSPEND_ON;
169 static ssize_t mem_sleep_store(struct kobject *kobj, struct kobj_attribute *attr,
170 const char *buf, size_t n)
172 suspend_state_t state;
175 error = pm_autosleep_lock();
179 if (pm_autosleep_state() > PM_SUSPEND_ON) {
184 state = decode_suspend_state(buf, n);
185 if (state < PM_SUSPEND_MAX && state > PM_SUSPEND_ON)
186 mem_sleep_current = state;
191 pm_autosleep_unlock();
192 return error ? error : n;
195 power_attr(mem_sleep);
198 * sync_on_suspend: invoke ksys_sync_helper() before suspend.
200 * show() returns whether ksys_sync_helper() is invoked before suspend.
201 * store() accepts 0 or 1. 0 disables ksys_sync_helper() and 1 enables it.
203 bool sync_on_suspend_enabled = !IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC);
205 static ssize_t sync_on_suspend_show(struct kobject *kobj,
206 struct kobj_attribute *attr, char *buf)
208 return sprintf(buf, "%d\n", sync_on_suspend_enabled);
211 static ssize_t sync_on_suspend_store(struct kobject *kobj,
212 struct kobj_attribute *attr,
213 const char *buf, size_t n)
217 if (kstrtoul(buf, 10, &val))
223 sync_on_suspend_enabled = !!val;
227 power_attr(sync_on_suspend);
228 #endif /* CONFIG_SUSPEND */
230 #ifdef CONFIG_PM_SLEEP_DEBUG
231 int pm_test_level = TEST_NONE;
233 static const char * const pm_tests[__TEST_AFTER_LAST] = {
234 [TEST_NONE] = "none",
235 [TEST_CORE] = "core",
236 [TEST_CPUS] = "processors",
237 [TEST_PLATFORM] = "platform",
238 [TEST_DEVICES] = "devices",
239 [TEST_FREEZER] = "freezer",
242 static ssize_t pm_test_show(struct kobject *kobj, struct kobj_attribute *attr,
248 for (level = TEST_FIRST; level <= TEST_MAX; level++)
249 if (pm_tests[level]) {
250 if (level == pm_test_level)
251 s += sprintf(s, "[%s] ", pm_tests[level]);
253 s += sprintf(s, "%s ", pm_tests[level]);
257 /* convert the last space to a newline */
263 static ssize_t pm_test_store(struct kobject *kobj, struct kobj_attribute *attr,
264 const char *buf, size_t n)
266 const char * const *s;
272 p = memchr(buf, '\n', n);
273 len = p ? p - buf : n;
278 for (s = &pm_tests[level]; level <= TEST_MAX; s++, level++)
279 if (*s && len == strlen(*s) && !strncmp(buf, *s, len)) {
280 pm_test_level = level;
285 unlock_system_sleep();
287 return error ? error : n;
291 #endif /* CONFIG_PM_SLEEP_DEBUG */
293 static char *suspend_step_name(enum suspend_stat_step step)
298 case SUSPEND_PREPARE:
300 case SUSPEND_SUSPEND:
302 case SUSPEND_SUSPEND_NOIRQ:
303 return "suspend_noirq";
304 case SUSPEND_RESUME_NOIRQ:
305 return "resume_noirq";
313 #define suspend_attr(_name) \
314 static ssize_t _name##_show(struct kobject *kobj, \
315 struct kobj_attribute *attr, char *buf) \
317 return sprintf(buf, "%d\n", suspend_stats._name); \
319 static struct kobj_attribute _name = __ATTR_RO(_name)
321 suspend_attr(success);
323 suspend_attr(failed_freeze);
324 suspend_attr(failed_prepare);
325 suspend_attr(failed_suspend);
326 suspend_attr(failed_suspend_late);
327 suspend_attr(failed_suspend_noirq);
328 suspend_attr(failed_resume);
329 suspend_attr(failed_resume_early);
330 suspend_attr(failed_resume_noirq);
332 static ssize_t last_failed_dev_show(struct kobject *kobj,
333 struct kobj_attribute *attr, char *buf)
336 char *last_failed_dev = NULL;
338 index = suspend_stats.last_failed_dev + REC_FAILED_NUM - 1;
339 index %= REC_FAILED_NUM;
340 last_failed_dev = suspend_stats.failed_devs[index];
342 return sprintf(buf, "%s\n", last_failed_dev);
344 static struct kobj_attribute last_failed_dev = __ATTR_RO(last_failed_dev);
346 static ssize_t last_failed_errno_show(struct kobject *kobj,
347 struct kobj_attribute *attr, char *buf)
350 int last_failed_errno;
352 index = suspend_stats.last_failed_errno + REC_FAILED_NUM - 1;
353 index %= REC_FAILED_NUM;
354 last_failed_errno = suspend_stats.errno[index];
356 return sprintf(buf, "%d\n", last_failed_errno);
358 static struct kobj_attribute last_failed_errno = __ATTR_RO(last_failed_errno);
360 static ssize_t last_failed_step_show(struct kobject *kobj,
361 struct kobj_attribute *attr, char *buf)
364 enum suspend_stat_step step;
365 char *last_failed_step = NULL;
367 index = suspend_stats.last_failed_step + REC_FAILED_NUM - 1;
368 index %= REC_FAILED_NUM;
369 step = suspend_stats.failed_steps[index];
370 last_failed_step = suspend_step_name(step);
372 return sprintf(buf, "%s\n", last_failed_step);
374 static struct kobj_attribute last_failed_step = __ATTR_RO(last_failed_step);
376 static struct attribute *suspend_attrs[] = {
380 &failed_prepare.attr,
381 &failed_suspend.attr,
382 &failed_suspend_late.attr,
383 &failed_suspend_noirq.attr,
385 &failed_resume_early.attr,
386 &failed_resume_noirq.attr,
387 &last_failed_dev.attr,
388 &last_failed_errno.attr,
389 &last_failed_step.attr,
393 static const struct attribute_group suspend_attr_group = {
394 .name = "suspend_stats",
395 .attrs = suspend_attrs,
398 #ifdef CONFIG_DEBUG_FS
399 static int suspend_stats_show(struct seq_file *s, void *unused)
401 int i, index, last_dev, last_errno, last_step;
403 last_dev = suspend_stats.last_failed_dev + REC_FAILED_NUM - 1;
404 last_dev %= REC_FAILED_NUM;
405 last_errno = suspend_stats.last_failed_errno + REC_FAILED_NUM - 1;
406 last_errno %= REC_FAILED_NUM;
407 last_step = suspend_stats.last_failed_step + REC_FAILED_NUM - 1;
408 last_step %= REC_FAILED_NUM;
409 seq_printf(s, "%s: %d\n%s: %d\n%s: %d\n%s: %d\n%s: %d\n"
410 "%s: %d\n%s: %d\n%s: %d\n%s: %d\n%s: %d\n",
411 "success", suspend_stats.success,
412 "fail", suspend_stats.fail,
413 "failed_freeze", suspend_stats.failed_freeze,
414 "failed_prepare", suspend_stats.failed_prepare,
415 "failed_suspend", suspend_stats.failed_suspend,
416 "failed_suspend_late",
417 suspend_stats.failed_suspend_late,
418 "failed_suspend_noirq",
419 suspend_stats.failed_suspend_noirq,
420 "failed_resume", suspend_stats.failed_resume,
421 "failed_resume_early",
422 suspend_stats.failed_resume_early,
423 "failed_resume_noirq",
424 suspend_stats.failed_resume_noirq);
425 seq_printf(s, "failures:\n last_failed_dev:\t%-s\n",
426 suspend_stats.failed_devs[last_dev]);
427 for (i = 1; i < REC_FAILED_NUM; i++) {
428 index = last_dev + REC_FAILED_NUM - i;
429 index %= REC_FAILED_NUM;
430 seq_printf(s, "\t\t\t%-s\n",
431 suspend_stats.failed_devs[index]);
433 seq_printf(s, " last_failed_errno:\t%-d\n",
434 suspend_stats.errno[last_errno]);
435 for (i = 1; i < REC_FAILED_NUM; i++) {
436 index = last_errno + REC_FAILED_NUM - i;
437 index %= REC_FAILED_NUM;
438 seq_printf(s, "\t\t\t%-d\n",
439 suspend_stats.errno[index]);
441 seq_printf(s, " last_failed_step:\t%-s\n",
443 suspend_stats.failed_steps[last_step]));
444 for (i = 1; i < REC_FAILED_NUM; i++) {
445 index = last_step + REC_FAILED_NUM - i;
446 index %= REC_FAILED_NUM;
447 seq_printf(s, "\t\t\t%-s\n",
449 suspend_stats.failed_steps[index]));
454 DEFINE_SHOW_ATTRIBUTE(suspend_stats);
456 static int __init pm_debugfs_init(void)
458 debugfs_create_file("suspend_stats", S_IFREG | S_IRUGO,
459 NULL, NULL, &suspend_stats_fops);
463 late_initcall(pm_debugfs_init);
464 #endif /* CONFIG_DEBUG_FS */
466 #endif /* CONFIG_PM_SLEEP */
468 #ifdef CONFIG_PM_SLEEP_DEBUG
470 * pm_print_times: print time taken by devices to suspend and resume.
472 * show() returns whether printing of suspend and resume times is enabled.
473 * store() accepts 0 or 1. 0 disables printing and 1 enables it.
475 bool pm_print_times_enabled;
477 static ssize_t pm_print_times_show(struct kobject *kobj,
478 struct kobj_attribute *attr, char *buf)
480 return sprintf(buf, "%d\n", pm_print_times_enabled);
483 static ssize_t pm_print_times_store(struct kobject *kobj,
484 struct kobj_attribute *attr,
485 const char *buf, size_t n)
489 if (kstrtoul(buf, 10, &val))
495 pm_print_times_enabled = !!val;
499 power_attr(pm_print_times);
501 static inline void pm_print_times_init(void)
503 pm_print_times_enabled = !!initcall_debug;
506 static ssize_t pm_wakeup_irq_show(struct kobject *kobj,
507 struct kobj_attribute *attr,
510 if (!pm_wakeup_irq())
513 return sprintf(buf, "%u\n", pm_wakeup_irq());
516 power_attr_ro(pm_wakeup_irq);
518 bool pm_debug_messages_on __read_mostly;
520 static ssize_t pm_debug_messages_show(struct kobject *kobj,
521 struct kobj_attribute *attr, char *buf)
523 return sprintf(buf, "%d\n", pm_debug_messages_on);
526 static ssize_t pm_debug_messages_store(struct kobject *kobj,
527 struct kobj_attribute *attr,
528 const char *buf, size_t n)
532 if (kstrtoul(buf, 10, &val))
538 pm_debug_messages_on = !!val;
542 power_attr(pm_debug_messages);
544 static int __init pm_debug_messages_setup(char *str)
546 pm_debug_messages_on = true;
549 __setup("pm_debug_messages", pm_debug_messages_setup);
551 #else /* !CONFIG_PM_SLEEP_DEBUG */
552 static inline void pm_print_times_init(void) {}
553 #endif /* CONFIG_PM_SLEEP_DEBUG */
555 struct kobject *power_kobj;
558 * state - control system sleep states.
560 * show() returns available sleep state labels, which may be "mem", "standby",
561 * "freeze" and "disk" (hibernation).
562 * See Documentation/admin-guide/pm/sleep-states.rst for a description of
565 * store() accepts one of those strings, translates it into the proper
566 * enumerated value, and initiates a suspend transition.
568 static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
572 #ifdef CONFIG_SUSPEND
575 for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
577 s += sprintf(s,"%s ", pm_states[i]);
580 if (hibernation_available())
581 s += sprintf(s, "disk ");
583 /* convert the last space to a newline */
588 static suspend_state_t decode_state(const char *buf, size_t n)
590 #ifdef CONFIG_SUSPEND
591 suspend_state_t state;
596 p = memchr(buf, '\n', n);
597 len = p ? p - buf : n;
599 /* Check hibernation first. */
600 if (len == 4 && str_has_prefix(buf, "disk"))
601 return PM_SUSPEND_MAX;
603 #ifdef CONFIG_SUSPEND
604 for (state = PM_SUSPEND_MIN; state < PM_SUSPEND_MAX; state++) {
605 const char *label = pm_states[state];
607 if (label && len == strlen(label) && !strncmp(buf, label, len))
612 return PM_SUSPEND_ON;
615 static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
616 const char *buf, size_t n)
618 suspend_state_t state;
621 error = pm_autosleep_lock();
625 if (pm_autosleep_state() > PM_SUSPEND_ON) {
630 state = decode_state(buf, n);
631 if (state < PM_SUSPEND_MAX) {
632 if (state == PM_SUSPEND_MEM)
633 state = mem_sleep_current;
635 error = pm_suspend(state);
636 } else if (state == PM_SUSPEND_MAX) {
643 pm_autosleep_unlock();
644 return error ? error : n;
649 #ifdef CONFIG_PM_SLEEP
651 * The 'wakeup_count' attribute, along with the functions defined in
652 * drivers/base/power/wakeup.c, provides a means by which wakeup events can be
653 * handled in a non-racy way.
655 * If a wakeup event occurs when the system is in a sleep state, it simply is
656 * woken up. In turn, if an event that would wake the system up from a sleep
657 * state occurs when it is undergoing a transition to that sleep state, the
658 * transition should be aborted. Moreover, if such an event occurs when the
659 * system is in the working state, an attempt to start a transition to the
660 * given sleep state should fail during certain period after the detection of
661 * the event. Using the 'state' attribute alone is not sufficient to satisfy
662 * these requirements, because a wakeup event may occur exactly when 'state'
663 * is being written to and may be delivered to user space right before it is
664 * frozen, so the event will remain only partially processed until the system is
665 * woken up by another event. In particular, it won't cause the transition to
666 * a sleep state to be aborted.
668 * This difficulty may be overcome if user space uses 'wakeup_count' before
669 * writing to 'state'. It first should read from 'wakeup_count' and store
670 * the read value. Then, after carrying out its own preparations for the system
671 * transition to a sleep state, it should write the stored value to
672 * 'wakeup_count'. If that fails, at least one wakeup event has occurred since
673 * 'wakeup_count' was read and 'state' should not be written to. Otherwise, it
674 * is allowed to write to 'state', but the transition will be aborted if there
675 * are any wakeup events detected after 'wakeup_count' was written to.
678 static ssize_t wakeup_count_show(struct kobject *kobj,
679 struct kobj_attribute *attr,
684 return pm_get_wakeup_count(&val, true) ?
685 sprintf(buf, "%u\n", val) : -EINTR;
688 static ssize_t wakeup_count_store(struct kobject *kobj,
689 struct kobj_attribute *attr,
690 const char *buf, size_t n)
695 error = pm_autosleep_lock();
699 if (pm_autosleep_state() > PM_SUSPEND_ON) {
705 if (sscanf(buf, "%u", &val) == 1) {
706 if (pm_save_wakeup_count(val))
709 pm_print_active_wakeup_sources();
713 pm_autosleep_unlock();
717 power_attr(wakeup_count);
719 #ifdef CONFIG_PM_AUTOSLEEP
720 static ssize_t autosleep_show(struct kobject *kobj,
721 struct kobj_attribute *attr,
724 suspend_state_t state = pm_autosleep_state();
726 if (state == PM_SUSPEND_ON)
727 return sprintf(buf, "off\n");
729 #ifdef CONFIG_SUSPEND
730 if (state < PM_SUSPEND_MAX)
731 return sprintf(buf, "%s\n", pm_states[state] ?
732 pm_states[state] : "error");
734 #ifdef CONFIG_HIBERNATION
735 return sprintf(buf, "disk\n");
737 return sprintf(buf, "error");
741 static ssize_t autosleep_store(struct kobject *kobj,
742 struct kobj_attribute *attr,
743 const char *buf, size_t n)
745 suspend_state_t state = decode_state(buf, n);
748 if (state == PM_SUSPEND_ON
749 && strcmp(buf, "off") && strcmp(buf, "off\n"))
752 if (state == PM_SUSPEND_MEM)
753 state = mem_sleep_current;
755 error = pm_autosleep_set_state(state);
756 return error ? error : n;
759 power_attr(autosleep);
760 #endif /* CONFIG_PM_AUTOSLEEP */
762 #ifdef CONFIG_PM_WAKELOCKS
763 static ssize_t wake_lock_show(struct kobject *kobj,
764 struct kobj_attribute *attr,
767 return pm_show_wakelocks(buf, true);
770 static ssize_t wake_lock_store(struct kobject *kobj,
771 struct kobj_attribute *attr,
772 const char *buf, size_t n)
774 int error = pm_wake_lock(buf);
775 return error ? error : n;
778 power_attr(wake_lock);
780 static ssize_t wake_unlock_show(struct kobject *kobj,
781 struct kobj_attribute *attr,
784 return pm_show_wakelocks(buf, false);
787 static ssize_t wake_unlock_store(struct kobject *kobj,
788 struct kobj_attribute *attr,
789 const char *buf, size_t n)
791 int error = pm_wake_unlock(buf);
792 return error ? error : n;
795 power_attr(wake_unlock);
797 #endif /* CONFIG_PM_WAKELOCKS */
798 #endif /* CONFIG_PM_SLEEP */
800 #ifdef CONFIG_PM_TRACE
801 int pm_trace_enabled;
803 static ssize_t pm_trace_show(struct kobject *kobj, struct kobj_attribute *attr,
806 return sprintf(buf, "%d\n", pm_trace_enabled);
810 pm_trace_store(struct kobject *kobj, struct kobj_attribute *attr,
811 const char *buf, size_t n)
815 if (sscanf(buf, "%d", &val) == 1) {
816 pm_trace_enabled = !!val;
817 if (pm_trace_enabled) {
818 pr_warn("PM: Enabling pm_trace changes system date and time during resume.\n"
819 "PM: Correct system time has to be restored manually after resume.\n");
826 power_attr(pm_trace);
828 static ssize_t pm_trace_dev_match_show(struct kobject *kobj,
829 struct kobj_attribute *attr,
832 return show_trace_dev_match(buf, PAGE_SIZE);
835 power_attr_ro(pm_trace_dev_match);
837 #endif /* CONFIG_PM_TRACE */
839 #ifdef CONFIG_FREEZER
840 static ssize_t pm_freeze_timeout_show(struct kobject *kobj,
841 struct kobj_attribute *attr, char *buf)
843 return sprintf(buf, "%u\n", freeze_timeout_msecs);
846 static ssize_t pm_freeze_timeout_store(struct kobject *kobj,
847 struct kobj_attribute *attr,
848 const char *buf, size_t n)
852 if (kstrtoul(buf, 10, &val))
855 freeze_timeout_msecs = val;
859 power_attr(pm_freeze_timeout);
861 #endif /* CONFIG_FREEZER*/
863 static struct attribute * g[] = {
865 #ifdef CONFIG_PM_TRACE
867 &pm_trace_dev_match_attr.attr,
869 #ifdef CONFIG_PM_SLEEP
871 &wakeup_count_attr.attr,
872 #ifdef CONFIG_SUSPEND
873 &mem_sleep_attr.attr,
874 &sync_on_suspend_attr.attr,
876 #ifdef CONFIG_PM_AUTOSLEEP
877 &autosleep_attr.attr,
879 #ifdef CONFIG_PM_WAKELOCKS
880 &wake_lock_attr.attr,
881 &wake_unlock_attr.attr,
883 #ifdef CONFIG_PM_SLEEP_DEBUG
885 &pm_print_times_attr.attr,
886 &pm_wakeup_irq_attr.attr,
887 &pm_debug_messages_attr.attr,
890 #ifdef CONFIG_FREEZER
891 &pm_freeze_timeout_attr.attr,
896 static const struct attribute_group attr_group = {
900 static const struct attribute_group *attr_groups[] = {
902 #ifdef CONFIG_PM_SLEEP
908 struct workqueue_struct *pm_wq;
909 EXPORT_SYMBOL_GPL(pm_wq);
911 static int __init pm_start_workqueue(void)
913 pm_wq = alloc_workqueue("pm", WQ_FREEZABLE, 0);
915 return pm_wq ? 0 : -ENOMEM;
918 static int __init pm_init(void)
920 int error = pm_start_workqueue();
923 hibernate_image_size_init();
924 hibernate_reserved_size_init();
926 power_kobj = kobject_create_and_add("power", NULL);
929 error = sysfs_create_groups(power_kobj, attr_groups);
932 pm_print_times_init();
933 return pm_autosleep_init();
936 core_initcall(pm_init);