]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
dma-mapping: simplify the dma_sync_single_range_for_{cpu,device} implementation
authorChristoph Hellwig <hch@lst.de>
Mon, 3 Dec 2018 13:58:59 +0000 (14:58 +0100)
committerChristoph Hellwig <hch@lst.de>
Thu, 13 Dec 2018 20:06:08 +0000 (21:06 +0100)
We can just call the regular calls after adding offset the the address instead
of reimplementing them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Tested-by: Jesper Dangaard Brouer <brouer@redhat.com>
Tested-by: Tony Luck <tony.luck@intel.com>
include/linux/dma-debug.h
include/linux/dma-mapping.h
kernel/dma/debug.c

index 46e6131a72b691ee848065077510cb8b064575a2..2ad5c363d7d57e55b8a83adac03ba2647856887f 100644 (file)
@@ -70,17 +70,6 @@ extern void debug_dma_sync_single_for_device(struct device *dev,
                                             dma_addr_t dma_handle,
                                             size_t size, int direction);
 
-extern void debug_dma_sync_single_range_for_cpu(struct device *dev,
-                                               dma_addr_t dma_handle,
-                                               unsigned long offset,
-                                               size_t size,
-                                               int direction);
-
-extern void debug_dma_sync_single_range_for_device(struct device *dev,
-                                                  dma_addr_t dma_handle,
-                                                  unsigned long offset,
-                                                  size_t size, int direction);
-
 extern void debug_dma_sync_sg_for_cpu(struct device *dev,
                                      struct scatterlist *sg,
                                      int nelems, int direction);
@@ -167,22 +156,6 @@ static inline void debug_dma_sync_single_for_device(struct device *dev,
 {
 }
 
-static inline void debug_dma_sync_single_range_for_cpu(struct device *dev,
-                                                      dma_addr_t dma_handle,
-                                                      unsigned long offset,
-                                                      size_t size,
-                                                      int direction)
-{
-}
-
-static inline void debug_dma_sync_single_range_for_device(struct device *dev,
-                                                         dma_addr_t dma_handle,
-                                                         unsigned long offset,
-                                                         size_t size,
-                                                         int direction)
-{
-}
-
 static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
                                             struct scatterlist *sg,
                                             int nelems, int direction)
index 7799c2b278499db5f617bc420f9d9e136afa8822..8916499d280505714853bbeb353e0359711392dc 100644 (file)
@@ -360,6 +360,13 @@ static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
        debug_dma_sync_single_for_cpu(dev, addr, size, dir);
 }
 
+static inline void dma_sync_single_range_for_cpu(struct device *dev,
+               dma_addr_t addr, unsigned long offset, size_t size,
+               enum dma_data_direction dir)
+{
+       return dma_sync_single_for_cpu(dev, addr + offset, size, dir);
+}
+
 static inline void dma_sync_single_for_device(struct device *dev,
                                              dma_addr_t addr, size_t size,
                                              enum dma_data_direction dir)
@@ -372,32 +379,11 @@ static inline void dma_sync_single_for_device(struct device *dev,
        debug_dma_sync_single_for_device(dev, addr, size, dir);
 }
 
-static inline void dma_sync_single_range_for_cpu(struct device *dev,
-                                                dma_addr_t addr,
-                                                unsigned long offset,
-                                                size_t size,
-                                                enum dma_data_direction dir)
-{
-       const struct dma_map_ops *ops = get_dma_ops(dev);
-
-       BUG_ON(!valid_dma_direction(dir));
-       if (ops->sync_single_for_cpu)
-               ops->sync_single_for_cpu(dev, addr + offset, size, dir);
-       debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
-}
-
 static inline void dma_sync_single_range_for_device(struct device *dev,
-                                                   dma_addr_t addr,
-                                                   unsigned long offset,
-                                                   size_t size,
-                                                   enum dma_data_direction dir)
+               dma_addr_t addr, unsigned long offset, size_t size,
+               enum dma_data_direction dir)
 {
-       const struct dma_map_ops *ops = get_dma_ops(dev);
-
-       BUG_ON(!valid_dma_direction(dir));
-       if (ops->sync_single_for_device)
-               ops->sync_single_for_device(dev, addr + offset, size, dir);
-       debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
+       return dma_sync_single_for_device(dev, addr + offset, size, dir);
 }
 
 static inline void
index 20ab0f6c1b70a1af6dee02f0970da5b3665b1c95..164706da2a73ff59e8c422abdecb892dbb67ae88 100644 (file)
@@ -1633,48 +1633,6 @@ void debug_dma_sync_single_for_device(struct device *dev,
 }
 EXPORT_SYMBOL(debug_dma_sync_single_for_device);
 
-void debug_dma_sync_single_range_for_cpu(struct device *dev,
-                                        dma_addr_t dma_handle,
-                                        unsigned long offset, size_t size,
-                                        int direction)
-{
-       struct dma_debug_entry ref;
-
-       if (unlikely(dma_debug_disabled()))
-               return;
-
-       ref.type         = dma_debug_single;
-       ref.dev          = dev;
-       ref.dev_addr     = dma_handle;
-       ref.size         = offset + size;
-       ref.direction    = direction;
-       ref.sg_call_ents = 0;
-
-       check_sync(dev, &ref, true);
-}
-EXPORT_SYMBOL(debug_dma_sync_single_range_for_cpu);
-
-void debug_dma_sync_single_range_for_device(struct device *dev,
-                                           dma_addr_t dma_handle,
-                                           unsigned long offset,
-                                           size_t size, int direction)
-{
-       struct dma_debug_entry ref;
-
-       if (unlikely(dma_debug_disabled()))
-               return;
-
-       ref.type         = dma_debug_single;
-       ref.dev          = dev;
-       ref.dev_addr     = dma_handle;
-       ref.size         = offset + size;
-       ref.direction    = direction;
-       ref.sg_call_ents = 0;
-
-       check_sync(dev, &ref, false);
-}
-EXPORT_SYMBOL(debug_dma_sync_single_range_for_device);
-
 void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
                               int nelems, int direction)
 {