diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-04-12 13:24:58 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-04-15 11:32:47 +0200 |
commit | 6dcd6bf4f82013f306550c4695dffbd95f8519c0 (patch) | |
tree | d4bda77f820d982b37ab74f722e3a5105d105366 /backport/backport-include/linux/dma-mapping.h | |
parent | ad6ddbc1f461f7037c4f5ecf472d361a4a11102a (diff) |
backports: dissolve compat-2.6.34.h
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'backport/backport-include/linux/dma-mapping.h')
-rw-r--r-- | backport/backport-include/linux/dma-mapping.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/backport/backport-include/linux/dma-mapping.h b/backport/backport-include/linux/dma-mapping.h index 091e505e..540355a6 100644 --- a/backport/backport-include/linux/dma-mapping.h +++ b/backport/backport-include/linux/dma-mapping.h @@ -14,4 +14,36 @@ static inline void *dma_zalloc_coherent(struct device *dev, size_t size, } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) +/* only include this if DEFINE_DMA_UNMAP_ADDR is not set as debian squeeze also backports this */ +#ifndef DEFINE_DMA_UNMAP_ADDR +#ifdef CONFIG_NEED_DMA_MAP_STATE +#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME +#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME +#define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) +#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL)) +#define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) +#define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) +#else +#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) +#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) +#define dma_unmap_addr(PTR, ADDR_NAME) (0) +#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) +#define dma_unmap_len(PTR, LEN_NAME) (0) +#define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) +#endif +#endif + +/* mask dma_set_coherent_mask as debian squeeze also backports this */ +#define dma_set_coherent_mask LINUX_BACKPORT(dma_set_coherent_mask) + +static inline int dma_set_coherent_mask(struct device *dev, u64 mask) +{ + if (!dma_supported(dev, mask)) + return -EIO; + dev->coherent_dma_mask = mask; + return 0; +} +#endif /* < 2.6.34 */ + #endif /* __BACKPORT_LINUX_DMA_MAPPING_H */ |