From: Michal Schmidt <[EMAIL PROTECTED]> The function calc_nr uses an iterative algorithm to calculate the number of pages needed for the image and the pagedir. Exactly the same result can be obtained with a one-line expression.
Note that this was even proved correct ;-). Signed-off-by: Michal Schmidt <[EMAIL PROTECTED]> Signed-off-by: Pavel Machek <[EMAIL PROTECTED]> --- commit 06695555bdbe1a5ac3b7926867abfdc9e560121f tree 3be140250bf556a51261ea75b908906e64182ec3 parent 42b960c2ed61b623d5e84b67f95c7f0ddad0565f author <[EMAIL PROTECTED](none)> Sat, 30 Jul 2005 15:19:56 +0200 committer <[EMAIL PROTECTED](none)> Sat, 30 Jul 2005 15:19:56 +0200 kernel/power/swsusp.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-) diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c @@ -591,18 +591,7 @@ static void copy_data_pages(void) static int calc_nr(int nr_copy) { - int extra = 0; - int mod = !!(nr_copy % PBES_PER_PAGE); - int diff = (nr_copy / PBES_PER_PAGE) + mod; - - do { - extra += diff; - nr_copy += diff; - mod = !!(nr_copy % PBES_PER_PAGE); - diff = (nr_copy / PBES_PER_PAGE) + mod - extra; - } while (diff > 0); - - return nr_copy; + return nr_copy + (nr_copy+PBES_PER_PAGE-2)/(PBES_PER_PAGE-1); } /** -- teflon -- maybe it is a trademark, but it should not be. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/