From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 3/3] dma: fix dma_realloc_coherent compile-time error on kvx
Date: Thu, 6 Aug 2026 13:28:03 +0200 [thread overview]
Message-ID: <20260806112845.3822400-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260806112845.3822400-1-a.fatoum@pengutronix.de>
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@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
next prev parent reply other threads:[~2026-08-06 11:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 11:28 [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Ahmad Fatoum
2026-08-06 11:28 ` [PATCH master 2/3] kvx: select DEAD_CODE_DATA_ELIMINATION Ahmad Fatoum
2026-08-06 11:28 ` Ahmad Fatoum [this message]
2026-08-06 13:08 ` [PATCH master 1/3] test: kvx: add Labgrid env YAML for generic_defconfig Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260806112845.3822400-3-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox