From: Mark Rutland Date: Wed, 22 Jun 2016 11:13:45 +0000 (+0100) Subject: arm64: mm: simplify memblock numa node extraction X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea2cbee3bc671390139802dd0d50b08db024b03c;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git arm64: mm: simplify memblock numa node extraction We currently open-code extracting the NUMA node of a memblock region, which requires an ifdef to cater for !CONFIG_NUMA builds where the memblock_region::nid field does not exist. The generic memblock_get_region_node helper is intended to cater for this. For CONFIG_HAVE_MEMBLOCK_NODE_MAP, builds this returns reg->nid, and for for !CONFIG_HAVE_MEMBLOCK_NODE_MAP builds this is a static inline that returns 0. Note that for arm64, CONFIG_HAVE_MEMBLOCK_NODE_MAP is selected iff CONFIG_NUMA is. This patch makes use of memblock_get_region_node to simplify the arm64 code. At the same time, we can move the nid variable definition into the loop, as this is the only place it is used. Signed-off-by: Mark Rutland Reviewed-by: Steve Capper Acked-by: Will Deacon Signed-off-by: Catalin Marinas --- diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 7d25b4d00677..64ea28306661 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -160,12 +160,10 @@ static void __init arm64_memory_present(void) static void __init arm64_memory_present(void) { struct memblock_region *reg; - int nid = 0; for_each_memblock(memory, reg) { -#ifdef CONFIG_NUMA - nid = reg->nid; -#endif + int nid = memblock_get_region_node(reg); + memory_present(nid, memblock_region_memory_base_pfn(reg), memblock_region_memory_end_pfn(reg)); }