diff options
author | Mark Brown <broonie@kernel.org> | 2014-10-09 18:02:47 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-10-09 18:02:47 +0100 |
commit | 2606d2448703e8995ca39a59d8a1106a1e0f034a (patch) | |
tree | 588f1b850a7e13d0e2f3461d66909db55c7531fb /include/linux/dma-mapping.h | |
parent | 8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff) | |
parent | b8a669d29702a8fb529f4fae450a86b8676b0e42 (diff) |
Merge tag 'kvm-for-lsk-v3.10-v1' of git://git.linaro.org/people/christoffer.dall/linux-kvm-arm into lsk-v3.10-kvmv3.10/topic/kvm
KVM/ARM/arm64 Support for LSK v3.10
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r-- | include/linux/dma-mapping.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 94af41858513..48ef6f50d86c 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -97,6 +97,30 @@ static inline int dma_set_coherent_mask(struct device *dev, u64 mask) } #endif +/* + * 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; +} + +/* + * Similar to the above, except it deals with the case where the device + * does not have dev->dma_mask appropriately setup. + */ +static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) +{ + dev->dma_mask = &dev->coherent_dma_mask; + return dma_set_mask_and_coherent(dev, mask); +} + extern u64 dma_get_required_mask(struct device *dev); static inline unsigned int dma_get_max_seg_size(struct device *dev) |