diff options
author | Jaroslav Kysela <perex@suse.cz> | 2004-04-24 19:57:23 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2004-04-24 19:57:23 +0200 |
commit | adf81ab101c1505a8d1ebdcc875cb121c8180f45 (patch) | |
tree | 52b51561c55eaaa70690afe19d075ee0934e26de /sound | |
parent | bbc4ce241df19f2bb59fbf9313b35ff6a7d17889 (diff) | |
download | history-adf81ab101c1505a8d1ebdcc875cb121c8180f45.tar.gz |
ALSA CVS update - Takashi Iwai <tiwai@suse.de>
Memalloc module
fixed the allocation of coherent DMA pages under 32bit mask.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/memalloc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 655943b1b11111..e0c5623e2054dc 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -137,14 +137,17 @@ static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int flags) { void *ret; - u64 dma_mask; + u64 dma_mask, coherent_dma_mask; if (dev == NULL || !dev->dma_mask) return dma_alloc_coherent(dev, size, dma_handle, flags); dma_mask = *dev->dma_mask; + coherent_dma_mask = dev->coherent_dma_mask; *dev->dma_mask = 0xffffffff; /* do without masking */ + dev->coherent_dma_mask = 0xffffffff; /* do without masking */ ret = dma_alloc_coherent(dev, size, dma_handle, flags); *dev->dma_mask = dma_mask; /* restore */ + dev->coherent_dma_mask = coherent_dma_mask; /* restore */ if (ret) { /* obtained address is out of range? */ if (((unsigned long)*dma_handle + size - 1) & ~dma_mask) { @@ -154,8 +157,12 @@ static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, } } else { /* wish to success now with the proper mask... */ - if (dma_mask != 0xffffffffUL) + if (dma_mask != 0xffffffffUL) { + /* allocation with GFP_ATOMIC to avoid the long stall */ + flags &= ~GFP_KERNEL; + flags |= GFP_ATOMIC; ret = dma_alloc_coherent(dev, size, dma_handle, flags); + } } return ret; } |