]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
SPARC: adapt for dma_map_ops changes
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Tue, 27 Mar 2012 12:56:55 +0000 (14:56 +0200)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 28 Mar 2012 14:36:34 +0000 (16:36 +0200)
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>
arch/sparc/include/asm/dma-mapping.h
arch/sparc/kernel/iommu.c
arch/sparc/kernel/ioport.c
arch/sparc/kernel/pci_sun4v.c

index 8c0e4f7bb20484a674f663f30bf34789be6877d9..48a7c65731d2e0cf08ab2e974adcf922f2dddc58 100644 (file)
@@ -26,24 +26,30 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 
 #include <asm-generic/dma-mapping-common.h>
 
-static inline void *dma_alloc_coherent(struct device *dev, size_t size,
-                                      dma_addr_t *dma_handle, gfp_t flag)
+#define dma_alloc_coherent(d,s,h,f)    dma_alloc_attrs(d,s,h,f,NULL)
+
+static inline void *dma_alloc_attrs(struct device *dev, size_t size,
+                                   dma_addr_t *dma_handle, gfp_t flag,
+                                   struct dma_attrs *attrs)
 {
        struct dma_map_ops *ops = get_dma_ops(dev);
        void *cpu_addr;
 
-       cpu_addr = ops->alloc_coherent(dev, size, dma_handle, flag);
+       cpu_addr = ops->alloc(dev, size, dma_handle, flag, attrs);
        debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr);
        return cpu_addr;
 }
 
-static inline void dma_free_coherent(struct device *dev, size_t size,
-                                    void *cpu_addr, dma_addr_t dma_handle)
+#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
+
+static inline void dma_free_attrs(struct device *dev, size_t size,
+                                 void *cpu_addr, dma_addr_t dma_handle,
+                                 struct dma_attrs *attrs)
 {
        struct dma_map_ops *ops = get_dma_ops(dev);
 
        debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
-       ops->free_coherent(dev, size, cpu_addr, dma_handle);
+       ops->free(dev, size, cpu_addr, dma_handle, attrs);
 }
 
 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
