]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
add is_buffer_dma_capable helper function
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 9 Sep 2008 16:06:46 +0000 (01:06 +0900)
committerIngo Molnar <mingo@elte.hu>
Wed, 10 Sep 2008 09:33:43 +0000 (11:33 +0200)
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>
include/linux/dma-mapping.h

index 952e0f857ac9d9545750bbd5f197df6034a99913..6ed50c1642f1c10f587602e2864d233dc40428d5 100644 (file)
@@ -48,6 +48,11 @@ static inline int is_device_dma_capable(struct device *dev)
        return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
 }
 
+static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
+{
+       return addr + size <= mask;
+}
+
 #ifdef CONFIG_HAS_DMA
 #include <asm/dma-mapping.h>
 #else