diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-11-17 04:39:18 +0100 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-11-17 20:59:46 +0100 |
commit | b8fd39c036ab982aa087b7ee671f86e2574d31f2 (patch) | |
tree | 59d60b2d8db18f629084e1e33dc4f9fb7be8c2c0 /arch/x86/mm/init.c | |
parent | x86, mm: Move after_bootmem to mm_internel.h (diff) | |
download | linux-b8fd39c036ab982aa087b7ee671f86e2574d31f2.tar.xz linux-b8fd39c036ab982aa087b7ee671f86e2574d31f2.zip |
x86, mm: Use clamp_t() in init_range_memory_mapping
save some lines, and make code more readable.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1353123563-3103-42-git-send-email-yinghai@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm/init.c')
-rw-r--r-- | 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 2a27e5ac1e3c..6f85de8a1f28 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -357,31 +357,20 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, * would have hole in the middle or ends, and only ram parts will be mapped. */ 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; } |