]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/pci-nommu.c
Merge branch 'irq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / pci-nommu.c
index 8e398b56f50baa953cd9475b135cea5a2fb9b687..c70ab5a5d4c886a0856de8e0f313a97048d2c328 100644 (file)
@@ -14,7 +14,7 @@
 static int
 check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
 {
-       if (hwdev && bus + size > *hwdev->dma_mask) {
+       if (hwdev && !is_buffer_dma_capable(*hwdev->dma_mask, bus, size)) {
                if (*hwdev->dma_mask >= DMA_32BIT_MASK)
                        printk(KERN_ERR
                            "nommu_%s: overflow %Lx+%zu of device mask %Lx\n",
@@ -72,41 +72,6 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
        return nents;
 }
 
-static void *
-nommu_alloc_coherent(struct device *hwdev, size_t size,
-                    dma_addr_t *dma_addr, gfp_t gfp)
-{
-       unsigned long dma_mask;
-       int node;
-       struct page *page;
-
-       dma_mask = dma_alloc_coherent_mask(hwdev, gfp);
-
-       gfp |= __GFP_ZERO;
-
-       node = dev_to_node(hwdev);
-again:
-       page = alloc_pages_node(node, gfp, get_order(size));
-       if (!page)
-               return NULL;
-
-       if ((page_to_phys(page) + size > dma_mask) && !(gfp & GFP_DMA)) {
-               free_pages((unsigned long)page_address(page), get_order(size));
-               gfp |= GFP_DMA;
-               goto again;
-       }
-
-       *dma_addr = page_to_phys(page);
-       if (check_addr("alloc_coherent", hwdev, *dma_addr, size)) {
-               flush_write_buffers();
-               return page_address(page);
-       }
-
-       free_pages((unsigned long)page_address(page), get_order(size));
-
-       return NULL;
-}
-
 static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr,
                                dma_addr_t dma_addr)
 {
@@ -114,7 +79,7 @@ static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr,
 }
 
 struct dma_mapping_ops nommu_dma_ops = {
-       .alloc_coherent = nommu_alloc_coherent,
+       .alloc_coherent = dma_generic_alloc_coherent,
        .free_coherent = nommu_free_coherent,
        .map_single = nommu_map_single,
        .map_sg = nommu_map_sg,