Skip to contentSkip to conversation

dma: dma_{un}map_{single|sg}_attrs() interface

PATCH Superseded [email protected] 2 participants 2 messages Feb 28, 2008 DMA mapping helpers

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover dma: dma_{un}map_{single|sg}_attrs() interface

v2->v3 changes:
mainly cosmetic changes to make checkpatch a little happier - trailing whitespace, long lines.... Also made dma_set_attr() a no-op inline func when ARCH_USES_DMA_ATTRS is not defined instead of a macro.

I'd like to get this one queued up for 2.6.26.

---

Introduce a new interface for passing architecture-specific attributes when memory is mapped and unmapped for DMA. Give the interface a default implementation which ignores attributes.

---

 dma-mapping.h |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+)
include/linux/dma-mapping.h +35 -0
index 3320307..5a0e924 100644
@@ -146,4 +146,39 @@ static inline void dmam_release_declared_memory(struct device *dev)
 }
 #endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
 
+#ifndef ARCH_USES_DMA_ATTRS
+struct dma_attrs;
+
+static inline dma_addr_t dma_map_single_attrs(struct device *dev,
+					      void *cpu_addr, size_t size,
+					      enum dma_data_direction dir,
+					      struct dma_attrs *attrs)
+{
+	return dma_map_single(dev, cpu_addr, size, dir);
+}
+
+static inline void dma_unmap_single_attrs(struct device *dev,
+					  dma_addr_t dma_addr, size_t size,
+					  enum dma_data_direction dir,
+					  struct dma_attrs *attrs)
+{
+	return dma_unmap_single(dev, dma_addr, size, dir);
+}
+
+static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
+				   int nents, enum dma_data_direction dir,
+				   struct dma_attrs *attrs)
+{
+	return dma_map_sg(dev, sgl, nents, dir);
+}
+
+static inline void dma_unmap_sg_attrs(struct device *dev,
+				      struct scatterlist *sgl, int nents,
+				      enum dma_data_direction dir,
+				      struct dma_attrs *attrs)
+{
+	return dma_unmap_sg(dev, sgl, nents, dir);
+}
+#endif /* ARCH_USES_DMA_ATTRS */
+
 #endif
Acked-by on the v3 series
#1 lore raw
Quoted 7 lines · On Wednesday, February 27, 2008 7:23 pm [email protected] wrote:

v2->v3 changes:
mainly cosmetic changes to make checkpatch a little happier - trailing whitespace, long lines.... Also made dma_set_attr() a no-op inline func when ARCH_USES_DMA_ATTRS is not defined instead of a macro.

I'd like to get this one queued up for 2.6.26.

Hey Arthur, the patch set looks nice to me. You can add my

to the series if you like.