x86: move pci-nommu's dma_mask check to common code
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Mon, 8 Sep 2008 09:10:11 +0000 (18:10 +0900)
committerIngo Molnar <mingo@elte.hu>
Mon, 8 Sep 2008 13:50:06 +0000 (15:50 +0200)
The check to see if dev->dma_mask is NULL in pci-nommu is more
appropriate for dma_alloc_coherent().

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/pci-nommu.c
include/asm-x86/dma-mapping.h

index 73853d3fdcacfec32d1fb4adb697c9ec9e8f0e9f..0f51883cc6a87171178f3f2fa571040dd2de7d18 100644 (file)
@@ -80,9 +80,6 @@ nommu_alloc_coherent(struct device *hwdev, size_t size,
        int node;
        struct page *page;
 
-       if (hwdev->dma_mask == NULL)
-               return NULL;
-
        gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
        gfp |= __GFP_ZERO;
 
index 3a9a6f5e681a7805044688bc6389f5112afd4783..088c56814aa31158642c4d0a062d4ac04aa36704 100644 (file)
@@ -254,6 +254,9 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
                gfp |= GFP_DMA;
        }
 
+       if (!dev->dma_mask)
+               return NULL;
+
        if (ops->alloc_coherent)
                return ops->alloc_coherent(dev, size,
                                dma_handle, gfp);