diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-03 23:23:02 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-04 00:38:55 -0400 |
commit | 5e6f6aa1c243fafeb2648cf4ebd5abd99ab2531b (patch) | |
tree | 6ebf6e67122fe8d859e8e59b3ce1c08a71ebf678 /arch/arm/mm | |
parent | 72d4b0b4e0e7fa858767e03972771a9f7c02b689 (diff) |
memblock/arm: pfn_valid uses memblock_is_memory()
The implementation is pretty much similar. There is a -small- added
overhead by having another function call and the address shift.
If that becomes a concern, I suppose we could actually have memblock
itself expose a memblock_pfn_valid() which then ARM can use directly
with an appropriate #define...
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/init.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index d1496e65dc2d..e739223e2a54 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -237,20 +237,7 @@ static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min, | |||
237 | #ifndef CONFIG_SPARSEMEM | 237 | #ifndef CONFIG_SPARSEMEM |
238 | int pfn_valid(unsigned long pfn) | 238 | int pfn_valid(unsigned long pfn) |
239 | { | 239 | { |
240 | struct memblock_type *mem = &memblock.memory; | 240 | return memblock_is_memory(pfn << PAGE_SHIFT); |
241 | unsigned int left = 0, right = mem->cnt; | ||
242 | |||
243 | do { | ||
244 | unsigned int mid = (right + left) / 2; | ||
245 | |||
246 | if (pfn < memblock_start_pfn(mem, mid)) | ||
247 | right = mid; | ||
248 | else if (pfn >= memblock_end_pfn(mem, mid)) | ||
249 | left = mid + 1; | ||
250 | else | ||
251 | return 1; | ||
252 | } while (left < right); | ||
253 | return 0; | ||
254 | } | 241 | } |
255 | EXPORT_SYMBOL(pfn_valid); | 242 | EXPORT_SYMBOL(pfn_valid); |
256 | 243 | ||