aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorGlauber Costa <gcosta@redhat.com>2008-04-08 12:21:04 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:19:58 -0400
commit45a07e774950ef479f8996c0e2c5550dd6440453 (patch)
treeae48fba44fa92f2b420d857730b2d268ddf5adf8 /arch/x86
parentd1a079029036881375110f78df47d352e7c28a77 (diff)
x86: use a fallback dev for i386
We can use a fallback dev for cases of a NULL device being passed (mostly ISA) This comes from x86_64 implementation. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/pci-dma_32.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c
index 0d630ae3d910..0600a37ba835 100644
--- a/arch/x86/kernel/pci-dma_32.c
+++ b/arch/x86/kernel/pci-dma_32.c
@@ -14,6 +14,16 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <asm/io.h> 15#include <asm/io.h>
16 16
17/* Dummy device used for NULL arguments (normally ISA). Better would
18 be probably a smaller DMA mask, but this is bug-to-bug compatible
19 to i386. */
20struct device fallback_dev = {
21 .bus_id = "fallback device",
22 .coherent_dma_mask = DMA_32BIT_MASK,
23 .dma_mask = &fallback_dev.coherent_dma_mask,
24};
25
26
17static int dma_alloc_from_coherent_mem(struct device *dev, ssize_t size, 27static int dma_alloc_from_coherent_mem(struct device *dev, ssize_t size,
18 dma_addr_t *dma_handle, void **ret) 28 dma_addr_t *dma_handle, void **ret)
19{ 29{
@@ -75,6 +85,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
75 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff)) 85 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
76 gfp |= GFP_DMA; 86 gfp |= GFP_DMA;
77 87
88 if (!dev)
89 dev = &fallback_dev;
90
78 page = dma_alloc_pages(dev, gfp, order); 91 page = dma_alloc_pages(dev, gfp, order);
79 if (page == NULL) 92 if (page == NULL)
80 return NULL; 93 return NULL;