From e34cb44ac7c08783b98a16eec70125e205e6eb12 Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Tue, 21 Nov 2017 12:59:41 +0000 Subject: initial commit Generated againts 4.14 kernel source with git backports 1d8cc151d365582b42be00af776270b834a7a37d --- backport-include/linux/dma-mapping.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 backport-include/linux/dma-mapping.h (limited to 'backport-include/linux/dma-mapping.h') diff --git a/backport-include/linux/dma-mapping.h b/backport-include/linux/dma-mapping.h new file mode 100644 index 0000000..16b0e3c --- /dev/null +++ b/backport-include/linux/dma-mapping.h @@ -0,0 +1,35 @@ +#ifndef __BACKPORT_LINUX_DMA_MAPPING_H +#define __BACKPORT_LINUX_DMA_MAPPING_H +#include_next +#include + +#if LINUX_VERSION_IS_LESS(3,2,0) +#define dma_zalloc_coherent LINUX_BACKPORT(dma_zalloc_coherent) +static inline void *dma_zalloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t flag) +{ + void *ret = dma_alloc_coherent(dev, size, dma_handle, flag); + if (ret) + memset(ret, 0, size); + return ret; +} +#endif + +#if LINUX_VERSION_IS_LESS(3,13,0) +/* + * Set both the DMA mask and the coherent DMA mask to the same thing. + * Note that we don't check the return value from dma_set_coherent_mask() + * as the DMA API guarantees that the coherent DMA mask can be set to + * the same or smaller than the streaming DMA mask. + */ +#define dma_set_mask_and_coherent LINUX_BACKPORT(dma_set_mask_and_coherent) +static inline int dma_set_mask_and_coherent(struct device *dev, u64 mask) +{ + int rc = dma_set_mask(dev, mask); + if (rc == 0) + dma_set_coherent_mask(dev, mask); + return rc; +} +#endif /* LINUX_VERSION_IS_LESS(3,13,0) */ + +#endif /* __BACKPORT_LINUX_DMA_MAPPING_H */ -- cgit v1.2.3