From a8522509200b460443a7ca59138dc63bec1b690a Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 29 Apr 2008 00:59:36 -0700 Subject: swiotlb: use iommu_is_span_boundary helper function iommu_is_span_boundary in lib/iommu-helper.c was exported for PARISC IOMMUs (commit 3715863aa142c4f4c5208f5f3e5e9bac06006d2f). SWIOTLB can use it instead of the homegrown function. Signed-off-by: FUJITA Tomonori Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: Tony Luck Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/swiotlb.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 256c8445e54..3c95922e51e 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -31,6 +31,7 @@ #include #include +#include #define OFFSET(val,align) ((unsigned long) \ ( (val) & ( (align) - 1))) @@ -282,15 +283,6 @@ address_needs_mapping(struct device *hwdev, dma_addr_t addr) return (addr & ~mask) != 0; } -static inline unsigned int is_span_boundary(unsigned int index, - unsigned int nslots, - unsigned long offset_slots, - unsigned long max_slots) -{ - unsigned long offset = (offset_slots + index) & (max_slots - 1); - return offset + nslots > max_slots; -} - /* * Allocates bounce buffer and returns its kernel virtual address. */ @@ -337,8 +329,8 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir) wrap = index; do { - while (is_span_boundary(index, nslots, offset_slots, - max_slots)) { + while (iommu_is_span_boundary(index, nslots, offset_slots, + max_slots)) { index += stride; if (index >= io_tlb_nslabs) index = 0; -- cgit v1.2.3