[PATCH] dma-mapping, powerpc: Move arch_dma_set_mask() prototype into dma-map-ops.h
From: Christophe Leroy
Date: Fri Aug 18 2023 - 03:57:24 EST
To fix the following error,
CC arch/powerpc/kernel/dma-mask.o
arch/powerpc/kernel/dma-mask.c:7:6: error: no previous prototype for 'arch_dma_set_mask' [-Werror=missing-prototypes]
7 | void arch_dma_set_mask(struct device *dev, u64 dma_mask)
| ^~~~~~~~~~~~~~~~~
Move arch_dma_set_mask() definition into dma-map-ops.h and
include it in arch/powerpc/kernel/dma-mask.c
Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
---
arch/powerpc/kernel/dma-mask.c | 1 +
include/linux/dma-map-ops.h | 6 ++++++
kernel/dma/mapping.c | 6 ------
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/kernel/dma-mask.c b/arch/powerpc/kernel/dma-mask.c
index ffbbbc432612..5b07ca7b73aa 100644
--- a/arch/powerpc/kernel/dma-mask.c
+++ b/arch/powerpc/kernel/dma-mask.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/dma-mapping.h>
+#include <linux/dma-map-ops.h>
#include <linux/export.h>
#include <asm/machdep.h>
diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
index 9bf19b5bf755..6bca67e21bc1 100644
--- a/include/linux/dma-map-ops.h
+++ b/include/linux/dma-map-ops.h
@@ -509,4 +509,10 @@ pci_p2pdma_map_segment(struct pci_p2pdma_map_state *state, struct device *dev,
}
#endif /* CONFIG_PCI_P2PDMA */
+#ifdef CONFIG_ARCH_HAS_DMA_SET_MASK
+void arch_dma_set_mask(struct device *dev, u64 mask);
+#else
+#define arch_dma_set_mask(dev, mask) do { } while (0)
+#endif
+
#endif /* _LINUX_DMA_MAP_OPS_H */
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index 9a4db5cce600..e323ca48f7f2 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -760,12 +760,6 @@ bool dma_pci_p2pdma_supported(struct device *dev)
}
EXPORT_SYMBOL_GPL(dma_pci_p2pdma_supported);
-#ifdef CONFIG_ARCH_HAS_DMA_SET_MASK
-void arch_dma_set_mask(struct device *dev, u64 mask);
-#else
-#define arch_dma_set_mask(dev, mask) do { } while (0)
-#endif
-
int dma_set_mask(struct device *dev, u64 mask)
{
/*
--
2.41.0