diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-10-24 23:36:30 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2013-10-25 23:52:14 +0200 |
commit | 4f168a811ad5f88c30f6586478a58996b1df3e28 (patch) | |
tree | c03501fffa1df7978996163cdb2e978706c575b0 | |
parent | a3970e75ec215fc03f1edab5fa3a663bceae1812 (diff) |
backports: add dma_set_mask_and_coherent()
dma_set_mask_and_coherent() is used by some Broadcom drivers.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de
-rw-r--r-- | backport/backport-include/linux/dma-mapping.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/backport/backport-include/linux/dma-mapping.h b/backport/backport-include/linux/dma-mapping.h index eb786cf4..6c4973a5 100644 --- a/backport/backport-include/linux/dma-mapping.h +++ b/backport/backport-include/linux/dma-mapping.h @@ -90,4 +90,20 @@ static inline void dma_sync_single_range_for_device(struct device *dev, #endif /* arm */ #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(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. + */ +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_CODE < KERNEL_VERSION(3,13,0) */ + #endif /* __BACKPORT_LINUX_DMA_MAPPING_H */ |