diff options
Diffstat (limited to 'arch/x86/kernel/pci-dma.c')
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 81862d0c7a9a..7747bc82b11d 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -386,11 +386,13 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
386 | if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) | 386 | if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) |
387 | return memory; | 387 | return memory; |
388 | 388 | ||
389 | if (!dev) | 389 | if (!dev) { |
390 | dev = &fallback_dev; | 390 | dev = &fallback_dev; |
391 | gfp |= GFP_DMA; | ||
392 | } | ||
391 | dma_mask = dev->coherent_dma_mask; | 393 | dma_mask = dev->coherent_dma_mask; |
392 | if (dma_mask == 0) | 394 | if (dma_mask == 0) |
393 | dma_mask = DMA_32BIT_MASK; | 395 | dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK; |
394 | 396 | ||
395 | /* Device not DMA able */ | 397 | /* Device not DMA able */ |
396 | if (dev->dma_mask == NULL) | 398 | if (dev->dma_mask == NULL) |
@@ -404,7 +406,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
404 | larger than 16MB and in this case we have a chance of | 406 | larger than 16MB and in this case we have a chance of |
405 | finding fitting memory in the next higher zone first. If | 407 | finding fitting memory in the next higher zone first. If |
406 | not retry with true GFP_DMA. -AK */ | 408 | not retry with true GFP_DMA. -AK */ |
407 | if (dma_mask <= DMA_32BIT_MASK) | 409 | if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) |
408 | gfp |= GFP_DMA32; | 410 | gfp |= GFP_DMA32; |
409 | #endif | 411 | #endif |
410 | 412 | ||