1
2
3
4
5
6
7
8
9
10
11
12#include <linux/export.h>
13#include <linux/suspend.h>
14#include <linux/syscalls.h>
15#include <linux/reboot.h>
16#include <linux/string.h>
17#include <linux/device.h>
18#include <linux/async.h>
19#include <linux/kmod.h>
20#include <linux/delay.h>
21#include <linux/fs.h>
22#include <linux/mount.h>
23#include <linux/pm.h>
24#include <linux/console.h>
25#include <linux/cpu.h>
26#include <linux/freezer.h>
27#include <linux/gfp.h>
28#include <linux/syscore_ops.h>
29#include <scsi/scsi_scan.h>
30
31#include "power.h"
32
33
34static int nocompress;
35static int noresume;
36static int resume_wait;
37static int resume_delay;
38static char resume_file[256] = CONFIG_PM_STD_PARTITION;
39dev_t swsusp_resume_device;
40sector_t swsusp_resume_block;
41int in_suspend __nosavedata;
42
43enum {
44 HIBERNATION_INVALID,
45 HIBERNATION_PLATFORM,
46 HIBERNATION_TEST,
47 HIBERNATION_TESTPROC,
48 HIBERNATION_SHUTDOWN,
49 HIBERNATION_REBOOT,
50
51 __HIBERNATION_AFTER_LAST
52};
53#define HIBERNATION_MAX (__HIBERNATION_AFTER_LAST-1)
54#define HIBERNATION_FIRST (HIBERNATION_INVALID + 1)
55
56static int hibernation_mode = HIBERNATION_SHUTDOWN;
57
58bool freezer_test_done;
59
60static const struct platform_hibernation_ops *hibernation_ops;
61
62
63
64
65
66void hibernation_set_ops(const struct platform_hibernation_ops *ops)
67{
68 if (ops && !(ops->begin && ops->end && ops->pre_snapshot
69 && ops->prepare && ops->finish && ops->enter && ops->pre_restore
70 && ops->restore_cleanup && ops->leave)) {
71 WARN_ON(1);
72 return;
73 }
74 mutex_lock(&pm_mutex);
75 hibernation_ops = ops;
76 if (ops)
77 hibernation_mode = HIBERNATION_PLATFORM;
78 else if (hibernation_mode == HIBERNATION_PLATFORM)
79 hibernation_mode = HIBERNATION_SHUTDOWN;
80
81 mutex_unlock(&pm_mutex);
82}
83
84static bool entering_platform_hibernation;
85
86bool system_entering_hibernation(void)
87{
88 return entering_platform_hibernation;
89}
90EXPORT_SYMBOL(system_entering_hibernation);
91
92#ifdef CONFIG_PM_DEBUG
93static void hibernation_debug_sleep(void)
94{
95 printk(KERN_INFO "hibernation debug: Waiting for 5 seconds.\n");
96 mdelay(5000);
97}
98
99static int hibernation_testmode(int mode)
100{
101 if (hibernation_mode == mode) {
102 hibernation_debug_sleep();
103 return 1;
104 }
105 return 0;
106}
107
108static int hibernation_test(int level)
109{
110 if (pm_test_level == level) {
111 hibernation_debug_sleep();
112 return 1;
113 }
114 return 0;
115}
116#else
117static int hibernation_testmode(int mode) { return 0; }
118static int hibernation_test(int level) { return 0; }
119#endif
120
121
122
123
124
125static int platform_begin(int platform_mode)
126{
127 return (platform_mode && hibernation_ops) ?
128 hibernation_ops->begin() : 0;
129}
130
131
132
133
134
135static void platform_end(int platform_mode)
136{
137 if (platform_mode && hibernation_ops)
138 hibernation_ops->end();
139}
140
141
142
143
144
145
146
147
148
149static int platform_pre_snapshot(int platform_mode)
150{
151 return (platform_mode && hibernation_ops) ?
152 hibernation_ops->pre_snapshot() : 0;
153}
154
155
156
157
158
159
160
161
162
163
164static void platform_leave(int platform_mode)
165{
166 if (platform_mode && hibernation_ops)
167 hibernation_ops->leave();
168}
169
170
171
172
173
174
175
176
177
178
179static void platform_finish(int platform_mode)
180{
181 if (platform_mode && hibernation_ops)
182 hibernation_ops->finish();
183}
184
185
186
187
188
189
190
191
192
193
194
195static int platform_pre_restore(int platform_mode)
196{
197 return (platform_mode && hibernation_ops) ?
198 hibernation_ops->pre_restore() : 0;
199}
200
201
202
203
204
205
206
207
208
209
210
211
212static void platform_restore_cleanup(int platform_mode)
213{
214 if (platform_mode && hibernation_ops)
215 hibernation_ops->restore_cleanup();
216}
217
218
219
220
221
222static void platform_recover(int platform_mode)
223{
224 if (platform_mode && hibernation_ops && hibernation_ops->recover)
225 hibernation_ops->recover();
226}
227
228
229
230
231
232
233
234
235void swsusp_show_speed(struct timeval *start, struct timeval *stop,
236 unsigned nr_pages, char *msg)
237{
238 s64 elapsed_centisecs64;
239 int centisecs;
240 int k;
241 int kps;
242
243 elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start);
244 do_div(elapsed_centisecs64, NSEC_PER_SEC / 100);
245 centisecs = elapsed_centisecs64;
246 if (centisecs == 0)
247 centisecs = 1;
248 k = nr_pages * (PAGE_SIZE / 1024);
249 kps = (k * 100) / centisecs;
250 printk(KERN_INFO "PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n",
251 msg, k,
252 centisecs / 100, centisecs % 100,
253 kps / 1000, (kps % 1000) / 10);
254}
255
256
257
258
259
260
261
262
263
264
265static int create_image(int platform_mode)
266{
267 int error;
268
269 error = dpm_suspend_noirq(PMSG_FREEZE);
270 if (error) {
271 printk(KERN_ERR "PM: Some devices failed to power down, "
272 "aborting hibernation\n");
273 return error;
274 }
275
276 error = platform_pre_snapshot(platform_mode);
277 if (error || hibernation_test(TEST_PLATFORM))
278 goto Platform_finish;
279
280 error = disable_nonboot_cpus();
281 if (error || hibernation_test(TEST_CPUS)
282 || hibernation_testmode(HIBERNATION_TEST))
283 goto Enable_cpus;
284
285 local_irq_disable();
286
287 error = syscore_suspend();
288 if (error) {
289 printk(KERN_ERR "PM: Some system devices failed to power down, "
290 "aborting hibernation\n");
291 goto Enable_irqs;
292 }
293
294 if (hibernation_test(TEST_CORE) || pm_wakeup_pending())
295 goto Power_up;
296
297 in_suspend = 1;
298 save_processor_state();
299 error = swsusp_arch_suspend();
300 if (error)
301 printk(KERN_ERR "PM: Error %d creating hibernation image\n",
302 error);
303
304 restore_processor_state();
305 if (!in_suspend) {
306 events_check_enabled = false;
307 platform_leave(platform_mode);
308 }
309
310 Power_up:
311 syscore_resume();
312
313 Enable_irqs:
314 local_irq_enable();
315
316 Enable_cpus:
317 enable_nonboot_cpus();
318
319 Platform_finish:
320 platform_finish(platform_mode);
321
322 dpm_resume_noirq(in_suspend ?
323 (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
324
325 return error;
326}
327
328
329
330
331
332
333
334int hibernation_snapshot(int platform_mode)
335{
336 pm_message_t msg = PMSG_RECOVER;
337 int error;
338
339 error = platform_begin(platform_mode);
340 if (error)
341 goto Close;
342
343
344 error = hibernate_preallocate_memory();
345 if (error)
346 goto Close;
347
348 error = freeze_kernel_threads();
349 if (error)
350 goto Cleanup;
351
352 if (hibernation_test(TEST_FREEZER) ||
353 hibernation_testmode(HIBERNATION_TESTPROC)) {
354
355
356
357
358
359 freezer_test_done = true;
360 goto Cleanup;
361 }
362
363 error = dpm_prepare(PMSG_FREEZE);
364 if (error) {
365 dpm_complete(msg);
366 goto Cleanup;
367 }
368
369 suspend_console();
370 pm_restrict_gfp_mask();
371 error = dpm_suspend(PMSG_FREEZE);
372 if (error)
373 goto Recover_platform;
374
375 if (hibernation_test(TEST_DEVICES))
376 goto Recover_platform;
377
378 error = create_image(platform_mode);
379
380
381
382
383
384 Resume_devices:
385
386 if (error || !in_suspend)
387 swsusp_free();
388
389 msg = in_suspend ? (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE;
390 dpm_resume(msg);
391
392 if (error || !in_suspend)
393 pm_restore_gfp_mask();
394
395 resume_console();
396 dpm_complete(msg);
397
398 Close:
399 platform_end(platform_mode);
400 return error;
401
402 Recover_platform:
403 platform_recover(platform_mode);
404 goto Resume_devices;
405
406 Cleanup:
407 swsusp_free();
408 goto Close;
409}
410
411
412
413
414
415
416
417
418
419
420static int resume_target_kernel(bool platform_mode)
421{
422 int error;
423
424 error = dpm_suspend_noirq(PMSG_QUIESCE);
425 if (error) {
426 printk(KERN_ERR "PM: Some devices failed to power down, "
427 "aborting resume\n");
428 return error;
429 }
430
431 error = platform_pre_restore(platform_mode);
432 if (error)
433 goto Cleanup;
434
435 error = disable_nonboot_cpus();
436 if (error)
437 goto Enable_cpus;
438
439 local_irq_disable();
440
441 error = syscore_suspend();
442 if (error)
443 goto Enable_irqs;
444
445 save_processor_state();
446 error = restore_highmem();
447 if (!error) {
448 error = swsusp_arch_resume();
449
450
451
452
453
454 BUG_ON(!error);
455
456
457
458
459 restore_highmem();
460 }
461
462
463
464
465
466 swsusp_free();
467 restore_processor_state();
468 touch_softlockup_watchdog();
469
470 syscore_resume();
471
472 Enable_irqs:
473 local_irq_enable();
474
475 Enable_cpus:
476 enable_nonboot_cpus();
477
478 Cleanup:
479 platform_restore_cleanup(platform_mode);
480
481 dpm_resume_noirq(PMSG_RECOVER);
482
483 return error;
484}
485
486
487
488
489
490
491
492
493int hibernation_restore(int platform_mode)
494{
495 int error;
496
497 pm_prepare_console();
498 suspend_console();
499 pm_restrict_gfp_mask();
500 error = dpm_suspend_start(PMSG_QUIESCE);
501 if (!error) {
502 error = resume_target_kernel(platform_mode);
503 dpm_resume_end(PMSG_RECOVER);
504 }
505 pm_restore_gfp_mask();
506 resume_console();
507 pm_restore_console();
508 return error;
509}
510
511
512
513
514int hibernation_platform_enter(void)
515{
516 int error;
517
518 if (!hibernation_ops)
519 return -ENOSYS;
520
521
522
523
524
525
526 error = hibernation_ops->begin();
527 if (error)
528 goto Close;
529
530 entering_platform_hibernation = true;
531 suspend_console();
532 error = dpm_suspend_start(PMSG_HIBERNATE);
533 if (error) {
534 if (hibernation_ops->recover)
535 hibernation_ops->recover();
536 goto Resume_devices;
537 }
538
539 error = dpm_suspend_noirq(PMSG_HIBERNATE);
540 if (error)
541 goto Resume_devices;
542
543 error = hibernation_ops->prepare();
544 if (error)
545 goto Platform_finish;
546
547 error = disable_nonboot_cpus();
548 if (error)
549 goto Platform_finish;
550
551 local_irq_disable();
552 syscore_suspend();
553 if (pm_wakeup_pending()) {
554 error = -EAGAIN;
555 goto Power_up;
556 }
557
558 hibernation_ops->enter();
559
560 while (1);
561
562 Power_up:
563 syscore_resume();
564 local_irq_enable();
565 enable_nonboot_cpus();
566
567 Platform_finish:
568 hibernation_ops->finish();
569
570 dpm_resume_noirq(PMSG_RESTORE);
571
572 Resume_devices:
573 entering_platform_hibernation = false;
574 dpm_resume_end(PMSG_RESTORE);
575 resume_console();
576
577 Close:
578 hibernation_ops->end();
579
580 return error;
581}
582
583
584
585
586
587
588
589
590static void power_down(void)
591{
592 switch (hibernation_mode) {
593 case HIBERNATION_TEST:
594 case HIBERNATION_TESTPROC:
595 break;
596 case HIBERNATION_REBOOT:
597 kernel_restart(NULL);
598 break;
599 case HIBERNATION_PLATFORM:
600 hibernation_platform_enter();
601 case HIBERNATION_SHUTDOWN:
602 kernel_power_off();
603 break;
604 }
605 kernel_halt();
606
607
608
609
610 printk(KERN_CRIT "PM: Please power down manually\n");
611 while(1);
612}
613
614static int prepare_processes(void)
615{
616 int error = 0;
617
618 if (freeze_processes()) {
619 error = -EBUSY;
620 thaw_processes();
621 }
622 return error;
623}
624
625
626
627
628int hibernate(void)
629{
630 int error;
631
632 mutex_lock(&pm_mutex);
633
634 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
635 error = -EBUSY;
636 goto Unlock;
637 }
638
639 pm_prepare_console();
640 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
641 if (error)
642 goto Exit;
643
644 error = usermodehelper_disable();
645 if (error)
646 goto Exit;
647
648
649 error = create_basic_memory_bitmaps();
650 if (error)
651 goto Exit;
652
653 printk(KERN_INFO "PM: Syncing filesystems ... ");
654 sys_sync();
655 printk("done.\n");
656
657 error = prepare_processes();
658 if (error)
659 goto Finish;
660
661 error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);
662 if (error)
663 goto Thaw;
664 if (freezer_test_done) {
665 freezer_test_done = false;
666 goto Thaw;
667 }
668
669 if (in_suspend) {
670 unsigned int flags = 0;
671
672 if (hibernation_mode == HIBERNATION_PLATFORM)
673 flags |= SF_PLATFORM_MODE;
674 if (nocompress)
675 flags |= SF_NOCOMPRESS_MODE;
676 else
677 flags |= SF_CRC32_MODE;
678
679 pr_debug("PM: writing image.\n");
680 error = swsusp_write(flags);
681 swsusp_free();
682 if (!error)
683 power_down();
684 in_suspend = 0;
685 pm_restore_gfp_mask();
686 } else {
687 pr_debug("PM: Image restored successfully.\n");
688 }
689
690 Thaw:
691 thaw_processes();
692 Finish:
693 free_basic_memory_bitmaps();
694 usermodehelper_enable();
695 Exit:
696 pm_notifier_call_chain(PM_POST_HIBERNATION);
697 pm_restore_console();
698 atomic_inc(&snapshot_device_available);
699 Unlock:
700 mutex_unlock(&pm_mutex);
701 return error;
702}
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720static int software_resume(void)
721{
722 int error;
723 unsigned int flags;
724
725
726
727
728 if (noresume)
729 return 0;
730
731
732
733
734
735
736
737
738
739
740
741 mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING);
742
743 if (swsusp_resume_device)
744 goto Check_image;
745
746 if (!strlen(resume_file)) {
747 error = -ENOENT;
748 goto Unlock;
749 }
750
751 pr_debug("PM: Checking hibernation image partition %s\n", resume_file);
752
753 if (resume_delay) {
754 printk(KERN_INFO "Waiting %dsec before reading resume device...\n",
755 resume_delay);
756 ssleep(resume_delay);
757 }
758
759
760 swsusp_resume_device = name_to_dev_t(resume_file);
761 if (!swsusp_resume_device) {
762
763
764
765
766 wait_for_device_probe();
767
768 if (resume_wait) {
769 while ((swsusp_resume_device = name_to_dev_t(resume_file)) == 0)
770 msleep(10);
771 async_synchronize_full();
772 }
773
774
775
776
777
778
779 scsi_complete_async_scans();
780
781 swsusp_resume_device = name_to_dev_t(resume_file);
782 if (!swsusp_resume_device) {
783 error = -ENODEV;
784 goto Unlock;
785 }
786 }
787
788 Check_image:
789 pr_debug("PM: Hibernation image partition %d:%d present\n",
790 MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
791
792 pr_debug("PM: Looking for hibernation image.\n");
793 error = swsusp_check();
794 if (error)
795 goto Unlock;
796
797
798 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
799 error = -EBUSY;
800 swsusp_close(FMODE_READ);
801 goto Unlock;
802 }
803
804 pm_prepare_console();
805 error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
806 if (error)
807 goto close_finish;
808
809 error = usermodehelper_disable();
810 if (error)
811 goto close_finish;
812
813 error = create_basic_memory_bitmaps();
814 if (error)
815 goto close_finish;
816
817 pr_debug("PM: Preparing processes for restore.\n");
818 error = prepare_processes();
819 if (error) {
820 swsusp_close(FMODE_READ);
821 goto Done;
822 }
823
824 pr_debug("PM: Loading hibernation image.\n");
825
826 error = swsusp_read(&flags);
827 swsusp_close(FMODE_READ);
828 if (!error)
829 hibernation_restore(flags & SF_PLATFORM_MODE);
830
831 printk(KERN_ERR "PM: Failed to load hibernation image, recovering.\n");
832 swsusp_free();
833 thaw_processes();
834 Done:
835 free_basic_memory_bitmaps();
836 usermodehelper_enable();
837 Finish:
838 pm_notifier_call_chain(PM_POST_RESTORE);
839 pm_restore_console();
840 atomic_inc(&snapshot_device_available);
841
842 Unlock:
843 mutex_unlock(&pm_mutex);
844 pr_debug("PM: Hibernation image not present or could not be loaded.\n");
845 return error;
846close_finish:
847 swsusp_close(FMODE_READ);
848 goto Finish;
849}
850
851late_initcall(software_resume);
852
853
854static const char * const hibernation_modes[] = {
855 [HIBERNATION_PLATFORM] = "platform",
856 [HIBERNATION_SHUTDOWN] = "shutdown",
857 [HIBERNATION_REBOOT] = "reboot",
858 [HIBERNATION_TEST] = "test",
859 [HIBERNATION_TESTPROC] = "testproc",
860};
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890static ssize_t disk_show(struct kobject *kobj, struct kobj_attribute *attr,
891 char *buf)
892{
893 int i;
894 char *start = buf;
895
896 for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) {
897 if (!hibernation_modes[i])
898 continue;
899 switch (i) {
900 case HIBERNATION_SHUTDOWN:
901 case HIBERNATION_REBOOT:
902 case HIBERNATION_TEST:
903 case HIBERNATION_TESTPROC:
904 break;
905 case HIBERNATION_PLATFORM:
906 if (hibernation_ops)
907 break;
908
909 continue;
910 }
911 if (i == hibernation_mode)
912 buf += sprintf(buf, "[%s] ", hibernation_modes[i]);
913 else
914 buf += sprintf(buf, "%s ", hibernation_modes[i]);
915 }
916 buf += sprintf(buf, "\n");
917 return buf-start;
918}
919
920static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,
921 const char *buf, size_t n)
922{
923 int error = 0;
924 int i;
925 int len;
926 char *p;
927 int mode = HIBERNATION_INVALID;
928
929 p = memchr(buf, '\n', n);
930 len = p ? p - buf : n;
931
932 mutex_lock(&pm_mutex);
933 for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) {
934 if (len == strlen(hibernation_modes[i])
935 && !strncmp(buf, hibernation_modes[i], len)) {
936 mode = i;
937 break;
938 }
939 }
940 if (mode != HIBERNATION_INVALID) {
941 switch (mode) {
942 case HIBERNATION_SHUTDOWN:
943 case HIBERNATION_REBOOT:
944 case HIBERNATION_TEST:
945 case HIBERNATION_TESTPROC:
946 hibernation_mode = mode;
947 break;
948 case HIBERNATION_PLATFORM:
949 if (hibernation_ops)
950 hibernation_mode = mode;
951 else
952 error = -EINVAL;
953 }
954 } else
955 error = -EINVAL;
956
957 if (!error)
958 pr_debug("PM: Hibernation mode set to '%s'\n",
959 hibernation_modes[mode]);
960 mutex_unlock(&pm_mutex);
961 return error ? error : n;
962}
963
964power_attr(disk);
965
966static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr,
967 char *buf)
968{
969 return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device),
970 MINOR(swsusp_resume_device));
971}
972
973static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,
974 const char *buf, size_t n)
975{
976 unsigned int maj, min;
977 dev_t res;
978 int ret = -EINVAL;
979
980 if (sscanf(buf, "%u:%u", &maj, &min) != 2)
981 goto out;
982
983 res = MKDEV(maj,min);
984 if (maj != MAJOR(res) || min != MINOR(res))
985 goto out;
986
987 mutex_lock(&pm_mutex);
988 swsusp_resume_device = res;
989 mutex_unlock(&pm_mutex);
990 printk(KERN_INFO "PM: Starting manual resume from disk\n");
991 noresume = 0;
992 software_resume();
993 ret = n;
994 out:
995 return ret;
996}
997
998power_attr(resume);
999
1000static ssize_t image_size_show(struct kobject *kobj, struct kobj_attribute *attr,
1001 char *buf)
1002{
1003 return sprintf(buf, "%lu\n", image_size);
1004}
1005
1006static ssize_t image_size_store(struct kobject *kobj, struct kobj_attribute *attr,
1007 const char *buf, size_t n)
1008{
1009 unsigned long size;
1010
1011 if (sscanf(buf, "%lu", &size) == 1) {
1012 image_size = size;
1013 return n;
1014 }
1015
1016 return -EINVAL;
1017}
1018
1019power_attr(image_size);
1020
1021static ssize_t reserved_size_show(struct kobject *kobj,
1022 struct kobj_attribute *attr, char *buf)
1023{
1024 return sprintf(buf, "%lu\n", reserved_size);
1025}
1026
1027static ssize_t reserved_size_store(struct kobject *kobj,
1028 struct kobj_attribute *attr,
1029 const char *buf, size_t n)
1030{
1031 unsigned long size;
1032
1033 if (sscanf(buf, "%lu", &size) == 1) {
1034 reserved_size = size;
1035 return n;
1036 }
1037
1038 return -EINVAL;
1039}
1040
1041power_attr(reserved_size);
1042
1043static struct attribute * g[] = {
1044 &disk_attr.attr,
1045 &resume_attr.attr,
1046 &image_size_attr.attr,
1047 &reserved_size_attr.attr,
1048 NULL,
1049};
1050
1051
1052static struct attribute_group attr_group = {
1053 .attrs = g,
1054};
1055
1056
1057static int __init pm_disk_init(void)
1058{
1059 return sysfs_create_group(power_kobj, &attr_group);
1060}
1061
1062core_initcall(pm_disk_init);
1063
1064
1065static int __init resume_setup(char *str)
1066{
1067 if (noresume)
1068 return 1;
1069
1070 strncpy( resume_file, str, 255 );
1071 return 1;
1072}
1073
1074static int __init resume_offset_setup(char *str)
1075{
1076 unsigned long long offset;
1077
1078 if (noresume)
1079 return 1;
1080
1081 if (sscanf(str, "%llu", &offset) == 1)
1082 swsusp_resume_block = offset;
1083
1084 return 1;
1085}
1086
1087static int __init hibernate_setup(char *str)
1088{
1089 if (!strncmp(str, "noresume", 8))
1090 noresume = 1;
1091 else if (!strncmp(str, "nocompress", 10))
1092 nocompress = 1;
1093 return 1;
1094}
1095
1096static int __init noresume_setup(char *str)
1097{
1098 noresume = 1;
1099 return 1;
1100}
1101
1102static int __init resumewait_setup(char *str)
1103{
1104 resume_wait = 1;
1105 return 1;
1106}
1107
1108static int __init resumedelay_setup(char *str)
1109{
1110 resume_delay = simple_strtoul(str, NULL, 0);
1111 return 1;
1112}
1113
1114__setup("noresume", noresume_setup);
1115__setup("resume_offset=", resume_offset_setup);
1116__setup("resume=", resume_setup);
1117__setup("hibernate=", hibernate_setup);
1118__setup("resumewait", resumewait_setup);
1119__setup("resumedelay=", resumedelay_setup);
1120