diff -Naurp -x'*~' linux-source-2.6.18/include/asm-powerpc/dma-mapping.h linux-source-2.6.18-test/include/asm-powerpc/dma-mapping.h --- linux-source-2.6.18/include/asm-powerpc/dma-mapping.h 2006-09-20 05:42:06.000000000 +0200 +++ linux-source-2.6.18-test/include/asm-powerpc/dma-mapping.h 2008-06-04 22:54:14.000000000 +0200 @@ -104,6 +104,27 @@ static inline void *dma_alloc_coherent(s #endif } +static inline void *dma_std_alloc_coherent(struct device *dev, size_t size, + dma_addr_t * dma_handle, + gfp_t gfp) +{ + void *ret; + /* ignore region specifiers */ + gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); + + if (dev == NULL || dev->coherent_dma_mask < 0xffffffff) + gfp |= GFP_DMA; + + ret = (void *)__get_free_pages(gfp, get_order(size)); + + if (ret != NULL) { + memset(ret, 0, size); + *dma_handle = virt_to_bus(ret); + } + + return ret; +} + static inline void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) @@ -115,6 +136,13 @@ dma_free_coherent(struct device *dev, si #endif } +static inline void +dma_std_free_coherent(struct device *dev, size_t size, void *vaddr, + dma_addr_t dma_handle) +{ + free_pages((unsigned long)vaddr, get_order(size)); +} + static inline dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, enum dma_data_direction direction) diff -Naurp -x'*~' linux-source-2.6.18/sound/core/memalloc.c linux-source-2.6.18-test/sound/core/memalloc.c --- linux-source-2.6.18/sound/core/memalloc.c 2008-05-08 00:10:13.000000000 +0200 +++ linux-source-2.6.18-test/sound/core/memalloc.c 2008-06-04 22:55:43.000000000 +0200 @@ -108,20 +108,20 @@ static void *snd_dma_hack_alloc_coherent u64 dma_mask, coherent_dma_mask; if (dev == NULL || !dev->dma_mask) - return dma_alloc_coherent(dev, size, dma_handle, flags); + return dma_std_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); + ret = dma_std_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) { /* reallocate with the proper mask */ - dma_free_coherent(dev, size, ret, *dma_handle); - ret = dma_alloc_coherent(dev, size, dma_handle, flags); + dma_std_free_coherent(dev, size, ret, *dma_handle); + ret = dma_std_alloc_coherent(dev, size, dma_handle, flags); } } else { /* wish to success now with the proper mask... */ @@ -129,15 +129,15 @@ static void *snd_dma_hack_alloc_coherent /* allocation with GFP_ATOMIC to avoid the long stall */ flags &= ~GFP_KERNEL; flags |= GFP_ATOMIC; - ret = dma_alloc_coherent(dev, size, dma_handle, flags); + ret = dma_std_alloc_coherent(dev, size, dma_handle, flags); } } return ret; } /* redefine dma_alloc_coherent for some architectures */ -#undef dma_alloc_coherent -#define dma_alloc_coherent snd_dma_hack_alloc_coherent +#undef dma_std_alloc_coherent +#define dma_std_alloc_coherent snd_dma_hack_alloc_coherent #endif /* arch */ @@ -220,7 +220,7 @@ static void *snd_malloc_dev_pages(struct | __GFP_COMP /* compound page lets parts be mapped */ | __GFP_NORETRY /* don't trigger OOM-killer */ | __GFP_NOWARN; /* no stack trace print - this call is non-critical */ - res = dma_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags); + res = dma_std_alloc_coherent(dev, PAGE_SIZE << pg, dma, gfp_flags); if (res != NULL) inc_snd_pages(pg); @@ -237,7 +237,7 @@ static void snd_free_dev_pages(struct de return; pg = get_order(size); dec_snd_pages(pg); - dma_free_coherent(dev, PAGE_SIZE << pg, ptr, dma); + dma_std_free_coherent(dev, PAGE_SIZE << pg, ptr, dma); } #ifdef CONFIG_SBUS