diff options
author | Ivan Kokshaysky <ink@jurassic.park.msu.ru> | 2008-04-02 16:04:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-02 18:28:19 -0400 |
commit | c143d43aa3149b83e4b40624a27aa2b18638afec (patch) | |
tree | e179afebfec65a61e2d71d87a35b27950256daaf | |
parent | 39d4c922b596633da86878b1a5cc881785b8e5fa (diff) |
alpha: fix ALSA DMA mmap crash
Make dma_alloc_coherent respect gfp flags (__GFP_COMP is one that
matters).
Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Tested-by: Michael Cree <mcree@orcon.net.nz>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/alpha/kernel/pci_iommu.c | 8 | ||||
-rw-r--r-- | include/asm-alpha/dma-mapping.h | 2 | ||||
-rw-r--r-- | include/asm-alpha/pci.h | 8 |
3 files changed, 13 insertions, 5 deletions
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index 4e1c08636edd..dd6e334ab9e1 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c | |||
@@ -424,11 +424,13 @@ EXPORT_SYMBOL(pci_unmap_page); | |||
424 | else DMA_ADDRP is undefined. */ | 424 | else DMA_ADDRP is undefined. */ |
425 | 425 | ||
426 | void * | 426 | void * |
427 | pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) | 427 | __pci_alloc_consistent(struct pci_dev *pdev, size_t size, |
428 | dma_addr_t *dma_addrp, gfp_t gfp) | ||
428 | { | 429 | { |
429 | void *cpu_addr; | 430 | void *cpu_addr; |
430 | long order = get_order(size); | 431 | long order = get_order(size); |
431 | gfp_t gfp = GFP_ATOMIC; | 432 | |
433 | gfp &= ~GFP_DMA; | ||
432 | 434 | ||
433 | try_again: | 435 | try_again: |
434 | cpu_addr = (void *)__get_free_pages(gfp, order); | 436 | cpu_addr = (void *)__get_free_pages(gfp, order); |
@@ -458,7 +460,7 @@ try_again: | |||
458 | 460 | ||
459 | return cpu_addr; | 461 | return cpu_addr; |
460 | } | 462 | } |
461 | EXPORT_SYMBOL(pci_alloc_consistent); | 463 | EXPORT_SYMBOL(__pci_alloc_consistent); |
462 | 464 | ||
463 | /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must | 465 | /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must |
464 | be values that were returned from pci_alloc_consistent. SIZE must | 466 | be values that were returned from pci_alloc_consistent. SIZE must |
diff --git a/include/asm-alpha/dma-mapping.h b/include/asm-alpha/dma-mapping.h index 75a1aff5b57b..db351d1296f4 100644 --- a/include/asm-alpha/dma-mapping.h +++ b/include/asm-alpha/dma-mapping.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #define dma_unmap_single(dev, addr, size, dir) \ | 11 | #define dma_unmap_single(dev, addr, size, dir) \ |
12 | pci_unmap_single(alpha_gendev_to_pci(dev), addr, size, dir) | 12 | pci_unmap_single(alpha_gendev_to_pci(dev), addr, size, dir) |
13 | #define dma_alloc_coherent(dev, size, addr, gfp) \ | 13 | #define dma_alloc_coherent(dev, size, addr, gfp) \ |
14 | pci_alloc_consistent(alpha_gendev_to_pci(dev), size, addr) | 14 | __pci_alloc_consistent(alpha_gendev_to_pci(dev), size, addr, gfp) |
15 | #define dma_free_coherent(dev, size, va, addr) \ | 15 | #define dma_free_coherent(dev, size, va, addr) \ |
16 | pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr) | 16 | pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr) |
17 | #define dma_map_page(dev, page, off, size, dir) \ | 17 | #define dma_map_page(dev, page, off, size, dir) \ |
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h index d5b10ef64364..d31fd49ff79a 100644 --- a/include/asm-alpha/pci.h +++ b/include/asm-alpha/pci.h | |||
@@ -76,7 +76,13 @@ extern inline void pcibios_penalize_isa_irq(int irq, int active) | |||
76 | successful and sets *DMA_ADDRP to the pci side dma address as well, | 76 | successful and sets *DMA_ADDRP to the pci side dma address as well, |
77 | else DMA_ADDRP is undefined. */ | 77 | else DMA_ADDRP is undefined. */ |
78 | 78 | ||
79 | extern void *pci_alloc_consistent(struct pci_dev *, size_t, dma_addr_t *); | 79 | extern void *__pci_alloc_consistent(struct pci_dev *, size_t, |
80 | dma_addr_t *, gfp_t); | ||
81 | static inline void * | ||
82 | pci_alloc_consistent(struct pci_dev *dev, size_t size, dma_addr_t *dma) | ||
83 | { | ||
84 | return __pci_alloc_consistent(dev, size, dma, GFP_ATOMIC); | ||
85 | } | ||
80 | 86 | ||
81 | /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must | 87 | /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must |
82 | be values that were returned from pci_alloc_consistent. SIZE must | 88 | be values that were returned from pci_alloc_consistent. SIZE must |