]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/kernel/dma.c
powerpc: Fix DMA offset for non-coherent DMA
[linux-2.6-omap-h63xx.git] / arch / powerpc / kernel / dma.c
index 41fdd48bf43393186bb897bc0ca041320f5a3041..1562daf8839a95d62c75e58e7af7b156787845bf 100644 (file)
@@ -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 */