[PATCH] swsusp: reduce the use of global variables

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Rafael J. Wysocki
2005-10-30 14:59:57 -08:00
committed by Linus Torvalds
parent 25761b6eb7
commit a0f496517f
3 changed files with 43 additions and 43 deletions

View File

@@ -550,14 +550,14 @@ static int write_suspend_image(void)
* We should only consider resume_device.
*/
int enough_swap(void)
int enough_swap(unsigned nr_pages)
{
struct sysinfo i;
si_swapinfo(&i);
pr_debug("swsusp: available swap: %lu pages\n", i.freeswap);
return i.freeswap > (nr_copy_pages + PAGES_FOR_IO +
nr_copy_pages/PBES_PER_PAGE + !!(nr_copy_pages%PBES_PER_PAGE));
return i.freeswap > (nr_pages + PAGES_FOR_IO +
(nr_pages + PBES_PER_PAGE - 1) / PBES_PER_PAGE);
}