diff options
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r-- | include/linux/dma-mapping.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index ac07ff090919..2e551e2d2d03 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _LINUX_DMA_MAPPING_H | 1 | #ifndef _LINUX_DMA_MAPPING_H |
2 | #define _LINUX_DMA_MAPPING_H | 2 | #define _LINUX_DMA_MAPPING_H |
3 | 3 | ||
4 | #include <linux/sizes.h> | ||
4 | #include <linux/string.h> | 5 | #include <linux/string.h> |
5 | #include <linux/device.h> | 6 | #include <linux/device.h> |
6 | #include <linux/err.h> | 7 | #include <linux/err.h> |
@@ -145,7 +146,9 @@ static inline void arch_teardown_dma_ops(struct device *dev) { } | |||
145 | 146 | ||
146 | static inline unsigned int dma_get_max_seg_size(struct device *dev) | 147 | static inline unsigned int dma_get_max_seg_size(struct device *dev) |
147 | { | 148 | { |
148 | return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; | 149 | if (dev->dma_parms && dev->dma_parms->max_segment_size) |
150 | return dev->dma_parms->max_segment_size; | ||
151 | return SZ_64K; | ||
149 | } | 152 | } |
150 | 153 | ||
151 | static inline unsigned int dma_set_max_seg_size(struct device *dev, | 154 | static inline unsigned int dma_set_max_seg_size(struct device *dev, |
@@ -154,14 +157,15 @@ static inline unsigned int dma_set_max_seg_size(struct device *dev, | |||
154 | if (dev->dma_parms) { | 157 | if (dev->dma_parms) { |
155 | dev->dma_parms->max_segment_size = size; | 158 | dev->dma_parms->max_segment_size = size; |
156 | return 0; | 159 | return 0; |
157 | } else | 160 | } |
158 | return -EIO; | 161 | return -EIO; |
159 | } | 162 | } |
160 | 163 | ||
161 | static inline unsigned long dma_get_seg_boundary(struct device *dev) | 164 | static inline unsigned long dma_get_seg_boundary(struct device *dev) |
162 | { | 165 | { |
163 | return dev->dma_parms ? | 166 | if (dev->dma_parms && dev->dma_parms->segment_boundary_mask) |
164 | dev->dma_parms->segment_boundary_mask : 0xffffffff; | 167 | return dev->dma_parms->segment_boundary_mask; |
168 | return DMA_BIT_MASK(32); | ||
165 | } | 169 | } |
166 | 170 | ||
167 | static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) | 171 | static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) |
@@ -169,8 +173,8 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) | |||
169 | if (dev->dma_parms) { | 173 | if (dev->dma_parms) { |
170 | dev->dma_parms->segment_boundary_mask = mask; | 174 | dev->dma_parms->segment_boundary_mask = mask; |
171 | return 0; | 175 | return 0; |
172 | } else | 176 | } |
173 | return -EIO; | 177 | return -EIO; |
174 | } | 178 | } |
175 | 179 | ||
176 | #ifndef dma_max_pfn | 180 | #ifndef dma_max_pfn |