Skip to content

Commit

Permalink
[PATCH] swsusp: two simplifications
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rjwysocki authored and Linus Torvalds committed Oct 31, 2005
1 parent 2e32a43 commit 0245b3e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions kernel/power/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ static void free_some_memory(void)
printk("Freeing memory... ");
while ((tmp = shrink_all_memory(10000))) {
pages += tmp;
printk("\b%c", p[i]);
i++;
if (i > 3)
i = 0;
printk("\b%c", p[i++ % 4]);
}
printk("\bdone (%li pages freed)\n", pages);
}
Expand Down Expand Up @@ -177,13 +174,12 @@ int pm_suspend_disk(void)
goto Done;

if (in_suspend) {
device_resume();
pr_debug("PM: writing image.\n");
error = swsusp_write();
if (!error)
power_down(pm_disk_mode);
else {
/* swsusp_write can not fail in device_resume,
no need to do second device_resume */
swsusp_free();
unprepare_processes();
return error;
Expand Down
2 changes: 1 addition & 1 deletion kernel/power/swsusp.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ int enough_swap(unsigned nr_pages)
int swsusp_write(void)
{
int error;
device_resume();

lock_swapdevices();
error = write_suspend_image();
/* This will unlock ignored swap devices since writing is finished */
Expand Down

0 comments on commit 0245b3e

Please sign in to comment.