diff options
Diffstat (limited to 'arch/sh/include/asm/dma-mapping.h')
| -rw-r--r-- | arch/sh/include/asm/dma-mapping.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h index 1a73c3e759a7..8bd965e00a15 100644 --- a/arch/sh/include/asm/dma-mapping.h +++ b/arch/sh/include/asm/dma-mapping.h | |||
| @@ -52,25 +52,31 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
| 52 | return dma_addr == 0; | 52 | return dma_addr == 0; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 55 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
| 56 | dma_addr_t *dma_handle, gfp_t gfp) | 56 | |
| 57 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
| 58 | dma_addr_t *dma_handle, gfp_t gfp, | ||
| 59 | struct dma_attrs *attrs) | ||
| 57 | { | 60 | { |
| 58 | struct dma_map_ops *ops = get_dma_ops(dev); | 61 | struct dma_map_ops *ops = get_dma_ops(dev); |
| 59 | void *memory; | 62 | void *memory; |
| 60 | 63 | ||
| 61 | if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) | 64 | if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) |
| 62 | return memory; | 65 | return memory; |
| 63 | if (!ops->alloc_coherent) | 66 | if (!ops->alloc) |
| 64 | return NULL; | 67 | return NULL; |
| 65 | 68 | ||
| 66 | memory = ops->alloc_coherent(dev, size, dma_handle, gfp); | 69 | memory = ops->alloc(dev, size, dma_handle, gfp, attrs); |
| 67 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); | 70 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); |
| 68 | 71 | ||
| 69 | return memory; | 72 | return memory; |
| 70 | } | 73 | } |
| 71 | 74 | ||
| 72 | static inline void dma_free_coherent(struct device *dev, size_t size, | 75 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
| 73 | void *vaddr, dma_addr_t dma_handle) | 76 | |
| 77 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
| 78 | void *vaddr, dma_addr_t dma_handle, | ||
| 79 | struct dma_attrs *attrs) | ||
| 74 | { | 80 | { |
| 75 | struct dma_map_ops *ops = get_dma_ops(dev); | 81 | struct dma_map_ops *ops = get_dma_ops(dev); |
| 76 | 82 | ||
| @@ -78,14 +84,16 @@ static inline void dma_free_coherent(struct device *dev, size_t size, | |||
| 78 | return; | 84 | return; |
| 79 | 85 | ||
| 80 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); | 86 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); |
| 81 | if (ops->free_coherent) | 87 | if (ops->free) |
| 82 | ops->free_coherent(dev, size, vaddr, dma_handle); | 88 | ops->free(dev, size, vaddr, dma_handle, attrs); |
| 83 | } | 89 | } |
| 84 | 90 | ||
| 85 | /* arch/sh/mm/consistent.c */ | 91 | /* arch/sh/mm/consistent.c */ |
| 86 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 92 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
| 87 | dma_addr_t *dma_addr, gfp_t flag); | 93 | dma_addr_t *dma_addr, gfp_t flag, |
| 94 | struct dma_attrs *attrs); | ||
| 88 | extern void dma_generic_free_coherent(struct device *dev, size_t size, | 95 | extern void dma_generic_free_coherent(struct device *dev, size_t size, |
| 89 | void *vaddr, dma_addr_t dma_handle); | 96 | void *vaddr, dma_addr_t dma_handle, |
| 97 | struct dma_attrs *attrs); | ||
| 90 | 98 | ||
| 91 | #endif /* __ASM_SH_DMA_MAPPING_H */ | 99 | #endif /* __ASM_SH_DMA_MAPPING_H */ |
