diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/hibernate.c | 2 | ||||
-rw-r--r-- | kernel/power/process.c | 2 | ||||
-rw-r--r-- | kernel/power/snapshot.c | 11 | ||||
-rw-r--r-- | kernel/power/suspend.c | 35 |
4 files changed, 36 insertions, 14 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index a8b978c35a6a..e1914c7b85b1 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -1108,7 +1108,7 @@ static struct attribute * g[] = { | |||
1108 | }; | 1108 | }; |
1109 | 1109 | ||
1110 | 1110 | ||
1111 | static struct attribute_group attr_group = { | 1111 | static const struct attribute_group attr_group = { |
1112 | .attrs = g, | 1112 | .attrs = g, |
1113 | }; | 1113 | }; |
1114 | 1114 | ||
diff --git a/kernel/power/process.c b/kernel/power/process.c index c7209f060eeb..78672d324a6e 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -132,7 +132,7 @@ int freeze_processes(void) | |||
132 | if (!pm_freezing) | 132 | if (!pm_freezing) |
133 | atomic_inc(&system_freezing_cnt); | 133 | atomic_inc(&system_freezing_cnt); |
134 | 134 | ||
135 | pm_wakeup_clear(); | 135 | pm_wakeup_clear(true); |
136 | pr_info("Freezing user space processes ... "); | 136 | pr_info("Freezing user space processes ... "); |
137 | pm_freezing = true; | 137 | pm_freezing = true; |
138 | error = try_to_freeze_tasks(true); | 138 | error = try_to_freeze_tasks(true); |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index fa46606f3356..b7708e319941 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -36,13 +36,13 @@ | |||
36 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
37 | #include <asm/tlbflush.h> | 37 | #include <asm/tlbflush.h> |
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #ifdef CONFIG_STRICT_KERNEL_RWX | 39 | #ifdef CONFIG_ARCH_HAS_SET_MEMORY |
40 | #include <asm/set_memory.h> | 40 | #include <asm/set_memory.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #include "power.h" | 43 | #include "power.h" |
44 | 44 | ||
45 | #ifdef CONFIG_STRICT_KERNEL_RWX | 45 | #if defined(CONFIG_STRICT_KERNEL_RWX) && defined(CONFIG_ARCH_HAS_SET_MEMORY) |
46 | static bool hibernate_restore_protection; | 46 | static bool hibernate_restore_protection; |
47 | static bool hibernate_restore_protection_active; | 47 | static bool hibernate_restore_protection_active; |
48 | 48 | ||
@@ -77,7 +77,7 @@ static inline void hibernate_restore_protection_begin(void) {} | |||
77 | static inline void hibernate_restore_protection_end(void) {} | 77 | static inline void hibernate_restore_protection_end(void) {} |
78 | static inline void hibernate_restore_protect_page(void *page_address) {} | 78 | static inline void hibernate_restore_protect_page(void *page_address) {} |
79 | static inline void hibernate_restore_unprotect_page(void *page_address) {} | 79 | static inline void hibernate_restore_unprotect_page(void *page_address) {} |
80 | #endif /* CONFIG_STRICT_KERNEL_RWX */ | 80 | #endif /* CONFIG_STRICT_KERNEL_RWX && CONFIG_ARCH_HAS_SET_MEMORY */ |
81 | 81 | ||
82 | static int swsusp_page_is_free(struct page *); | 82 | static int swsusp_page_is_free(struct page *); |
83 | static void swsusp_set_page_forbidden(struct page *); | 83 | static void swsusp_set_page_forbidden(struct page *); |
@@ -1929,8 +1929,7 @@ static inline unsigned int alloc_highmem_pages(struct memory_bitmap *bm, | |||
1929 | * also be located in the high memory, because of the way in which | 1929 | * also be located in the high memory, because of the way in which |
1930 | * copy_data_pages() works. | 1930 | * copy_data_pages() works. |
1931 | */ | 1931 | */ |
1932 | static int swsusp_alloc(struct memory_bitmap *orig_bm, | 1932 | static int swsusp_alloc(struct memory_bitmap *copy_bm, |
1933 | struct memory_bitmap *copy_bm, | ||
1934 | unsigned int nr_pages, unsigned int nr_highmem) | 1933 | unsigned int nr_pages, unsigned int nr_highmem) |
1935 | { | 1934 | { |
1936 | if (nr_highmem > 0) { | 1935 | if (nr_highmem > 0) { |
@@ -1976,7 +1975,7 @@ asmlinkage __visible int swsusp_save(void) | |||
1976 | return -ENOMEM; | 1975 | return -ENOMEM; |
1977 | } | 1976 | } |
1978 | 1977 | ||
1979 | if (swsusp_alloc(&orig_bm, ©_bm, nr_pages, nr_highmem)) { | 1978 | if (swsusp_alloc(©_bm, nr_pages, nr_highmem)) { |
1980 | printk(KERN_ERR "PM: Memory allocation failed\n"); | 1979 | printk(KERN_ERR "PM: Memory allocation failed\n"); |
1981 | return -ENOMEM; | 1980 | return -ENOMEM; |
1982 | } | 1981 | } |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 15e6baef5c73..3ecf275d7e44 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -72,6 +72,8 @@ static void freeze_begin(void) | |||
72 | 72 | ||
73 | static void freeze_enter(void) | 73 | static void freeze_enter(void) |
74 | { | 74 | { |
75 | trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_FREEZE, true); | ||
76 | |||
75 | spin_lock_irq(&suspend_freeze_lock); | 77 | spin_lock_irq(&suspend_freeze_lock); |
76 | if (pm_wakeup_pending()) | 78 | if (pm_wakeup_pending()) |
77 | goto out; | 79 | goto out; |
@@ -84,11 +86,9 @@ static void freeze_enter(void) | |||
84 | 86 | ||
85 | /* Push all the CPUs into the idle loop. */ | 87 | /* Push all the CPUs into the idle loop. */ |
86 | wake_up_all_idle_cpus(); | 88 | wake_up_all_idle_cpus(); |
87 | pr_debug("PM: suspend-to-idle\n"); | ||
88 | /* Make the current CPU wait so it can enter the idle loop too. */ | 89 | /* Make the current CPU wait so it can enter the idle loop too. */ |
89 | wait_event(suspend_freeze_wait_head, | 90 | wait_event(suspend_freeze_wait_head, |
90 | suspend_freeze_state == FREEZE_STATE_WAKE); | 91 | suspend_freeze_state == FREEZE_STATE_WAKE); |
91 | pr_debug("PM: resume from suspend-to-idle\n"); | ||
92 | 92 | ||
93 | cpuidle_pause(); | 93 | cpuidle_pause(); |
94 | put_online_cpus(); | 94 | put_online_cpus(); |
@@ -98,6 +98,31 @@ static void freeze_enter(void) | |||
98 | out: | 98 | out: |
99 | suspend_freeze_state = FREEZE_STATE_NONE; | 99 | suspend_freeze_state = FREEZE_STATE_NONE; |
100 | spin_unlock_irq(&suspend_freeze_lock); | 100 | spin_unlock_irq(&suspend_freeze_lock); |
101 | |||
102 | trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_FREEZE, false); | ||
103 | } | ||
104 | |||
105 | static void s2idle_loop(void) | ||
106 | { | ||
107 | pr_debug("PM: suspend-to-idle\n"); | ||
108 | |||
109 | do { | ||
110 | freeze_enter(); | ||
111 | |||
112 | if (freeze_ops && freeze_ops->wake) | ||
113 | freeze_ops->wake(); | ||
114 | |||
115 | dpm_resume_noirq(PMSG_RESUME); | ||
116 | if (freeze_ops && freeze_ops->sync) | ||
117 | freeze_ops->sync(); | ||
118 | |||
119 | if (pm_wakeup_pending()) | ||
120 | break; | ||
121 | |||
122 | pm_wakeup_clear(false); | ||
123 | } while (!dpm_suspend_noirq(PMSG_SUSPEND)); | ||
124 | |||
125 | pr_debug("PM: resume from suspend-to-idle\n"); | ||
101 | } | 126 | } |
102 | 127 | ||
103 | void freeze_wake(void) | 128 | void freeze_wake(void) |
@@ -371,10 +396,8 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) | |||
371 | * all the devices are suspended. | 396 | * all the devices are suspended. |
372 | */ | 397 | */ |
373 | if (state == PM_SUSPEND_FREEZE) { | 398 | if (state == PM_SUSPEND_FREEZE) { |
374 | trace_suspend_resume(TPS("machine_suspend"), state, true); | 399 | s2idle_loop(); |
375 | freeze_enter(); | 400 | goto Platform_early_resume; |
376 | trace_suspend_resume(TPS("machine_suspend"), state, false); | ||
377 | goto Platform_wake; | ||
378 | } | 401 | } |
379 | 402 | ||
380 | error = disable_nonboot_cpus(); | 403 | error = disable_nonboot_cpus(); |