Commit 2e4d5822 authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[PATCH] swsusp: cleanup whitespace

The following patch cleans up whitespace in swsusp.c (a bit):

- removes any trailing whitespace

- adds spaces after if, for, for_each_pbe, for_each_zone etc., wherever
  necessary.
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8f9bdf15
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
* This file is released under the GPLv2. * This file is released under the GPLv2.
* *
* I'd like to thank the following people for their work: * I'd like to thank the following people for their work:
* *
* Pavel Machek <pavel@ucw.cz>: * Pavel Machek <pavel@ucw.cz>:
* Modifications, defectiveness pointing, being with me at the very beginning, * Modifications, defectiveness pointing, being with me at the very beginning,
* suspend to swap space, stop all tasks. Port to 2.4.18-ac and 2.5.17. * suspend to swap space, stop all tasks. Port to 2.4.18-ac and 2.5.17.
* *
* Steve Doddi <dirk@loth.demon.co.uk>: * Steve Doddi <dirk@loth.demon.co.uk>:
* Support the possibility of hardware state restoring. * Support the possibility of hardware state restoring.
* *
* Raph <grey.havens@earthling.net>: * Raph <grey.havens@earthling.net>:
...@@ -84,11 +84,11 @@ extern char resume_file[]; ...@@ -84,11 +84,11 @@ extern char resume_file[];
static unsigned int nr_copy_pages __nosavedata = 0; static unsigned int nr_copy_pages __nosavedata = 0;
/* Suspend pagedir is allocated before final copy, therefore it /* Suspend pagedir is allocated before final copy, therefore it
must be freed after resume must be freed after resume
Warning: this is evil. There are actually two pagedirs at time of Warning: this is evil. There are actually two pagedirs at time of
resume. One is "pagedir_save", which is empty frame allocated at resume. One is "pagedir_save", which is empty frame allocated at
time of suspend, that must be freed. Second is "pagedir_nosave", time of suspend, that must be freed. Second is "pagedir_nosave",
allocated at time of resume, that travels through memory not to allocated at time of resume, that travels through memory not to
collide with anything. collide with anything.
...@@ -132,7 +132,7 @@ static int mark_swapfiles(swp_entry_t prev) ...@@ -132,7 +132,7 @@ static int mark_swapfiles(swp_entry_t prev)
{ {
int error; int error;
rw_swap_page_sync(READ, rw_swap_page_sync(READ,
swp_entry(root_swap, 0), swp_entry(root_swap, 0),
virt_to_page((unsigned long)&swsusp_header)); virt_to_page((unsigned long)&swsusp_header));
if (!memcmp("SWAP-SPACE",swsusp_header.sig, 10) || if (!memcmp("SWAP-SPACE",swsusp_header.sig, 10) ||
...@@ -140,7 +140,7 @@ static int mark_swapfiles(swp_entry_t prev) ...@@ -140,7 +140,7 @@ static int mark_swapfiles(swp_entry_t prev)
memcpy(swsusp_header.orig_sig,swsusp_header.sig, 10); memcpy(swsusp_header.orig_sig,swsusp_header.sig, 10);
memcpy(swsusp_header.sig,SWSUSP_SIG, 10); memcpy(swsusp_header.sig,SWSUSP_SIG, 10);
swsusp_header.swsusp_info = prev; swsusp_header.swsusp_info = prev;
error = rw_swap_page_sync(WRITE, error = rw_swap_page_sync(WRITE,
swp_entry(root_swap, 0), swp_entry(root_swap, 0),
virt_to_page((unsigned long) virt_to_page((unsigned long)
&swsusp_header)); &swsusp_header));
...@@ -174,22 +174,22 @@ static int is_resume_device(const struct swap_info_struct *swap_info) ...@@ -174,22 +174,22 @@ static int is_resume_device(const struct swap_info_struct *swap_info)
static int swsusp_swap_check(void) /* This is called before saving image */ static int swsusp_swap_check(void) /* This is called before saving image */
{ {
int i, len; int i, len;
len=strlen(resume_file); len=strlen(resume_file);
root_swap = 0xFFFF; root_swap = 0xFFFF;
swap_list_lock(); swap_list_lock();
for(i=0; i<MAX_SWAPFILES; i++) { for (i=0; i<MAX_SWAPFILES; i++) {
if (swap_info[i].flags == 0) { if (swap_info[i].flags == 0) {
swapfile_used[i]=SWAPFILE_UNUSED; swapfile_used[i]=SWAPFILE_UNUSED;
} else { } else {
if(!len) { if (!len) {
printk(KERN_WARNING "resume= option should be used to set suspend device" ); printk(KERN_WARNING "resume= option should be used to set suspend device" );
if(root_swap == 0xFFFF) { if (root_swap == 0xFFFF) {
swapfile_used[i] = SWAPFILE_SUSPEND; swapfile_used[i] = SWAPFILE_SUSPEND;
root_swap = i; root_swap = i;
} else } else
swapfile_used[i] = SWAPFILE_IGNORED; swapfile_used[i] = SWAPFILE_IGNORED;
} else { } else {
/* we ignore all swap devices that are not the resume_file */ /* we ignore all swap devices that are not the resume_file */
if (is_resume_device(&swap_info[i])) { if (is_resume_device(&swap_info[i])) {
...@@ -209,15 +209,15 @@ static int swsusp_swap_check(void) /* This is called before saving image */ ...@@ -209,15 +209,15 @@ static int swsusp_swap_check(void) /* This is called before saving image */
* This is called after saving image so modification * This is called after saving image so modification
* will be lost after resume... and that's what we want. * will be lost after resume... and that's what we want.
* we make the device unusable. A new call to * we make the device unusable. A new call to
* lock_swapdevices can unlock the devices. * lock_swapdevices can unlock the devices.
*/ */
static void lock_swapdevices(void) static void lock_swapdevices(void)
{ {
int i; int i;
swap_list_lock(); swap_list_lock();
for(i = 0; i< MAX_SWAPFILES; i++) for (i = 0; i< MAX_SWAPFILES; i++)
if(swapfile_used[i] == SWAPFILE_IGNORED) { if (swapfile_used[i] == SWAPFILE_IGNORED) {
swap_info[i].flags ^= 0xFF; swap_info[i].flags ^= 0xFF;
} }
swap_list_unlock(); swap_list_unlock();
...@@ -229,7 +229,7 @@ static void lock_swapdevices(void) ...@@ -229,7 +229,7 @@ static void lock_swapdevices(void)
* @loc: Place to store the entry we used. * @loc: Place to store the entry we used.
* *
* Allocate a new swap entry and 'sync' it. Note we discard -EIO * Allocate a new swap entry and 'sync' it. Note we discard -EIO
* errors. That is an artifact left over from swsusp. It did not * errors. That is an artifact left over from swsusp. It did not
* check the return of rw_swap_page_sync() at all, since most pages * check the return of rw_swap_page_sync() at all, since most pages
* written back to swap would return -EIO. * written back to swap would return -EIO.
* This is a partial improvement, since we will at least return other * This is a partial improvement, since we will at least return other
...@@ -241,7 +241,7 @@ static int write_page(unsigned long addr, swp_entry_t * loc) ...@@ -241,7 +241,7 @@ static int write_page(unsigned long addr, swp_entry_t * loc)
int error = 0; int error = 0;
entry = get_swap_page(); entry = get_swap_page();
if (swp_offset(entry) && if (swp_offset(entry) &&
swapfile_used[swp_type(entry)] == SWAPFILE_SUSPEND) { swapfile_used[swp_type(entry)] == SWAPFILE_SUSPEND) {
error = rw_swap_page_sync(WRITE, entry, error = rw_swap_page_sync(WRITE, entry,
virt_to_page(addr)); virt_to_page(addr));
...@@ -257,7 +257,7 @@ static int write_page(unsigned long addr, swp_entry_t * loc) ...@@ -257,7 +257,7 @@ static int write_page(unsigned long addr, swp_entry_t * loc)
/** /**
* data_free - Free the swap entries used by the saved image. * data_free - Free the swap entries used by the saved image.
* *
* Walk the list of used swap entries and free each one. * Walk the list of used swap entries and free each one.
* This is only used for cleanup when suspend fails. * This is only used for cleanup when suspend fails.
*/ */
static void data_free(void) static void data_free(void)
...@@ -290,7 +290,7 @@ static int data_write(void) ...@@ -290,7 +290,7 @@ static int data_write(void)
mod = 1; mod = 1;
printk( "Writing data to swap (%d pages)... ", nr_copy_pages ); printk( "Writing data to swap (%d pages)... ", nr_copy_pages );
for_each_pbe(p, pagedir_nosave) { for_each_pbe (p, pagedir_nosave) {
if (!(i%mod)) if (!(i%mod))
printk( "\b\b\b\b%3d%%", i / mod ); printk( "\b\b\b\b%3d%%", i / mod );
if ((error = write_page(p->address, &(p->swap_address)))) if ((error = write_page(p->address, &(p->swap_address))))
...@@ -335,7 +335,7 @@ static int close_swap(void) ...@@ -335,7 +335,7 @@ static int close_swap(void)
dump_info(); dump_info();
error = write_page((unsigned long)&swsusp_info, &entry); error = write_page((unsigned long)&swsusp_info, &entry);
if (!error) { if (!error) {
printk( "S" ); printk( "S" );
error = mark_swapfiles(entry); error = mark_swapfiles(entry);
printk( "|\n" ); printk( "|\n" );
...@@ -370,7 +370,7 @@ static int write_pagedir(void) ...@@ -370,7 +370,7 @@ static int write_pagedir(void)
struct pbe * pbe; struct pbe * pbe;
printk( "Writing pagedir..."); printk( "Writing pagedir...");
for_each_pb_page(pbe, pagedir_nosave) { for_each_pb_page (pbe, pagedir_nosave) {
if ((error = write_page((unsigned long)pbe, &swsusp_info.pagedir[n++]))) if ((error = write_page((unsigned long)pbe, &swsusp_info.pagedir[n++])))
return error; return error;
} }
...@@ -472,7 +472,7 @@ static int save_highmem(void) ...@@ -472,7 +472,7 @@ static int save_highmem(void)
int res = 0; int res = 0;
pr_debug("swsusp: Saving Highmem\n"); pr_debug("swsusp: Saving Highmem\n");
for_each_zone(zone) { for_each_zone (zone) {
if (is_highmem(zone)) if (is_highmem(zone))
res = save_highmem_zone(zone); res = save_highmem_zone(zone);
if (res) if (res)
...@@ -547,7 +547,7 @@ static void count_data_pages(void) ...@@ -547,7 +547,7 @@ static void count_data_pages(void)
nr_copy_pages = 0; nr_copy_pages = 0;
for_each_zone(zone) { for_each_zone (zone) {
if (is_highmem(zone)) if (is_highmem(zone))
continue; continue;
mark_free_pages(zone); mark_free_pages(zone);
...@@ -562,9 +562,9 @@ static void copy_data_pages(void) ...@@ -562,9 +562,9 @@ static void copy_data_pages(void)
struct zone *zone; struct zone *zone;
unsigned long zone_pfn; unsigned long zone_pfn;
struct pbe * pbe = pagedir_nosave; struct pbe * pbe = pagedir_nosave;
pr_debug("copy_data_pages(): pages to copy: %d\n", nr_copy_pages); pr_debug("copy_data_pages(): pages to copy: %d\n", nr_copy_pages);
for_each_zone(zone) { for_each_zone (zone) {
if (is_highmem(zone)) if (is_highmem(zone))
continue; continue;
mark_free_pages(zone); mark_free_pages(zone);
...@@ -702,7 +702,7 @@ static void free_image_pages(void) ...@@ -702,7 +702,7 @@ static void free_image_pages(void)
{ {
struct pbe * p; struct pbe * p;
for_each_pbe(p, pagedir_save) { for_each_pbe (p, pagedir_save) {
if (p->address) { if (p->address) {
ClearPageNosave(virt_to_page(p->address)); ClearPageNosave(virt_to_page(p->address));
free_page(p->address); free_page(p->address);
...@@ -719,7 +719,7 @@ static int alloc_image_pages(void) ...@@ -719,7 +719,7 @@ static int alloc_image_pages(void)
{ {
struct pbe * p; struct pbe * p;
for_each_pbe(p, pagedir_save) { for_each_pbe (p, pagedir_save) {
p->address = get_zeroed_page(GFP_ATOMIC | __GFP_COLD); p->address = get_zeroed_page(GFP_ATOMIC | __GFP_COLD);
if (!p->address) if (!p->address)
return -ENOMEM; return -ENOMEM;
...@@ -740,7 +740,7 @@ void swsusp_free(void) ...@@ -740,7 +740,7 @@ void swsusp_free(void)
/** /**
* enough_free_mem - Make sure we enough free memory to snapshot. * enough_free_mem - Make sure we enough free memory to snapshot.
* *
* Returns TRUE or FALSE after checking the number of available * Returns TRUE or FALSE after checking the number of available
* free pages. * free pages.
*/ */
...@@ -758,11 +758,11 @@ static int enough_free_mem(void) ...@@ -758,11 +758,11 @@ static int enough_free_mem(void)
/** /**
* enough_swap - Make sure we have enough swap to save the image. * enough_swap - Make sure we have enough swap to save the image.
* *
* Returns TRUE or FALSE after checking the total amount of swap * Returns TRUE or FALSE after checking the total amount of swap
* space avaiable. * space avaiable.
* *
* FIXME: si_swapinfo(&i) returns all swap devices information. * FIXME: si_swapinfo(&i) returns all swap devices information.
* We should only consider resume_device. * We should only consider resume_device.
*/ */
static int enough_swap(void) static int enough_swap(void)
...@@ -827,8 +827,8 @@ static int suspend_prepare_image(void) ...@@ -827,8 +827,8 @@ static int suspend_prepare_image(void)
error = swsusp_alloc(); error = swsusp_alloc();
if (error) if (error)
return error; return error;
/* During allocating of suspend pagedir, new cold pages may appear. /* During allocating of suspend pagedir, new cold pages may appear.
* Kill them. * Kill them.
*/ */
drain_local_pages(); drain_local_pages();
...@@ -1030,7 +1030,7 @@ static struct pbe * swsusp_pagedir_relocate(struct pbe *pblist) ...@@ -1030,7 +1030,7 @@ static struct pbe * swsusp_pagedir_relocate(struct pbe *pblist)
/* Set page flags */ /* Set page flags */
for_each_zone(zone) { for_each_zone (zone) {
for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn)
SetPageNosaveFree(pfn_to_page(zone_pfn + SetPageNosaveFree(pfn_to_page(zone_pfn +
zone->zone_start_pfn)); zone->zone_start_pfn));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment