diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2005-10-30 18:00:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 20:37:15 -0500 |
commit | 0245b3e787dc3267a915e1f56419e7e9c197e148 (patch) | |
tree | 96a366f2fc732f42d4993dd177982e6b657d83aa | |
parent | 2e32a43efdc8175579cc91e8b620ac331376a437 (diff) |
[PATCH] swsusp: two simplifications
The following patch simplifies the progress meter in disk.c:free_some_memory()
and makes disk.c:pm_suspend_disk() call device_resume() explicitly in the
suspend path.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | kernel/power/disk.c | 8 | ||||
-rw-r--r-- | kernel/power/swsusp.c | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 44ef5e799df0..027322a564f4 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -92,10 +92,7 @@ static void free_some_memory(void) | |||
92 | printk("Freeing memory... "); | 92 | printk("Freeing memory... "); |
93 | while ((tmp = shrink_all_memory(10000))) { | 93 | while ((tmp = shrink_all_memory(10000))) { |
94 | pages += tmp; | 94 | pages += tmp; |
95 | printk("\b%c", p[i]); | 95 | printk("\b%c", p[i++ % 4]); |
96 | i++; | ||
97 | if (i > 3) | ||
98 | i = 0; | ||
99 | } | 96 | } |
100 | printk("\bdone (%li pages freed)\n", pages); | 97 | printk("\bdone (%li pages freed)\n", pages); |
101 | } | 98 | } |
@@ -177,13 +174,12 @@ int pm_suspend_disk(void) | |||
177 | goto Done; | 174 | goto Done; |
178 | 175 | ||
179 | if (in_suspend) { | 176 | if (in_suspend) { |
177 | device_resume(); | ||
180 | pr_debug("PM: writing image.\n"); | 178 | pr_debug("PM: writing image.\n"); |
181 | error = swsusp_write(); | 179 | error = swsusp_write(); |
182 | if (!error) | 180 | if (!error) |
183 | power_down(pm_disk_mode); | 181 | power_down(pm_disk_mode); |
184 | else { | 182 | else { |
185 | /* swsusp_write can not fail in device_resume, | ||
186 | no need to do second device_resume */ | ||
187 | swsusp_free(); | 183 | swsusp_free(); |
188 | unprepare_processes(); | 184 | unprepare_processes(); |
189 | return error; | 185 | return error; |
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index ae8425b69b44..12db1d2ad61f 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
@@ -562,7 +562,7 @@ int enough_swap(unsigned nr_pages) | |||
562 | int swsusp_write(void) | 562 | int swsusp_write(void) |
563 | { | 563 | { |
564 | int error; | 564 | int error; |
565 | device_resume(); | 565 | |
566 | lock_swapdevices(); | 566 | lock_swapdevices(); |
567 | error = write_suspend_image(); | 567 | error = write_suspend_image(); |
568 | /* This will unlock ignored swap devices since writing is finished */ | 568 | /* This will unlock ignored swap devices since writing is finished */ |