Commit c143d43a authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Linus Torvalds
Browse files

alpha: fix ALSA DMA mmap crash



Make dma_alloc_coherent respect gfp flags (__GFP_COMP is one that
matters).
Signed-off-by: default avatarIvan Kokshaysky <ink@jurassic.park.msu.ru>
Tested-by: default avatarMichael 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 39d4c922
...@@ -424,11 +424,13 @@ EXPORT_SYMBOL(pci_unmap_page); ...@@ -424,11 +424,13 @@ EXPORT_SYMBOL(pci_unmap_page);
else DMA_ADDRP is undefined. */ else DMA_ADDRP is undefined. */
void * void *
pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) __pci_alloc_consistent(struct pci_dev *pdev, size_t size,
dma_addr_t *dma_addrp, gfp_t gfp)
{ {
void *cpu_addr; void *cpu_addr;
long order = get_order(size); long order = get_order(size);
gfp_t gfp = GFP_ATOMIC;
gfp &= ~GFP_DMA;
try_again: try_again:
cpu_addr = (void *)__get_free_pages(gfp, order); cpu_addr = (void *)__get_free_pages(gfp, order);
...@@ -458,7 +460,7 @@ pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp) ...@@ -458,7 +460,7 @@ pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp)
return cpu_addr; return cpu_addr;
} }
EXPORT_SYMBOL(pci_alloc_consistent); EXPORT_SYMBOL(__pci_alloc_consistent);
/* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
be values that were returned from pci_alloc_consistent. SIZE must be values that were returned from pci_alloc_consistent. SIZE must
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#define dma_unmap_single(dev, addr, size, dir) \ #define dma_unmap_single(dev, addr, size, dir) \
pci_unmap_single(alpha_gendev_to_pci(dev), addr, size, dir) pci_unmap_single(alpha_gendev_to_pci(dev), addr, size, dir)
#define dma_alloc_coherent(dev, size, addr, gfp) \ #define dma_alloc_coherent(dev, size, addr, gfp) \
pci_alloc_consistent(alpha_gendev_to_pci(dev), size, addr) __pci_alloc_consistent(alpha_gendev_to_pci(dev), size, addr, gfp)
#define dma_free_coherent(dev, size, va, addr) \ #define dma_free_coherent(dev, size, va, addr) \
pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr) pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr)
#define dma_map_page(dev, page, off, size, dir) \ #define dma_map_page(dev, page, off, size, dir) \
......
...@@ -76,7 +76,13 @@ extern inline void pcibios_penalize_isa_irq(int irq, int active) ...@@ -76,7 +76,13 @@ extern inline void pcibios_penalize_isa_irq(int irq, int active)
successful and sets *DMA_ADDRP to the pci side dma address as well, successful and sets *DMA_ADDRP to the pci side dma address as well,
else DMA_ADDRP is undefined. */ else DMA_ADDRP is undefined. */
extern void *pci_alloc_consistent(struct pci_dev *, size_t, dma_addr_t *); extern void *__pci_alloc_consistent(struct pci_dev *, size_t,
dma_addr_t *, gfp_t);
static inline void *
pci_alloc_consistent(struct pci_dev *dev, size_t size, dma_addr_t *dma)
{
return __pci_alloc_consistent(dev, size, dma, GFP_ATOMIC);
}
/* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
be values that were returned from pci_alloc_consistent. SIZE must be values that were returned from pci_alloc_consistent. SIZE must
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment