Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: adapt for dma_map_ops changes

Adapt core MIPS architecture code for dma_map_ops changes: replace
alloc/free_coherent with generic alloc/free methods.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
[added missing changes to arch/mips/cavium-octeon/dma-octeon.c,
fixed attrs argument in dma-mapping.h]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>

authored by

Andrzej Pietrasiewicz and committed by
Marek Szyprowski
e8d51e54 baa676fc

+22 -16
+6 -6
arch/mips/cavium-octeon/dma-octeon.c
··· 157 157 } 158 158 159 159 static void *octeon_dma_alloc_coherent(struct device *dev, size_t size, 160 - dma_addr_t *dma_handle, gfp_t gfp) 160 + dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs) 161 161 { 162 162 void *ret; 163 163 ··· 192 192 } 193 193 194 194 static void octeon_dma_free_coherent(struct device *dev, size_t size, 195 - void *vaddr, dma_addr_t dma_handle) 195 + void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs) 196 196 { 197 197 int order = get_order(size); 198 198 ··· 240 240 241 241 static struct octeon_dma_map_ops octeon_linear_dma_map_ops = { 242 242 .dma_map_ops = { 243 - .alloc_coherent = octeon_dma_alloc_coherent, 244 - .free_coherent = octeon_dma_free_coherent, 243 + .alloc = octeon_dma_alloc_coherent, 244 + .free = octeon_dma_free_coherent, 245 245 .map_page = octeon_dma_map_page, 246 246 .unmap_page = swiotlb_unmap_page, 247 247 .map_sg = octeon_dma_map_sg, ··· 325 325 #ifdef CONFIG_PCI 326 326 static struct octeon_dma_map_ops _octeon_pci_dma_map_ops = { 327 327 .dma_map_ops = { 328 - .alloc_coherent = octeon_dma_alloc_coherent, 329 - .free_coherent = octeon_dma_free_coherent, 328 + .alloc = octeon_dma_alloc_coherent, 329 + .free = octeon_dma_free_coherent, 330 330 .map_page = octeon_dma_map_page, 331 331 .unmap_page = swiotlb_unmap_page, 332 332 .map_sg = octeon_dma_map_sg,
+12 -6
arch/mips/include/asm/dma-mapping.h
··· 57 57 extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 58 58 enum dma_data_direction direction); 59 59 60 - static inline void *dma_alloc_coherent(struct device *dev, size_t size, 61 - dma_addr_t *dma_handle, gfp_t gfp) 60 + #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) 61 + 62 + static inline void *dma_alloc_attrs(struct device *dev, size_t size, 63 + dma_addr_t *dma_handle, gfp_t gfp, 64 + struct dma_attrs *attrs) 62 65 { 63 66 void *ret; 64 67 struct dma_map_ops *ops = get_dma_ops(dev); 65 68 66 - ret = ops->alloc_coherent(dev, size, dma_handle, gfp); 69 + ret = ops->alloc(dev, size, dma_handle, gfp, attrs); 67 70 68 71 debug_dma_alloc_coherent(dev, size, *dma_handle, ret); 69 72 70 73 return ret; 71 74 } 72 75 73 - static inline void dma_free_coherent(struct device *dev, size_t size, 74 - void *vaddr, dma_addr_t dma_handle) 76 + #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) 77 + 78 + static inline void dma_free_attrs(struct device *dev, size_t size, 79 + void *vaddr, dma_addr_t dma_handle, 80 + struct dma_attrs *attrs) 75 81 { 76 82 struct dma_map_ops *ops = get_dma_ops(dev); 77 83 78 - ops->free_coherent(dev, size, vaddr, dma_handle); 84 + ops->free(dev, size, vaddr, dma_handle, attrs); 79 85 80 86 debug_dma_free_coherent(dev, size, vaddr, dma_handle); 81 87 }
+4 -4
arch/mips/mm/dma-default.c
··· 98 98 EXPORT_SYMBOL(dma_alloc_noncoherent); 99 99 100 100 static void *mips_dma_alloc_coherent(struct device *dev, size_t size, 101 - dma_addr_t * dma_handle, gfp_t gfp) 101 + dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs) 102 102 { 103 103 void *ret; 104 104 ··· 132 132 EXPORT_SYMBOL(dma_free_noncoherent); 133 133 134 134 static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, 135 - dma_addr_t dma_handle) 135 + dma_addr_t dma_handle, struct dma_attrs *attrs) 136 136 { 137 137 unsigned long addr = (unsigned long) vaddr; 138 138 int order = get_order(size); ··· 323 323 EXPORT_SYMBOL(dma_cache_sync); 324 324 325 325 static struct dma_map_ops mips_default_dma_map_ops = { 326 - .alloc_coherent = mips_dma_alloc_coherent, 327 - .free_coherent = mips_dma_free_coherent, 326 + .alloc = mips_dma_alloc_coherent, 327 + .free = mips_dma_free_coherent, 328 328 .map_page = mips_dma_map_page, 329 329 .unmap_page = mips_dma_unmap_page, 330 330 .map_sg = mips_dma_map_sg,