[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1354139277-17376-42-git-send-email-yinghai@kernel.org>
Date: Wed, 28 Nov 2012 13:47:52 -0800
From: Yinghai Lu <yinghai@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...e.hu>,
"H. Peter Anvin" <hpa@...or.com>, Jacob Shin <jacob.shin@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Stefano Stabellini <stefano.stabellini@...citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
linux-kernel@...r.kernel.org, Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH v9 41/46] x86, mm: Use clamp_t() in init_range_memory_mapping
save some lines, and make code more readable.
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
---
arch/x86/mm/init.c | 21 +++++----------------
1 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 1b8e80b..c8daa79 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -367,31 +367,20 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
* will be mapped in init_range_memory_mapping.
*/
static unsigned long __init init_range_memory_mapping(
- unsigned long range_start,
- unsigned long range_end)
+ unsigned long r_start,
+ unsigned long r_end)
{
unsigned long start_pfn, end_pfn;
unsigned long mapped_ram_size = 0;
int i;
for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) {
- u64 start = (u64)start_pfn << PAGE_SHIFT;
- u64 end = (u64)end_pfn << PAGE_SHIFT;
-
- if (end <= range_start)
- continue;
-
- if (start < range_start)
- start = range_start;
-
- if (start >= range_end)
+ u64 start = clamp_val(PFN_PHYS(start_pfn), r_start, r_end);
+ u64 end = clamp_val(PFN_PHYS(end_pfn), r_start, r_end);
+ if (start >= end)
continue;
- if (end > range_end)
- end = range_end;
-
init_memory_mapping(start, end);
-
mapped_ram_size += end - start;
}
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists