diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-02-23 18:26:15 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-02-27 09:10:20 -0500 |
commit | 2872de1382a7c888fa69532eda25aa7342dfe748 (patch) | |
tree | da854285db31502b6a4472b818283fdb26ed098a | |
parent | 81d45bdf89135cd26dc7535c14a45db6cdd647fa (diff) |
PM / hibernate: Define pr_fmt() and use pr_*() instead of printk()
Define a pr_fmt() for hibernate.c and convert all of the explicit
printk() calls into corresponding pr_*() so that they use the
pr_fmt() format.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | kernel/power/hibernate.c | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index f251b4d32913..8951d0d04810 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * This file is released under the GPLv2. | 10 | * This file is released under the GPLv2. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) "PM: " fmt | ||
14 | |||
13 | #include <linux/export.h> | 15 | #include <linux/export.h> |
14 | #include <linux/suspend.h> | 16 | #include <linux/suspend.h> |
15 | #include <linux/syscalls.h> | 17 | #include <linux/syscalls.h> |
@@ -104,7 +106,7 @@ EXPORT_SYMBOL(system_entering_hibernation); | |||
104 | #ifdef CONFIG_PM_DEBUG | 106 | #ifdef CONFIG_PM_DEBUG |
105 | static void hibernation_debug_sleep(void) | 107 | static void hibernation_debug_sleep(void) |
106 | { | 108 | { |
107 | printk(KERN_INFO "hibernation debug: Waiting for 5 seconds.\n"); | 109 | pr_info("hibernation debug: Waiting for 5 seconds.\n"); |
108 | mdelay(5000); | 110 | mdelay(5000); |
109 | } | 111 | } |
110 | 112 | ||
@@ -250,10 +252,9 @@ void swsusp_show_speed(ktime_t start, ktime_t stop, | |||
250 | centisecs = 1; /* avoid div-by-zero */ | 252 | centisecs = 1; /* avoid div-by-zero */ |
251 | k = nr_pages * (PAGE_SIZE / 1024); | 253 | k = nr_pages * (PAGE_SIZE / 1024); |
252 | kps = (k * 100) / centisecs; | 254 | kps = (k * 100) / centisecs; |
253 | printk(KERN_INFO "PM: %s %u kbytes in %u.%02u seconds (%u.%02u MB/s)\n", | 255 | pr_info("%s %u kbytes in %u.%02u seconds (%u.%02u MB/s)\n", |
254 | msg, k, | 256 | msg, k, centisecs / 100, centisecs % 100, kps / 1000, |
255 | centisecs / 100, centisecs % 100, | 257 | (kps % 1000) / 10); |
256 | kps / 1000, (kps % 1000) / 10); | ||
257 | } | 258 | } |
258 | 259 | ||
259 | /** | 260 | /** |
@@ -271,8 +272,7 @@ static int create_image(int platform_mode) | |||
271 | 272 | ||
272 | error = dpm_suspend_end(PMSG_FREEZE); | 273 | error = dpm_suspend_end(PMSG_FREEZE); |
273 | if (error) { | 274 | if (error) { |
274 | printk(KERN_ERR "PM: Some devices failed to power down, " | 275 | pr_err("Some devices failed to power down, aborting hibernation\n"); |
275 | "aborting hibernation\n"); | ||
276 | return error; | 276 | return error; |
277 | } | 277 | } |
278 | 278 | ||
@@ -288,8 +288,7 @@ static int create_image(int platform_mode) | |||
288 | 288 | ||
289 | error = syscore_suspend(); | 289 | error = syscore_suspend(); |
290 | if (error) { | 290 | if (error) { |
291 | printk(KERN_ERR "PM: Some system devices failed to power down, " | 291 | pr_err("Some system devices failed to power down, aborting hibernation\n"); |
292 | "aborting hibernation\n"); | ||
293 | goto Enable_irqs; | 292 | goto Enable_irqs; |
294 | } | 293 | } |
295 | 294 | ||
@@ -304,8 +303,8 @@ static int create_image(int platform_mode) | |||
304 | restore_processor_state(); | 303 | restore_processor_state(); |
305 | trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, false); | 304 | trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, false); |
306 | if (error) | 305 | if (error) |
307 | printk(KERN_ERR "PM: Error %d creating hibernation image\n", | 306 | pr_err("Error %d creating hibernation image\n", error); |
308 | error); | 307 | |
309 | if (!in_suspend) { | 308 | if (!in_suspend) { |
310 | events_check_enabled = false; | 309 | events_check_enabled = false; |
311 | clear_free_pages(); | 310 | clear_free_pages(); |
@@ -432,8 +431,7 @@ static int resume_target_kernel(bool platform_mode) | |||
432 | 431 | ||
433 | error = dpm_suspend_end(PMSG_QUIESCE); | 432 | error = dpm_suspend_end(PMSG_QUIESCE); |
434 | if (error) { | 433 | if (error) { |
435 | printk(KERN_ERR "PM: Some devices failed to power down, " | 434 | pr_err("Some devices failed to power down, aborting resume\n"); |
436 | "aborting resume\n"); | ||
437 | return error; | 435 | return error; |
438 | } | 436 | } |
439 | 437 | ||
@@ -619,7 +617,7 @@ static void power_down(void) | |||
619 | /* Restore swap signature. */ | 617 | /* Restore swap signature. */ |
620 | error = swsusp_unmark(); | 618 | error = swsusp_unmark(); |
621 | if (error) | 619 | if (error) |
622 | pr_err("PM: Swap will be unusable! Try swapon -a.\n"); | 620 | pr_err("Swap will be unusable! Try swapon -a.\n"); |
623 | 621 | ||
624 | return; | 622 | return; |
625 | } | 623 | } |
@@ -642,7 +640,7 @@ static void power_down(void) | |||
642 | * Valid image is on the disk, if we continue we risk serious data | 640 | * Valid image is on the disk, if we continue we risk serious data |
643 | * corruption after resume. | 641 | * corruption after resume. |
644 | */ | 642 | */ |
645 | printk(KERN_CRIT "PM: Please power down manually\n"); | 643 | pr_crit("Power down manually\n"); |
646 | while (1) | 644 | while (1) |
647 | cpu_relax(); | 645 | cpu_relax(); |
648 | } | 646 | } |
@@ -652,7 +650,7 @@ static int load_image_and_restore(void) | |||
652 | int error; | 650 | int error; |
653 | unsigned int flags; | 651 | unsigned int flags; |
654 | 652 | ||
655 | pr_debug("PM: Loading hibernation image.\n"); | 653 | pr_debug("Loading hibernation image.\n"); |
656 | 654 | ||
657 | lock_device_hotplug(); | 655 | lock_device_hotplug(); |
658 | error = create_basic_memory_bitmaps(); | 656 | error = create_basic_memory_bitmaps(); |
@@ -664,7 +662,7 @@ static int load_image_and_restore(void) | |||
664 | if (!error) | 662 | if (!error) |
665 | hibernation_restore(flags & SF_PLATFORM_MODE); | 663 | hibernation_restore(flags & SF_PLATFORM_MODE); |
666 | 664 | ||
667 | printk(KERN_ERR "PM: Failed to load hibernation image, recovering.\n"); | 665 | pr_err("Failed to load hibernation image, recovering.\n"); |
668 | swsusp_free(); | 666 | swsusp_free(); |
669 | free_basic_memory_bitmaps(); | 667 | free_basic_memory_bitmaps(); |
670 | Unlock: | 668 | Unlock: |
@@ -682,7 +680,7 @@ int hibernate(void) | |||
682 | bool snapshot_test = false; | 680 | bool snapshot_test = false; |
683 | 681 | ||
684 | if (!hibernation_available()) { | 682 | if (!hibernation_available()) { |
685 | pr_debug("PM: Hibernation not available.\n"); | 683 | pr_debug("Hibernation not available.\n"); |
686 | return -EPERM; | 684 | return -EPERM; |
687 | } | 685 | } |
688 | 686 | ||
@@ -700,9 +698,9 @@ int hibernate(void) | |||
700 | goto Exit; | 698 | goto Exit; |
701 | } | 699 | } |
702 | 700 | ||
703 | printk(KERN_INFO "PM: Syncing filesystems ... "); | 701 | pr_info("Syncing filesystems ... \n"); |
704 | sys_sync(); | 702 | sys_sync(); |
705 | printk("done.\n"); | 703 | pr_info("done.\n"); |
706 | 704 | ||
707 | error = freeze_processes(); | 705 | error = freeze_processes(); |
708 | if (error) | 706 | if (error) |
@@ -728,7 +726,7 @@ int hibernate(void) | |||
728 | else | 726 | else |
729 | flags |= SF_CRC32_MODE; | 727 | flags |= SF_CRC32_MODE; |
730 | 728 | ||
731 | pr_debug("PM: writing image.\n"); | 729 | pr_debug("Writing image.\n"); |
732 | error = swsusp_write(flags); | 730 | error = swsusp_write(flags); |
733 | swsusp_free(); | 731 | swsusp_free(); |
734 | if (!error) { | 732 | if (!error) { |
@@ -740,7 +738,7 @@ int hibernate(void) | |||
740 | in_suspend = 0; | 738 | in_suspend = 0; |
741 | pm_restore_gfp_mask(); | 739 | pm_restore_gfp_mask(); |
742 | } else { | 740 | } else { |
743 | pr_debug("PM: Image restored successfully.\n"); | 741 | pr_debug("Image restored successfully.\n"); |
744 | } | 742 | } |
745 | 743 | ||
746 | Free_bitmaps: | 744 | Free_bitmaps: |
@@ -748,7 +746,7 @@ int hibernate(void) | |||
748 | Thaw: | 746 | Thaw: |
749 | unlock_device_hotplug(); | 747 | unlock_device_hotplug(); |
750 | if (snapshot_test) { | 748 | if (snapshot_test) { |
751 | pr_debug("PM: Checking hibernation image\n"); | 749 | pr_debug("Checking hibernation image\n"); |
752 | error = swsusp_check(); | 750 | error = swsusp_check(); |
753 | if (!error) | 751 | if (!error) |
754 | error = load_image_and_restore(); | 752 | error = load_image_and_restore(); |
@@ -812,10 +810,10 @@ static int software_resume(void) | |||
812 | goto Unlock; | 810 | goto Unlock; |
813 | } | 811 | } |
814 | 812 | ||
815 | pr_debug("PM: Checking hibernation image partition %s\n", resume_file); | 813 | pr_debug("Checking hibernation image partition %s\n", resume_file); |
816 | 814 | ||
817 | if (resume_delay) { | 815 | if (resume_delay) { |
818 | printk(KERN_INFO "Waiting %dsec before reading resume device...\n", | 816 | pr_info("Waiting %dsec before reading resume device ...\n", |
819 | resume_delay); | 817 | resume_delay); |
820 | ssleep(resume_delay); | 818 | ssleep(resume_delay); |
821 | } | 819 | } |
@@ -854,10 +852,10 @@ static int software_resume(void) | |||
854 | } | 852 | } |
855 | 853 | ||
856 | Check_image: | 854 | Check_image: |
857 | pr_debug("PM: Hibernation image partition %d:%d present\n", | 855 | pr_debug("Hibernation image partition %d:%d present\n", |
858 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); | 856 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); |
859 | 857 | ||
860 | pr_debug("PM: Looking for hibernation image.\n"); | 858 | pr_debug("Looking for hibernation image.\n"); |
861 | error = swsusp_check(); | 859 | error = swsusp_check(); |
862 | if (error) | 860 | if (error) |
863 | goto Unlock; | 861 | goto Unlock; |
@@ -876,7 +874,7 @@ static int software_resume(void) | |||
876 | goto Close_Finish; | 874 | goto Close_Finish; |
877 | } | 875 | } |
878 | 876 | ||
879 | pr_debug("PM: Preparing processes for restore.\n"); | 877 | pr_debug("Preparing processes for restore.\n"); |
880 | error = freeze_processes(); | 878 | error = freeze_processes(); |
881 | if (error) | 879 | if (error) |
882 | goto Close_Finish; | 880 | goto Close_Finish; |
@@ -889,7 +887,7 @@ static int software_resume(void) | |||
889 | /* For success case, the suspend path will release the lock */ | 887 | /* For success case, the suspend path will release the lock */ |
890 | Unlock: | 888 | Unlock: |
891 | mutex_unlock(&pm_mutex); | 889 | mutex_unlock(&pm_mutex); |
892 | pr_debug("PM: Hibernation image not present or could not be loaded.\n"); | 890 | pr_debug("Hibernation image not present or could not be loaded.\n"); |
893 | return error; | 891 | return error; |
894 | Close_Finish: | 892 | Close_Finish: |
895 | swsusp_close(FMODE_READ); | 893 | swsusp_close(FMODE_READ); |
@@ -1013,7 +1011,7 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
1013 | error = -EINVAL; | 1011 | error = -EINVAL; |
1014 | 1012 | ||
1015 | if (!error) | 1013 | if (!error) |
1016 | pr_debug("PM: Hibernation mode set to '%s'\n", | 1014 | pr_debug("Hibernation mode set to '%s'\n", |
1017 | hibernation_modes[mode]); | 1015 | hibernation_modes[mode]); |
1018 | unlock_system_sleep(); | 1016 | unlock_system_sleep(); |
1019 | return error ? error : n; | 1017 | return error ? error : n; |
@@ -1049,7 +1047,7 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
1049 | lock_system_sleep(); | 1047 | lock_system_sleep(); |
1050 | swsusp_resume_device = res; | 1048 | swsusp_resume_device = res; |
1051 | unlock_system_sleep(); | 1049 | unlock_system_sleep(); |
1052 | printk(KERN_INFO "PM: Starting manual resume from disk\n"); | 1050 | pr_info("Starting manual resume from disk\n"); |
1053 | noresume = 0; | 1051 | noresume = 0; |
1054 | software_resume(); | 1052 | software_resume(); |
1055 | return n; | 1053 | return n; |