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.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index 67fa6bcd644c..b1bc954eccf3 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -340,4 +340,19 @@ static inline int dma_supported(struct device *dev, u64 mask)
}
#endif
+#ifndef HAVE_ARCH_DMA_SET_MASK
+static inline int dma_set_mask(struct device *dev, u64 mask)
+{
+ struct dma_map_ops *ops = get_dma_ops(dev);
+
+ if (ops->set_dma_mask)
+ return ops->set_dma_mask(dev, mask);
+
+ if (!dev->dma_mask || !dma_supported(dev, mask))
+ return -EIO;
+ *dev->dma_mask = mask;
+ return 0;
+}
+#endif
+
#endif