Subject: linux-next: build failure after merge of the dma-mapping tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 27 Nov 2020 17:58:01 +1100

Hi all,

After merging the dma-mapping tree, today's linux-next build (powerpc64
allnoconfig) failed like this:

In file included from include/linux/dma-direct.h:10,
                 from arch/powerpc/kernel/dma-iommu.c:9:
include/linux/dma-map-ops.h:328:41: error: expected identifier or '(' before numeric constant
  328 | #define arch_dma_map_page_direct(d, a) (0)
      |                                         ^
arch/powerpc/kernel/dma-iommu.c:16:6: note: in expansion of macro 'arch_dma_map_page_direct'
   16 | bool arch_dma_map_page_direct(struct device *dev, phys_addr_t addr)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dma-map-ops.h:329:43: error: expected identifier or '(' before numeric constant
  329 | #define arch_dma_unmap_page_direct(d, a) (0)
      |                                           ^
arch/powerpc/kernel/dma-iommu.c:26:6: note: in expansion of macro 'arch_dma_unmap_page_direct'
   26 | bool arch_dma_unmap_page_direct(struct device *dev, dma_addr_t dma_handle)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dma-map-ops.h:330:42: error: expected identifier or '(' before numeric constant
  330 | #define arch_dma_map_sg_direct(d, s, n) (0)
      |                                          ^
arch/powerpc/kernel/dma-iommu.c:34:6: note: in expansion of macro 'arch_dma_map_sg_direct'
   34 | bool arch_dma_map_sg_direct(struct device *dev, struct scatterlist *sg,
      |      ^~~~~~~~~~~~~~~~~~~~~~
include/linux/dma-map-ops.h:331:44: error: expected identifier or '(' before numeric constant
  331 | #define arch_dma_unmap_sg_direct(d, s, n) (0)
      |                                            ^
arch/powerpc/kernel/dma-iommu.c:51:6: note: in expansion of macro 'arch_dma_unmap_sg_direct'
   51 | bool arch_dma_unmap_sg_direct(struct device *dev, struct scatterlist *sg,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~

Caused by commit

  4e52b96ac85c ("powerpc/dma: Fallback to dma_ops when persistent memory present")

I have applied the following patch for today.

From: Stephen Rothwell <[email-masked]>
Date: Fri, 27 Nov 2020 17:49:28 +1100
Subject: [PATCH] powerpc/dma: fix for "powerpc/dma: Fallback to dma_ops when
 persistent memory present"

Fixes: 4e52b96ac85c ("powerpc/dma: Fallback to dma_ops when persistent memory present")
Signed-off-by: Stephen Rothwell <[email-masked]>
---
 arch/powerpc/kernel/dma-iommu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index c724548ca295..6364311eb6e9 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -10,6 +10,8 @@
 #include <linux/pci.h>
 #include <asm/iommu.h>
 
+#ifdef CONFIG_ARCH_HAS_DMA_MAP_DIRECT
+
 #define can_map_direct(dev, addr) \
 	((dev)->bus_dma_limit >= phys_to_dma((dev), (addr)))
 
@@ -64,6 +66,7 @@ bool arch_dma_unmap_sg_direct(struct device *dev, struct scatterlist *sg,
 
 	return true;
 }
+#endif /* CONFIG_ARCH_HAS_DMA_MAP_DIRECT */
 
 /*
  * Generic iommu implementation
-- 
2.29.2

-- 
Cheers,
Stephen Rothwell