index 4643d68713fa48d415d2aff92e1c86315ff91f6f..070ed141aac79728da15f406289219a9c385fe27 100644 (file)
@@ -280,7 +280,8 @@ static inline void iommu_free_ctx(struct iommu *iommu, int ctx)
 }
 
 static void *dma_4u_alloc_coherent(struct device *dev, size_t size,
-                                  dma_addr_t *dma_addrp, gfp_t gfp)
+                                  dma_addr_t *dma_addrp, gfp_t gfp,
+                                  struct dma_attrs *attrs)
 {
        unsigned long flags, order, first_page;
        struct iommu *iommu;
@@ -330,7 +331,8 @@ static void *dma_4u_alloc_coherent(struct device *dev, size_t size,
 }
 
 static void dma_4u_free_coherent(struct device *dev, size_t size,
-                                void *cpu, dma_addr_t dvma)
+                                void *cpu, dma_addr_t dvma,
+                                struct dma_attrs *attrs)
 {
        struct iommu *iommu;
        unsigned long flags, order, npages;
@@ -825,8 +827,8 @@ static void dma_4u_sync_sg_for_cpu(struct device *dev,
 }
 
 static struct dma_map_ops sun4u_dma_ops = {
-       .alloc_coherent         = dma_4u_alloc_coherent,
-       .free_coherent          = dma_4u_free_coherent,
+       .alloc                  = dma_4u_alloc_coherent,
+       .free                   = dma_4u_free_coherent,
        .map_page               = dma_4u_map_page,
        .unmap_page             = dma_4u_unmap_page,
        .map_sg                 = dma_4u_map_sg,
index d0479e2163faa8615b4a3cc6d75c1c87bb33d660..21bd73943f7f8c7b4421b5f1bd8f106433b8377a 100644 (file)
@@ -261,7 +261,8 @@ EXPORT_SYMBOL(sbus_set_sbus64);
  * CPU may access them without any explicit flushing.
  */
 static void *sbus_alloc_coherent(struct device *dev, size_t len,
-                                dma_addr_t *dma_addrp, gfp_t gfp)
+                                dma_addr_t *dma_addrp, gfp_t gfp,
+                                struct dma_attrs *attrs)
 {
        struct platform_device *op = to_platform_device(dev);
        unsigned long len_total = PAGE_ALIGN(len);
@@ -315,7 +316,7 @@ err_nopages:
 }
 
 static void sbus_free_coherent(struct device *dev, size_t n, void *p,
-                              dma_addr_t ba)
+                              dma_addr_t ba, struct dma_attrs *attrs)
 {
        struct resource *res;
        struct page *pgv;
@@ -407,8 +408,8 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 }
 
 struct dma_map_ops sbus_dma_ops = {
-       .alloc_coherent         = sbus_alloc_coherent,
-       .free_coherent          = sbus_free_coherent,
+       .alloc                  = sbus_alloc_coherent,
+       .free                   = sbus_free_coherent,
        .map_page               = sbus_map_page,
        .unmap_page             = sbus_unmap_page,
        .map_sg                 = sbus_map_sg,
@@ -436,7 +437,8 @@ arch_initcall(sparc_register_ioport);
  * hwdev should be valid struct pci_dev pointer for PCI devices.
  */
 static void *pci32_alloc_coherent(struct device *dev, size_t len,
-                                 dma_addr_t *pba, gfp_t gfp)
+                                 dma_addr_t *pba, gfp_t gfp,
+                                 struct dma_attrs *attrs)
 {
        unsigned long len_total = PAGE_ALIGN(len);
        void *va;
@@ -489,7 +491,7 @@ err_nopages:
  * past this call are illegal.
  */
 static void pci32_free_coherent(struct device *dev, size_t n, void *p,
-                               dma_addr_t ba)
+                               dma_addr_t ba, struct dma_attrs *attrs)
 {
        struct resource *res;
 
@@ -645,8 +647,8 @@ static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *
 }
 
 struct dma_map_ops pci32_dma_ops = {
-       .alloc_coherent         = pci32_alloc_coherent,
-       .free_coherent          = pci32_free_coherent,
+       .alloc                  = pci32_alloc_coherent,
+       .free                   = pci32_free_coherent,
        .map_page               = pci32_map_page,
        .unmap_page             = pci32_unmap_page,
        .map_sg                 = pci32_map_sg,
index af5755d20fbe91eb43b682e99aa8f836bfafa6ad..7661e84a05a06c23e34ef49fb5c63bfb69934761 100644 (file)
@@ -128,7 +128,8 @@ static inline long iommu_batch_end(void)
 }
 
 static void *dma_4v_alloc_coherent(struct device *dev, size_t size,
-                                  dma_addr_t *dma_addrp, gfp_t gfp)
+                                  dma_addr_t *dma_addrp, gfp_t gfp,
+                                  struct dma_attrs *attrs)
 {
        unsigned long flags, order, first_page, npages, n;
        struct iommu *iommu;
@@ -198,7 +199,7 @@ range_alloc_fail:
 }
 
 static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu,
-                                dma_addr_t dvma)
+                                dma_addr_t dvma, struct dma_attrs *attrs)
 {
        struct pci_pbm_info *pbm;
        struct iommu *iommu;
@@ -527,8 +528,8 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
 }
 
 static struct dma_map_ops sun4v_dma_ops = {
-       .alloc_coherent                 = dma_4v_alloc_coherent,
-       .free_coherent                  = dma_4v_free_coherent,
+       .alloc                          = dma_4v_alloc_coherent,
+       .free                           = dma_4v_free_coherent,
        .map_page                       = dma_4v_map_page,
        .unmap_page                     = dma_4v_unmap_page,
        .map_sg                         = dma_4v_map_sg,