[PATCH master 3/3] dma: fix dma_realloc_coherent compile-time error on kvx
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Aug 6 04:28:03 PDT 2026
dma_realloc_coherent calls dma_alloc_coherent internally, but on kvx.
use of dma_alloc_coherent always triggers a compile-time error.
Turn the compile-time error into a link-time error, so
dma_alloc_coherent() may be used in common code that's ultimately
discarded, regardless of whether the architecture actually implements
it.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
arch/kvx/include/asm/dma.h | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/arch/kvx/include/asm/dma.h b/arch/kvx/include/asm/dma.h
index 42329331fba9..f1457193c300 100644
--- a/arch/kvx/include/asm/dma.h
+++ b/arch/kvx/include/asm/dma.h
@@ -13,20 +13,18 @@
struct device;
#define dma_alloc_coherent dma_alloc_coherent
-static inline void *dma_alloc_coherent(struct device *dev,
- size_t size, dma_addr_t *dma_handle)
-{
- BUILD_BUG_ON_MSG(1, "dma_alloc_coherent not supported: "
- "MMU support is required to map uncached pages");
- return NULL;
-}
+
+/* dma_alloc_coherent is not supported as MMU support is required to map
+ * uncached pages. To avoid compile-time errors for ultimately unreferenced
+ * code, we declare the prototype here and let the lack of definition cause
+ * a linker error if either function ends up being used.
+ */
+extern void *dma_alloc_coherent(struct device *dev,
+ size_t size, dma_addr_t *dma_handle);
#define dma_free_coherent dma_free_coherent
-static inline void dma_free_coherent(struct device *dev,
- void *mem, dma_addr_t dma_handle,
- size_t size)
-{
- free(mem);
-}
+extern void dma_free_coherent(struct device *dev,
+ void *mem, dma_addr_t dma_handle,
+ size_t size);
#endif /* __ASM_DMA_H */
--
2.47.3
More information about the barebox
mailing list