Commit 636dc67cbf8c481a996faf6c23f0532d0f02ebad
Committed by
Ingo Molnar
1 parent
e92b4fdacc
Exists in
master
and in
7 other branches
add is_buffer_dma_capable helper function
is_buffer_dma_capable helper function is to see if a memory region is DMA-capable or not. The arugments are the dma_mask (or coherent_dma_mask) of a device and the address and size of a memory region. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff
include/linux/dma-mapping.h
... | ... | @@ -48,6 +48,11 @@ |
48 | 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 | 56 | #ifdef CONFIG_HAS_DMA |
52 | 57 | #include <asm/dma-mapping.h> |
53 | 58 | #else |