Skip to content

Commit

Permalink
xtensa: make dma_cache_sync a no-op
Browse files Browse the repository at this point in the history
xtensa does not implement DMA_ATTR_NON_CONSISTENT allocations, so it
doesn't make any sense to do any work in dma_cache_sync given that it
must be a no-op when dma_alloc_attrs returns coherent memory.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
  • Loading branch information
Christoph Hellwig committed Oct 19, 2017
1 parent a535bb8 commit d708e71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
6 changes: 4 additions & 2 deletions arch/xtensa/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
return &xtensa_dma_map_ops;
}

void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction direction);
static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction direction)
{
}

static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
{
Expand Down
23 changes: 0 additions & 23 deletions arch/xtensa/kernel/pci-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,6 @@
#include <asm/cacheflush.h>
#include <asm/io.h>

void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction dir)
{
switch (dir) {
case DMA_BIDIRECTIONAL:
__flush_invalidate_dcache_range((unsigned long)vaddr, size);
break;

case DMA_FROM_DEVICE:
__invalidate_dcache_range((unsigned long)vaddr, size);
break;

case DMA_TO_DEVICE:
__flush_dcache_range((unsigned long)vaddr, size);
break;

case DMA_NONE:
BUG();
break;
}
}
EXPORT_SYMBOL(dma_cache_sync);

static void do_cache_op(dma_addr_t dma_handle, size_t size,
void (*fn)(unsigned long, unsigned long))
{
Expand Down

0 comments on commit d708e71

Please sign in to comment.