Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e6f6aa1 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt
Browse files

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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 72d4b0b4
Loading
Loading
Loading
Loading
+1 −14
Original line number Original line Diff line number Diff line
@@ -237,20 +237,7 @@ static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min,
#ifndef CONFIG_SPARSEMEM
#ifndef CONFIG_SPARSEMEM
int pfn_valid(unsigned long pfn)
int pfn_valid(unsigned long pfn)
{
{
	struct memblock_type *mem = &memblock.memory;
	return memblock_is_memory(pfn << PAGE_SHIFT);
	unsigned int left = 0, right = mem->cnt;

	do {
		unsigned int mid = (right + left) / 2;

		if (pfn < memblock_start_pfn(mem, mid))
			right = mid;
		else if (pfn >= memblock_end_pfn(mem, mid))
			left = mid + 1;
		else
			return 1;
	} while (left < right);
	return 0;
}
}
EXPORT_SYMBOL(pfn_valid);
EXPORT_SYMBOL(pfn_valid);