Skip to content

Commit ab642e9

Browse files
geertuChristoph Hellwig
authored andcommitted
dma-coherent: Add NO_DMA dummies for managed DMA API
Add dummies for dmam_{alloc,free}_coherent(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "dmam_alloc_coherent" [drivers/net/ethernet/arc/arc_emac.ko] undefined! ERROR: "dmam_free_coherent" [drivers/net/ethernet/apm/xgene/xgene-enet.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/net/ethernet/apm/xgene/xgene-enet.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/mtd/nand/hisi504_nand.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/mmc/host/dw_mmc.ko] undefined! Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Mark Brown <[email protected]> Acked-by: Robin Murphy <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent f29ab49 commit ab642e9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/linux/dma-mapping.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,10 +776,19 @@ static inline void dma_deconfigure(struct device *dev) {}
776776
/*
777777
* Managed DMA API
778778
*/
779+
#ifdef CONFIG_HAS_DMA
779780
extern void *dmam_alloc_coherent(struct device *dev, size_t size,
780781
dma_addr_t *dma_handle, gfp_t gfp);
781782
extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr,
782783
dma_addr_t dma_handle);
784+
#else /* !CONFIG_HAS_DMA */
785+
static inline void *dmam_alloc_coherent(struct device *dev, size_t size,
786+
dma_addr_t *dma_handle, gfp_t gfp)
787+
{ return NULL; }
788+
static inline void dmam_free_coherent(struct device *dev, size_t size,
789+
void *vaddr, dma_addr_t dma_handle) { }
790+
#endif /* !CONFIG_HAS_DMA */
791+
783792
extern void *dmam_alloc_attrs(struct device *dev, size_t size,
784793
dma_addr_t *dma_handle, gfp_t gfp,
785794
unsigned long attrs);

0 commit comments

Comments
 (0)