From: FUJITA Tomonori Date: Tue, 9 Sep 2008 16:06:46 +0000 (+0900) Subject: add is_buffer_dma_capable helper function X-Git-Tag: v2.6.28-rc1~712^2^4~50 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=636dc67cbf8c481a996faf6c23f0532d0f02ebad;p=linux-2.6-omap-h63xx.git 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 Acked-by: Joerg Roedel Signed-off-by: Ingo Molnar --- diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 952e0f857ac..6ed50c1642f 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) 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 #else