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(-)
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@csgroup.eu>
Cc: Arnd Bergmann <arnd@arndb.de>
---
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
On Fri, Aug 18, 2023, at 09:55, Christophe Leroy wrote:
> 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@csgroup.eu>
> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
I sent the same patch, and this is already in linux-next as
3d6f126b15d9 ("dma-mapping: move arch_dma_set_mask() declaration
to header")
Arnd
© 2016 - 2025 Red Hat, Inc.