diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-10 16:56:08 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-10 16:56:08 -0400 |
| commit | 754c780953397dd5ee5191b7b3ca67e09088ce7a (patch) | |
| tree | 8bdbf8407c8cd917f24a0d5a5c6a865db6366f3c /include | |
| parent | 40c43269cf8e88a0bdc306c717d1dd5446a6f3b8 (diff) | |
| parent | b4bbb107d73bbc0d92c9ae7fd8e69580aa9381e7 (diff) | |
Merge branch 'for-v3.18' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping
Pull dma-mapping update from Marek Szyprowski:
"Provide the dma write coherent api (available previously on ARM
architecture) for all other architectures, which use dma_ops-based dma
mapping implementation.
This lets one to use the same code in the device drivers regardless of
the selected architecture"
* 'for-v3.18' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping:
dma-mapping: Provide write-combine allocations
s390: Implement dma_{alloc,free}_attrs()
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-generic/dma-mapping-common.h | 8 | ||||
| -rw-r--r-- | include/linux/dma-mapping.h | 26 |
2 files changed, 26 insertions, 8 deletions
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h index a9fd248f5d48..3378dcf4c31e 100644 --- a/include/asm-generic/dma-mapping-common.h +++ b/include/asm-generic/dma-mapping-common.h | |||
| @@ -214,14 +214,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, | |||
| 214 | 214 | ||
| 215 | #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) | 215 | #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL) |
| 216 | 216 | ||
| 217 | static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma, | ||
| 218 | void *cpu_addr, dma_addr_t dma_addr, size_t size) | ||
| 219 | { | ||
| 220 | DEFINE_DMA_ATTRS(attrs); | ||
| 221 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); | ||
| 222 | return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs); | ||
| 223 | } | ||
| 224 | |||
| 225 | int | 217 | int |
| 226 | dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, | 218 | dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, |
| 227 | void *cpu_addr, dma_addr_t dma_addr, size_t size); | 219 | void *cpu_addr, dma_addr_t dma_addr, size_t size); |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 931b70986272..d5d388160f42 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
| @@ -263,6 +263,32 @@ struct dma_attrs; | |||
| 263 | #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ | 263 | #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \ |
| 264 | dma_unmap_sg(dev, sgl, nents, dir) | 264 | dma_unmap_sg(dev, sgl, nents, dir) |
| 265 | 265 | ||
| 266 | #else | ||
| 267 | static inline void *dma_alloc_writecombine(struct device *dev, size_t size, | ||
| 268 | dma_addr_t *dma_addr, gfp_t gfp) | ||
| 269 | { | ||
| 270 | DEFINE_DMA_ATTRS(attrs); | ||
| 271 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); | ||
| 272 | return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs); | ||
| 273 | } | ||
| 274 | |||
| 275 | static inline void dma_free_writecombine(struct device *dev, size_t size, | ||
| 276 | void *cpu_addr, dma_addr_t dma_addr) | ||
| 277 | { | ||
| 278 | DEFINE_DMA_ATTRS(attrs); | ||
| 279 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); | ||
| 280 | return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs); | ||
| 281 | } | ||
| 282 | |||
| 283 | static inline int dma_mmap_writecombine(struct device *dev, | ||
| 284 | struct vm_area_struct *vma, | ||
| 285 | void *cpu_addr, dma_addr_t dma_addr, | ||
| 286 | size_t size) | ||
| 287 | { | ||
| 288 | DEFINE_DMA_ATTRS(attrs); | ||
| 289 | dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs); | ||
| 290 | return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs); | ||
| 291 | } | ||
| 266 | #endif /* CONFIG_HAVE_DMA_ATTRS */ | 292 | #endif /* CONFIG_HAVE_DMA_ATTRS */ |
| 267 | 293 | ||
| 268 | #ifdef CONFIG_NEED_DMA_MAP_STATE | 294 | #ifdef CONFIG_NEED_DMA_MAP_STATE |
