powerpc/mm: Simplify page_is_ram by using memblock_is_memory
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Wed, 28 Mar 2018 00:25:40 +0000 (02:25 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 31 Mar 2018 13:47:42 +0000 (00:47 +1100)
Instead of open-coding the search in page_is_ram, call memblock_is_memory.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/mem.c

index e2f5025b03b0795ef8b30854f3a300407cbef2a2..8f335cf052f8ad4d1df072418cb0b1feaf451284 100644 (file)
@@ -85,13 +85,7 @@ int page_is_ram(unsigned long pfn)
 #ifndef CONFIG_PPC64   /* XXX for now */
        return pfn < max_pfn;
 #else
-       unsigned long paddr = (pfn << PAGE_SHIFT);
-       struct memblock_region *reg;
-
-       for_each_memblock(memory, reg)
-               if (paddr >= reg->base && paddr < (reg->base + reg->size))
-                       return 1;
-       return 0;
+       return memblock_is_memory(__pfn_to_phys(pfn));
 #endif
 }