diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-22 16:36:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-22 16:36:52 -0400 |
commit | 7100e505b76b4e2efd88b2459d1a932214e29f8a (patch) | |
tree | a8eae8687dc1511c89463b1eb93c8349a7471ab3 /kernel/power/swap.c | |
parent | cb47c1831fa406c964468b259f2082c16cc3f757 (diff) | |
parent | 75a4161a58dd157a2bd2dc8e9986e45b62ac46cf (diff) |
Merge tag 'pm-for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management updates from Rafael Wysocki:
- ACPI conversion to PM handling based on struct dev_pm_ops.
- Conversion of a number of platform drivers to PM handling based on
struct dev_pm_ops and removal of empty legacy PM callbacks from a
couple of PCI drivers.
- Suspend-to-both for in-kernel hibernation from Bojan Smojver.
- cpuidle fixes and cleanups from ShuoX Liu, Daniel Lezcano and Preeti
Murthy.
- cpufreq bug fixes from Jonghwa Lee and Stephen Boyd.
- Suspend and hibernate fixes from Srivatsa Bhat and Colin Cross.
- Generic PM domains framework updates.
- RTC CMOS wakeup signaling update from Paul Fox.
- sparse warnings fixes from Sachin Kamat.
- Build warnings fixes for the generic PM domains framework and PM
sysfs code.
- sysfs switch for printing device suspend times from Sameer Nanda.
- Documentation fix from Oskar Schirmer.
* tag 'pm-for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (70 commits)
cpufreq: Fix sysfs deadlock with concurrent hotplug/frequency switch
EXYNOS: bugfix on retrieving old_index from freqs.old
PM / Sleep: call early resume handlers when suspend_noirq fails
PM / QoS: Use NULL pointer instead of plain integer in qos.c
PM / QoS: Use NULL pointer instead of plain integer in pm_qos.h
PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock
PM / Sleep: Add missing static storage class specifiers in main.c
cpuilde / ACPI: remove time from acpi_processor_cx structure
cpuidle / ACPI: remove usage from acpi_processor_cx structure
cpuidle / ACPI : remove latency_ticks from acpi_processor_cx structure
rtc-cmos: report wakeups from interrupt handler
PM / Sleep: Fix build warning in sysfs.c for CONFIG_PM_SLEEP unset
PM / Domains: Fix build warning for CONFIG_PM_RUNTIME unset
olpc-xo15-sci: Use struct dev_pm_ops for power management
PM / Domains: Replace plain integer with NULL pointer in domain.c file
PM / Domains: Add missing static storage class specifier in domain.c file
PM / crypto / ux500: Use struct dev_pm_ops for power management
PM / IPMI: Remove empty legacy PCI PM callbacks
tpm_nsc: Use struct dev_pm_ops for power management
tpm_tis: Use struct dev_pm_ops for power management
...
Diffstat (limited to 'kernel/power/swap.c')
-rw-r--r-- | kernel/power/swap.c | 82 |
1 files changed, 55 insertions, 27 deletions
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 11e22c068e8b..3c9d764eb0d8 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -448,9 +448,9 @@ static int save_image(struct swap_map_handle *handle, | |||
448 | struct timeval start; | 448 | struct timeval start; |
449 | struct timeval stop; | 449 | struct timeval stop; |
450 | 450 | ||
451 | printk(KERN_INFO "PM: Saving image data pages (%u pages) ... ", | 451 | printk(KERN_INFO "PM: Saving image data pages (%u pages)...\n", |
452 | nr_to_write); | 452 | nr_to_write); |
453 | m = nr_to_write / 100; | 453 | m = nr_to_write / 10; |
454 | if (!m) | 454 | if (!m) |
455 | m = 1; | 455 | m = 1; |
456 | nr_pages = 0; | 456 | nr_pages = 0; |
@@ -464,7 +464,8 @@ static int save_image(struct swap_map_handle *handle, | |||
464 | if (ret) | 464 | if (ret) |
465 | break; | 465 | break; |
466 | if (!(nr_pages % m)) | 466 | if (!(nr_pages % m)) |
467 | printk(KERN_CONT "\b\b\b\b%3d%%", nr_pages / m); | 467 | printk(KERN_INFO "PM: Image saving progress: %3d%%\n", |
468 | nr_pages / m * 10); | ||
468 | nr_pages++; | 469 | nr_pages++; |
469 | } | 470 | } |
470 | err2 = hib_wait_on_bio_chain(&bio); | 471 | err2 = hib_wait_on_bio_chain(&bio); |
@@ -472,9 +473,7 @@ static int save_image(struct swap_map_handle *handle, | |||
472 | if (!ret) | 473 | if (!ret) |
473 | ret = err2; | 474 | ret = err2; |
474 | if (!ret) | 475 | if (!ret) |
475 | printk(KERN_CONT "\b\b\b\bdone\n"); | 476 | printk(KERN_INFO "PM: Image saving done.\n"); |
476 | else | ||
477 | printk(KERN_CONT "\n"); | ||
478 | swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); | 477 | swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); |
479 | return ret; | 478 | return ret; |
480 | } | 479 | } |
@@ -668,9 +667,9 @@ static int save_image_lzo(struct swap_map_handle *handle, | |||
668 | 667 | ||
669 | printk(KERN_INFO | 668 | printk(KERN_INFO |
670 | "PM: Using %u thread(s) for compression.\n" | 669 | "PM: Using %u thread(s) for compression.\n" |
671 | "PM: Compressing and saving image data (%u pages) ... ", | 670 | "PM: Compressing and saving image data (%u pages)...\n", |
672 | nr_threads, nr_to_write); | 671 | nr_threads, nr_to_write); |
673 | m = nr_to_write / 100; | 672 | m = nr_to_write / 10; |
674 | if (!m) | 673 | if (!m) |
675 | m = 1; | 674 | m = 1; |
676 | nr_pages = 0; | 675 | nr_pages = 0; |
@@ -690,8 +689,10 @@ static int save_image_lzo(struct swap_map_handle *handle, | |||
690 | data_of(*snapshot), PAGE_SIZE); | 689 | data_of(*snapshot), PAGE_SIZE); |
691 | 690 | ||
692 | if (!(nr_pages % m)) | 691 | if (!(nr_pages % m)) |
693 | printk(KERN_CONT "\b\b\b\b%3d%%", | 692 | printk(KERN_INFO |
694 | nr_pages / m); | 693 | "PM: Image saving progress: " |
694 | "%3d%%\n", | ||
695 | nr_pages / m * 10); | ||
695 | nr_pages++; | 696 | nr_pages++; |
696 | } | 697 | } |
697 | if (!off) | 698 | if (!off) |
@@ -761,11 +762,8 @@ out_finish: | |||
761 | do_gettimeofday(&stop); | 762 | do_gettimeofday(&stop); |
762 | if (!ret) | 763 | if (!ret) |
763 | ret = err2; | 764 | ret = err2; |
764 | if (!ret) { | 765 | if (!ret) |
765 | printk(KERN_CONT "\b\b\b\bdone\n"); | 766 | printk(KERN_INFO "PM: Image saving done.\n"); |
766 | } else { | ||
767 | printk(KERN_CONT "\n"); | ||
768 | } | ||
769 | swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); | 767 | swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); |
770 | out_clean: | 768 | out_clean: |
771 | if (crc) { | 769 | if (crc) { |
@@ -973,9 +971,9 @@ static int load_image(struct swap_map_handle *handle, | |||
973 | int err2; | 971 | int err2; |
974 | unsigned nr_pages; | 972 | unsigned nr_pages; |
975 | 973 | ||
976 | printk(KERN_INFO "PM: Loading image data pages (%u pages) ... ", | 974 | printk(KERN_INFO "PM: Loading image data pages (%u pages)...\n", |
977 | nr_to_read); | 975 | nr_to_read); |
978 | m = nr_to_read / 100; | 976 | m = nr_to_read / 10; |
979 | if (!m) | 977 | if (!m) |
980 | m = 1; | 978 | m = 1; |
981 | nr_pages = 0; | 979 | nr_pages = 0; |
@@ -993,7 +991,8 @@ static int load_image(struct swap_map_handle *handle, | |||
993 | if (ret) | 991 | if (ret) |
994 | break; | 992 | break; |
995 | if (!(nr_pages % m)) | 993 | if (!(nr_pages % m)) |
996 | printk("\b\b\b\b%3d%%", nr_pages / m); | 994 | printk(KERN_INFO "PM: Image loading progress: %3d%%\n", |
995 | nr_pages / m * 10); | ||
997 | nr_pages++; | 996 | nr_pages++; |
998 | } | 997 | } |
999 | err2 = hib_wait_on_bio_chain(&bio); | 998 | err2 = hib_wait_on_bio_chain(&bio); |
@@ -1001,12 +1000,11 @@ static int load_image(struct swap_map_handle *handle, | |||
1001 | if (!ret) | 1000 | if (!ret) |
1002 | ret = err2; | 1001 | ret = err2; |
1003 | if (!ret) { | 1002 | if (!ret) { |
1004 | printk("\b\b\b\bdone\n"); | 1003 | printk(KERN_INFO "PM: Image loading done.\n"); |
1005 | snapshot_write_finalize(snapshot); | 1004 | snapshot_write_finalize(snapshot); |
1006 | if (!snapshot_image_loaded(snapshot)) | 1005 | if (!snapshot_image_loaded(snapshot)) |
1007 | ret = -ENODATA; | 1006 | ret = -ENODATA; |
1008 | } else | 1007 | } |
1009 | printk("\n"); | ||
1010 | swsusp_show_speed(&start, &stop, nr_to_read, "Read"); | 1008 | swsusp_show_speed(&start, &stop, nr_to_read, "Read"); |
1011 | return ret; | 1009 | return ret; |
1012 | } | 1010 | } |
@@ -1185,9 +1183,9 @@ static int load_image_lzo(struct swap_map_handle *handle, | |||
1185 | 1183 | ||
1186 | printk(KERN_INFO | 1184 | printk(KERN_INFO |
1187 | "PM: Using %u thread(s) for decompression.\n" | 1185 | "PM: Using %u thread(s) for decompression.\n" |
1188 | "PM: Loading and decompressing image data (%u pages) ... ", | 1186 | "PM: Loading and decompressing image data (%u pages)...\n", |
1189 | nr_threads, nr_to_read); | 1187 | nr_threads, nr_to_read); |
1190 | m = nr_to_read / 100; | 1188 | m = nr_to_read / 10; |
1191 | if (!m) | 1189 | if (!m) |
1192 | m = 1; | 1190 | m = 1; |
1193 | nr_pages = 0; | 1191 | nr_pages = 0; |
@@ -1319,7 +1317,10 @@ static int load_image_lzo(struct swap_map_handle *handle, | |||
1319 | data[thr].unc + off, PAGE_SIZE); | 1317 | data[thr].unc + off, PAGE_SIZE); |
1320 | 1318 | ||
1321 | if (!(nr_pages % m)) | 1319 | if (!(nr_pages % m)) |
1322 | printk("\b\b\b\b%3d%%", nr_pages / m); | 1320 | printk(KERN_INFO |
1321 | "PM: Image loading progress: " | ||
1322 | "%3d%%\n", | ||
1323 | nr_pages / m * 10); | ||
1323 | nr_pages++; | 1324 | nr_pages++; |
1324 | 1325 | ||
1325 | ret = snapshot_write_next(snapshot); | 1326 | ret = snapshot_write_next(snapshot); |
@@ -1344,7 +1345,7 @@ out_finish: | |||
1344 | } | 1345 | } |
1345 | do_gettimeofday(&stop); | 1346 | do_gettimeofday(&stop); |
1346 | if (!ret) { | 1347 | if (!ret) { |
1347 | printk("\b\b\b\bdone\n"); | 1348 | printk(KERN_INFO "PM: Image loading done.\n"); |
1348 | snapshot_write_finalize(snapshot); | 1349 | snapshot_write_finalize(snapshot); |
1349 | if (!snapshot_image_loaded(snapshot)) | 1350 | if (!snapshot_image_loaded(snapshot)) |
1350 | ret = -ENODATA; | 1351 | ret = -ENODATA; |
@@ -1357,8 +1358,7 @@ out_finish: | |||
1357 | } | 1358 | } |
1358 | } | 1359 | } |
1359 | } | 1360 | } |
1360 | } else | 1361 | } |
1361 | printk("\n"); | ||
1362 | swsusp_show_speed(&start, &stop, nr_to_read, "Read"); | 1362 | swsusp_show_speed(&start, &stop, nr_to_read, "Read"); |
1363 | out_clean: | 1363 | out_clean: |
1364 | for (i = 0; i < ring_size; i++) | 1364 | for (i = 0; i < ring_size; i++) |
@@ -1472,6 +1472,34 @@ void swsusp_close(fmode_t mode) | |||
1472 | blkdev_put(hib_resume_bdev, mode); | 1472 | blkdev_put(hib_resume_bdev, mode); |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | /** | ||
1476 | * swsusp_unmark - Unmark swsusp signature in the resume device | ||
1477 | */ | ||
1478 | |||
1479 | #ifdef CONFIG_SUSPEND | ||
1480 | int swsusp_unmark(void) | ||
1481 | { | ||
1482 | int error; | ||
1483 | |||
1484 | hib_bio_read_page(swsusp_resume_block, swsusp_header, NULL); | ||
1485 | if (!memcmp(HIBERNATE_SIG,swsusp_header->sig, 10)) { | ||
1486 | memcpy(swsusp_header->sig,swsusp_header->orig_sig, 10); | ||
1487 | error = hib_bio_write_page(swsusp_resume_block, | ||
1488 | swsusp_header, NULL); | ||
1489 | } else { | ||
1490 | printk(KERN_ERR "PM: Cannot find swsusp signature!\n"); | ||
1491 | error = -ENODEV; | ||
1492 | } | ||
1493 | |||
1494 | /* | ||
1495 | * We just returned from suspend, we don't need the image any more. | ||
1496 | */ | ||
1497 | free_all_swap_pages(root_swap); | ||
1498 | |||
1499 | return error; | ||
1500 | } | ||
1501 | #endif | ||
1502 | |||
1475 | static int swsusp_header_init(void) | 1503 | static int swsusp_header_init(void) |
1476 | { | 1504 | { |
1477 | swsusp_header = (struct swsusp_header*) __get_free_page(GFP_KERNEL); | 1505 | swsusp_header = (struct swsusp_header*) __get_free_page(GFP_KERNEL); |