diff options
Diffstat (limited to 'include/linux/dma-mapping.h')
-rw-r--r-- | include/linux/dma-mapping.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 952e0f857ac9..ba9114ec5d3a 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -48,6 +48,11 @@ static inline int is_device_dma_capable(struct device *dev) | |||
48 | return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; | 48 | return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size) | ||
52 | { | ||
53 | return addr + size <= mask; | ||
54 | } | ||
55 | |||
51 | #ifdef CONFIG_HAS_DMA | 56 | #ifdef CONFIG_HAS_DMA |
52 | #include <asm/dma-mapping.h> | 57 | #include <asm/dma-mapping.h> |
53 | #else | 58 | #else |
@@ -58,6 +63,13 @@ static inline int is_device_dma_capable(struct device *dev) | |||
58 | #define dma_sync_single dma_sync_single_for_cpu | 63 | #define dma_sync_single dma_sync_single_for_cpu |
59 | #define dma_sync_sg dma_sync_sg_for_cpu | 64 | #define dma_sync_sg dma_sync_sg_for_cpu |
60 | 65 | ||
66 | static inline u64 dma_get_mask(struct device *dev) | ||
67 | { | ||
68 | if (dev && dev->dma_mask && *dev->dma_mask) | ||
69 | return *dev->dma_mask; | ||
70 | return DMA_32BIT_MASK; | ||
71 | } | ||
72 | |||
61 | extern u64 dma_get_required_mask(struct device *dev); | 73 | extern u64 dma_get_required_mask(struct device *dev); |
62 | 74 | ||
63 | static inline unsigned int dma_get_max_seg_size(struct device *dev) | 75 | static inline unsigned int dma_get_max_seg_size(struct device *dev) |