[PATCH] dma-debug: Allow archs to override check_for_illegal_area

From: Joerg Roedel
Date: Tue Aug 11 2009 - 11:43:19 EST


For some architectures (like sparc32) the default
check_for_illegal_area function does not work reliable. This patch
makes this function a weak symbol allowing architectures to override
it if necessary.

Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx>
---
lib/dma-debug.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 65b0d99..4f6ad34 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -866,7 +866,9 @@ static inline bool overlap(void *addr, unsigned long len, void *start, void *end
return !(b1 <= a2 || a1 >= b2);
}

-static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len)
+void __weak dma_debug_check_for_illegal_area(struct device *dev,
+ void *addr,
+ unsigned long len)
{
if (overlap(addr, len, _text, _etext) ||
overlap(addr, len, __start_rodata, __end_rodata))
@@ -971,7 +973,7 @@ void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
void *addr = page_address(page) + offset;

check_for_stack(dev, addr);
- check_for_illegal_area(dev, addr, size);
+ dma_debug_check_for_illegal_area(dev, addr, size);
}

add_dma_entry(entry);
@@ -1025,7 +1027,8 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,

if (!PageHighMem(sg_page(s))) {
check_for_stack(dev, sg_virt(s));
- check_for_illegal_area(dev, sg_virt(s), sg_dma_len(s));
+ dma_debug_check_for_illegal_area(dev, sg_virt(s),
+ sg_dma_len(s));
}

add_dma_entry(entry);
--
1.6.3.3


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/