[PATCH v2] arm64: mm: use macro instead of if judgement of ZONE_DMA

Yifan Zhang yifan.zhangm at gmail.com
Thu Oct 16 02:41:01 PDT 2014


if disable CONFIG_ZONE_DMA, ZONE_DMA becomes undefined.

Signed-off-by: Yifan Zhang <zhangyf at marvell.com>
---
 arch/arm64/mm/init.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 494297c..887ca5d 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -82,10 +82,10 @@ static void __init zone_sizes_init(unsigned long
min, unsigned long max)
    memset(zone_size, 0, sizeof(zone_size));

    /* 4GB maximum for 32-bit only capable devices */
-   if (IS_ENABLED(CONFIG_ZONE_DMA)) {
-       max_dma = PFN_DOWN(max_zone_dma_phys());
-       zone_size[ZONE_DMA] = max_dma - min;
-   }
+#ifdef CONFIG_ZONE_DMA
+   max_dma = PFN_DOWN(max_zone_dma_phys());
+   zone_size[ZONE_DMA] = max_dma - min;
+#endif
    zone_size[ZONE_NORMAL] = max - max_dma;

    memcpy(zhole_size, zone_size, sizeof(zhole_size));
@@ -97,10 +97,12 @@ static void __init zone_sizes_init(unsigned long
min, unsigned long max)
        if (start >= max)
            continue;

-       if (IS_ENABLED(CONFIG_ZONE_DMA) && start < max_dma) {
+#ifdef CONFIG_ZONE_DMA
+       if (start < max_dma) {
            unsigned long dma_end = min(end, max_dma);
            zhole_size[ZONE_DMA] -= dma_end - start;
        }
+#endif

        if (end > max_dma) {
            unsigned long normal_end = min(end, max);
--
1.7.9.5



More information about the linux-arm-kernel mailing list