diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-10-09 19:06:24 +0200 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-10-14 01:35:26 +0200 |
commit | 8aa2659009714cf5f9ffe7f3e16ccfa8ff0e0d61 (patch) | |
tree | 070526522368d43ab8e0332a849474b44c80e980 /arch/powerpc/kernel/dma.c | |
parent | Merge commit 'kumar/kumar-next' (diff) | |
download | linux-8aa2659009714cf5f9ffe7f3e16ccfa8ff0e0d61.tar.xz linux-8aa2659009714cf5f9ffe7f3e16ccfa8ff0e0d61.zip |
powerpc: Fix DMA offset for non-coherent DMA
After Becky's work we can almost have different DMA offsets
between on-chip devices and PCI. Almost because there's a
problem with the non-coherent DMA code that basically ignores
the programmed offset to use the global one for everything.
This fixes it.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/dma.c')
-rw-r--r-- | arch/powerpc/kernel/dma.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 41fdd48bf433..1562daf8839a 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c @@ -30,11 +30,15 @@ static unsigned long get_dma_direct_offset(struct device *dev) void *dma_direct_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag) { + void *ret; #ifdef CONFIG_NOT_COHERENT_CACHE - return __dma_alloc_coherent(size, dma_handle, flag); + ret = __dma_alloc_coherent(size, dma_handle, flag); + if (ret == NULL) + return NULL; + *dma_handle += get_dma_direct_offset(dev); + return ret; #else struct page *page; - void *ret; int node = dev_to_node(dev); /* ignore region specifiers */ |