[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 10 Sep 2008 01:06:46 +0900
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To: mingo@...hat.com
Cc: linux-kernel@...r.kernel.org, fujita.tomonori@....ntt.co.jp,
Tony Luck <tony.luck@...el.com>,
Joerg Roedel <joerg.roedel@....com>
Subject: [PATCH 1/4] 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@....ntt.co.jp>
Cc: Tony Luck <tony.luck@...el.com>
Cc: Joerg Roedel <joerg.roedel@....com>
---
include/linux/dma-mapping.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 952e0f8..6ed50c1 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 <asm/dma-mapping.h>
#else
--
1.5.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists