alpha/dma: use common noop dma ops
authorChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 3 Feb 2016 05:46:33 +0000 (21:46 -0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 2 Mar 2016 15:01:55 +0000 (17:01 +0200)
Some of the alpha pci noop dma ops are identical to the common ones.
Use them.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
arch/alpha/kernel/pci-noop.c

index 2b1f4a1e92723bf67450c3d3ba4006e792971c70..8e735b5e56bd338873d17173960da02dc3cd260a 100644 (file)
@@ -123,44 +123,6 @@ static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
        return ret;
 }
 
-static void alpha_noop_free_coherent(struct device *dev, size_t size,
-                                    void *cpu_addr, dma_addr_t dma_addr,
-                                    struct dma_attrs *attrs)
-{
-       free_pages((unsigned long)cpu_addr, get_order(size));
-}
-
-static dma_addr_t alpha_noop_map_page(struct device *dev, struct page *page,
-                                     unsigned long offset, size_t size,
-                                     enum dma_data_direction dir,
-                                     struct dma_attrs *attrs)
-{
-       return page_to_pa(page) + offset;
-}
-
-static int alpha_noop_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
-                            enum dma_data_direction dir, struct dma_attrs *attrs)
-{
-       int i;
-       struct scatterlist *sg;
-
-       for_each_sg(sgl, sg, nents, i) {
-               void *va;
-
-               BUG_ON(!sg_page(sg));
-               va = sg_virt(sg);
-               sg_dma_address(sg) = (dma_addr_t)virt_to_phys(va);
-               sg_dma_len(sg) = sg->length;
-       }
-
-       return nents;
-}
-
-static int alpha_noop_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-       return 0;
-}
-
 static int alpha_noop_supported(struct device *dev, u64 mask)
 {
        return mask < 0x00ffffffUL ? 0 : 1;
@@ -168,10 +130,10 @@ static int alpha_noop_supported(struct device *dev, u64 mask)
 
 struct dma_map_ops alpha_noop_ops = {
        .alloc                  = alpha_noop_alloc_coherent,
-       .free                   = alpha_noop_free_coherent,
-       .map_page               = alpha_noop_map_page,
-       .map_sg                 = alpha_noop_map_sg,
-       .mapping_error          = alpha_noop_mapping_error,
+       .free                   = dma_noop_free_coherent,
+       .map_page               = dma_noop_map_page,
+       .map_sg                 = dma_noop_map_sg,
+       .mapping_error          = dma_noop_mapping_error,
        .dma_supported          = alpha_noop_supported,
 };