summaryrefslogtreecommitdiff
path: root/include/linux/dma-mapping.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-05 10:23:24 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-05 10:23:24 -0700
commit652ede37cec0bf7313927ecf4cebf0e79a0619f2 (patch)
tree0632532df17bf40af0112faefb8bfa6f2ded315e /include/linux/dma-mapping.h
parent1b2951dd99af3970c1c1a8385a12b90236b837de (diff)
parent1f674e16f9ce6eb20ee2e81ae7514737376874de (diff)
Merge tag 'dma-mapping-4.17' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping updates from Christoph Hellwig: "Very light this round as the interesting dma mapping changes went through the x86 tree. This just provides proper stubs for architectures not supporting dma (Geert Uytterhoeven)" * tag 'dma-mapping-4.17' of git://git.infradead.org/users/hch/dma-mapping: usb: gadget: Add NO_DMA dummies for DMA mapping API scsi: Add NO_DMA dummies for SCSI DMA mapping API mm: Add NO_DMA dummies for DMA pool API dma-coherent: Add NO_DMA dummies for managed DMA API dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r--include/linux/dma-mapping.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 12fedcba9a9a..f8ab1c0f589e 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -212,14 +212,14 @@ static inline void set_dma_ops(struct device *dev,
}
#else
/*
- * Define the dma api to allow compilation but not linking of
- * dma dependent code. Code that depends on the dma-mapping
- * API needs to set 'depends on HAS_DMA' in its Kconfig
+ * Define the dma api to allow compilation of dma dependent code.
+ * Code that depends on the dma-mapping API needs to set 'depends on HAS_DMA'
+ * in its Kconfig, unless it already depends on <something> || COMPILE_TEST,
+ * where <something> guarantuees the availability of the dma-mapping API.
*/
-extern const struct dma_map_ops bad_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
{
- return &bad_dma_ops;
+ return NULL;
}
#endif
@@ -772,10 +772,19 @@ static inline void dma_deconfigure(struct device *dev) {}
/*
* Managed DMA API
*/
+#ifdef CONFIG_HAS_DMA
extern void *dmam_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp);
extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr,
dma_addr_t dma_handle);
+#else /* !CONFIG_HAS_DMA */
+static inline void *dmam_alloc_coherent(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, gfp_t gfp)
+{ return NULL; }
+static inline void dmam_free_coherent(struct device *dev, size_t size,
+ void *vaddr, dma_addr_t dma_handle) { }
+#endif /* !CONFIG_HAS_DMA */
+
extern void *dmam_alloc_attrs(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp,
unsigned long attrs);