summaryrefslogtreecommitdiff
path: root/include/asm-generic/dma-mapping-common.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic/dma-mapping-common.h')
-rw-r--r--include/asm-generic/dma-mapping-common.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index ec321dd98f93..cdaa24193d4c 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -313,4 +313,18 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size,
dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
}
+static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
+{
+ debug_dma_mapping_error(dev, dma_addr);
+
+ if (get_dma_ops(dev)->mapping_error)
+ return get_dma_ops(dev)->mapping_error(dev, dma_addr);
+
+#ifdef DMA_ERROR_CODE
+ return dma_addr == DMA_ERROR_CODE;
+#else
+ return 0;
+#endif
+}
+
#endif