Commit c416258a6e1e68a33fd328e872007d19941138c5

Authored by Andrzej Pietrasiewicz
Committed by Marek Szyprowski
1 parent bfbf7d6151

SPARC: adapt for dma_map_ops changes

Adapt core SPARC 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>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: David S. Miller <davem@davemloft.net>

Showing 4 changed files with 33 additions and 22 deletions Side-by-side Diff

arch/sparc/include/asm/dma-mapping.h
... ... @@ -26,24 +26,30 @@
26 26  
27 27 #include <asm-generic/dma-mapping-common.h>
28 28  
29   -static inline void *dma_alloc_coherent(struct device *dev, size_t size,
30   - dma_addr_t *dma_handle, gfp_t flag)
  29 +#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
  30 +
  31 +static inline void *dma_alloc_attrs(struct device *dev, size_t size,
  32 + dma_addr_t *dma_handle, gfp_t flag,
  33 + struct dma_attrs *attrs)
31 34 {
32 35 struct dma_map_ops *ops = get_dma_ops(dev);
33 36 void *cpu_addr;
34 37  
35   - cpu_addr = ops->alloc_coherent(dev, size, dma_handle, flag);
  38 + cpu_addr = ops->alloc(dev, size, dma_handle, flag, attrs);
36 39 debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr);
37 40 return cpu_addr;
38 41 }
39 42  
40   -static inline void dma_free_coherent(struct device *dev, size_t size,
41   - void *cpu_addr, dma_addr_t dma_handle)
  43 +#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
  44 +
  45 +static inline void dma_free_attrs(struct device *dev, size_t size,
  46 + void *cpu_addr, dma_addr_t dma_handle,
  47 + struct dma_attrs *attrs)
42 48 {
43 49 struct dma_map_ops *ops = get_dma_ops(dev);
44 50  
45 51 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
46   - ops->free_coherent(dev, size, cpu_addr, dma_handle);
  52 + ops->free(dev, size, cpu_addr, dma_handle, attrs);
47 53 }
48 54  
49 55 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
arch/sparc/kernel/iommu.c
... ... @@ -280,7 +280,8 @@
280 280 }
281 281  
282 282 static void *dma_4u_alloc_coherent(struct device *dev, size_t size,
283   - dma_addr_t *dma_addrp, gfp_t gfp)
  283 + dma_addr_t *dma_addrp, gfp_t gfp,
  284 + struct dma_attrs *attrs)
284 285 {
285 286 unsigned long flags, order, first_page;
286 287 struct iommu *iommu;
... ... @@ -330,7 +331,8 @@
330 331 }
331 332  
332 333 static void dma_4u_free_coherent(struct device *dev, size_t size,
333   - void *cpu, dma_addr_t dvma)
  334 + void *cpu, dma_addr_t dvma,
  335 + struct dma_attrs *attrs)
334 336 {
335 337 struct iommu *iommu;
336 338 unsigned long flags, order, npages;
... ... @@ -825,8 +827,8 @@
825 827 }
826 828  
827 829 static struct dma_map_ops sun4u_dma_ops = {
828   - .alloc_coherent = dma_4u_alloc_coherent,
829   - .free_coherent = dma_4u_free_coherent,
  830 + .alloc = dma_4u_alloc_coherent,
  831 + .free = dma_4u_free_coherent,
830 832 .map_page = dma_4u_map_page,
831 833 .unmap_page = dma_4u_unmap_page,
832 834 .map_sg = dma_4u_map_sg,
arch/sparc/kernel/ioport.c
... ... @@ -261,7 +261,8 @@
261 261 * CPU may access them without any explicit flushing.
262 262 */
263 263 static void *sbus_alloc_coherent(struct device *dev, size_t len,
264   - dma_addr_t *dma_addrp, gfp_t gfp)
  264 + dma_addr_t *dma_addrp, gfp_t gfp,
  265 + struct dma_attrs *attrs)
265 266 {
266 267 struct platform_device *op = to_platform_device(dev);
267 268 unsigned long len_total = PAGE_ALIGN(len);
... ... @@ -315,7 +316,7 @@
315 316 }
316 317  
317 318 static void sbus_free_coherent(struct device *dev, size_t n, void *p,
318   - dma_addr_t ba)
  319 + dma_addr_t ba, struct dma_attrs *attrs)
319 320 {
320 321 struct resource *res;
321 322 struct page *pgv;
... ... @@ -407,8 +408,8 @@
407 408 }
408 409  
409 410 struct dma_map_ops sbus_dma_ops = {
410   - .alloc_coherent = sbus_alloc_coherent,
411   - .free_coherent = sbus_free_coherent,
  411 + .alloc = sbus_alloc_coherent,
  412 + .free = sbus_free_coherent,
412 413 .map_page = sbus_map_page,
413 414 .unmap_page = sbus_unmap_page,
414 415 .map_sg = sbus_map_sg,
... ... @@ -436,7 +437,8 @@
436 437 * hwdev should be valid struct pci_dev pointer for PCI devices.
437 438 */
438 439 static void *pci32_alloc_coherent(struct device *dev, size_t len,
439   - dma_addr_t *pba, gfp_t gfp)
  440 + dma_addr_t *pba, gfp_t gfp,
  441 + struct dma_attrs *attrs)
440 442 {
441 443 unsigned long len_total = PAGE_ALIGN(len);
442 444 void *va;
... ... @@ -489,7 +491,7 @@
489 491 * past this call are illegal.
490 492 */
491 493 static void pci32_free_coherent(struct device *dev, size_t n, void *p,
492   - dma_addr_t ba)
  494 + dma_addr_t ba, struct dma_attrs *attrs)
493 495 {
494 496 struct resource *res;
495 497  
... ... @@ -645,8 +647,8 @@
645 647 }
646 648  
647 649 struct dma_map_ops pci32_dma_ops = {
648   - .alloc_coherent = pci32_alloc_coherent,
649   - .free_coherent = pci32_free_coherent,
  650 + .alloc = pci32_alloc_coherent,
  651 + .free = pci32_free_coherent,
650 652 .map_page = pci32_map_page,
651 653 .unmap_page = pci32_unmap_page,
652 654 .map_sg = pci32_map_sg,
arch/sparc/kernel/pci_sun4v.c
... ... @@ -128,7 +128,8 @@
128 128 }
129 129  
130 130 static void *dma_4v_alloc_coherent(struct device *dev, size_t size,
131   - dma_addr_t *dma_addrp, gfp_t gfp)
  131 + dma_addr_t *dma_addrp, gfp_t gfp,
  132 + struct dma_attrs *attrs)
132 133 {
133 134 unsigned long flags, order, first_page, npages, n;
134 135 struct iommu *iommu;
... ... @@ -198,7 +199,7 @@
198 199 }
199 200  
200 201 static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu,
201   - dma_addr_t dvma)
  202 + dma_addr_t dvma, struct dma_attrs *attrs)
202 203 {
203 204 struct pci_pbm_info *pbm;
204 205 struct iommu *iommu;
... ... @@ -527,8 +528,8 @@
527 528 }
528 529  
529 530 static struct dma_map_ops sun4v_dma_ops = {
530   - .alloc_coherent = dma_4v_alloc_coherent,
531   - .free_coherent = dma_4v_free_coherent,
  531 + .alloc = dma_4v_alloc_coherent,
  532 + .free = dma_4v_free_coherent,
532 533 .map_page = dma_4v_map_page,
533 534 .unmap_page = dma_4v_unmap_page,
534 535 .map_sg = dma_4v_map_sg,