diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-06-26 08:49:44 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-09-17 10:32:37 -0400 |
commit | 4aa806b771d16b810771d86ce23c4c3160888db3 (patch) | |
tree | 5450d1495c1ffbb6d852df44002b95de275deb3f /include/linux | |
parent | 272b98c6455f00884f0350f775c5342358ebb73f (diff) |
DMA-API: provide a helper to set both DMA and coherent DMA masks
Provide a helper to set both the DMA and coherent DMA masks to the
same value - this avoids duplicated code in a number of drivers,
sometimes with buggy error handling, and also allows us identify
which drivers do things differently.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/dma-mapping.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 3a8d0a2af607..ec951f98e3d9 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -97,6 +97,20 @@ static inline int dma_set_coherent_mask(struct device *dev, u64 mask) | |||
97 | } | 97 | } |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | /* | ||
101 | * Set both the DMA mask and the coherent DMA mask to the same thing. | ||
102 | * Note that we don't check the return value from dma_set_coherent_mask() | ||
103 | * as the DMA API guarantees that the coherent DMA mask can be set to | ||
104 | * the same or smaller than the streaming DMA mask. | ||
105 | */ | ||
106 | static inline int dma_set_mask_and_coherent(struct device *dev, u64 mask) | ||
107 | { | ||
108 | int rc = dma_set_mask(dev, mask); | ||
109 | if (rc == 0) | ||
110 | dma_set_coherent_mask(dev, mask); | ||
111 | return rc; | ||
112 | } | ||
113 | |||
100 | extern u64 dma_get_required_mask(struct device *dev); | 114 | extern u64 dma_get_required_mask(struct device *dev); |
101 | 115 | ||
102 | static inline unsigned int dma_get_max_seg_size(struct device *dev) | 116 | static inline unsigned int dma_get_max_seg_size(struct device *dev) |