At Tue, 2 Mar 2004 14:26:32 +0000, Russell King wrote: > > I, therefore, suggest that you're not looking at a 2.6.3 kernel. This > was changed from pci_alloc_consistent to dma_alloc_coherent on 22 Dec, > and was modified to take the GFP flags on 13 Jan. > > dma_alloc_coherent() is therefore not a wrapper for pci_alloc_consistent().
sorry, my bad. forget my last post... BTW, there are some typos in your patches, and missing replacement of PCI -> DEV dma type. the attached patch should fix. Takashi
--- linux/sound/core/memalloc.c 2004-03-02 15:33:38.628633893 +0100 +++ linux/sound/core/memalloc.c 2004-03-02 15:14:15.000000000 +0100 @@ -94,28 +94,28 @@ */ static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle) + dma_addr_t *dma_handle, int gfp_flags) { void *ret; u64 dma_mask; if (dev == NULL) - return dev_alloc_coherent(dev, size, dma_handle); - dma_mask = dev->dma_mask; - dev->dma_mask = 0xffffffff; /* do without masking */ - ret = dev_alloc_coherent(dev, size, dma_handle, GFP_KERNEL); - dev->dma_mask = dma_mask; /* restore */ + return dma_alloc_coherent(dev, size, dma_handle, gfp_flags); + dma_mask = *dev->dma_mask; + *dev->dma_mask = 0xffffffff; /* do without masking */ + ret = dma_alloc_coherent(dev, size, dma_handle, gfp_flags); + *dev->dma_mask = 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, GFP_KERNEL); + ret = dma_alloc_coherent(dev, size, dma_handle, gfp_flags); } } else { /* wish to success now with the proper mask... */ if (dma_mask != 0xffffffffUL) - ret = dma_alloc_coherent(dev, size, dma_handle, GFP_KERNEL); + ret = dma_alloc_coherent(dev, size, dma_handle, gfp_flags); } return ret; } --- linux/sound/pci/emu10k1/memory.c 15 Jan 2004 16:43:09 -0000 1.11 +++ linux/sound/pci/emu10k1/memory.c 2 Mar 2004 14:14:57 -0000 @@ -297,7 +297,7 @@ int page, err, idx; snd_assert(emu, return NULL); - snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_PCI_SG, return NULL); + snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_DEV_SG, return NULL); snd_assert(runtime->dma_bytes > 0 && runtime->dma_bytes < MAXPAGES * EMUPAGESIZE, return NULL); hdr = emu->memhdr; snd_assert(hdr, return NULL); --- linux/sound/pci/trident/trident_main.c 24 Feb 2004 11:46:57 -0000 1.48 +++ linux/sound/pci/trident/trident_main.c 2 Mar 2004 14:15:55 -0000 @@ -1009,7 +1009,7 @@ snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; unsigned int val, ESO_bytes; - snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_PCI, return -EIO); + snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_DEV, return -EIO); spin_lock(&trident->reg_lock); --- linux/sound/pci/trident/trident_memory.c 10 Mar 2003 13:02:27 -0000 1.9 +++ linux/sound/pci/trident/trident_memory.c 2 Mar 2004 14:16:33 -0000 @@ -191,7 +191,7 @@ int idx, page; struct snd_sg_buf *sgbuf = runtime->dma_private; - snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_PCI_SG, return NULL); + snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_DEV_SG, return NULL); snd_assert(runtime->dma_bytes > 0 && runtime->dma_bytes <= SNDRV_TRIDENT_MAX_PAGES * SNDRV_TRIDENT_PAGE_SIZE, return NULL); hdr = trident->tlb.memhdr; snd_assert(hdr != NULL, return NULL); @@ -240,7 +240,7 @@ dma_addr_t addr; unsigned long ptr; - snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_PCI, return NULL); + snd_assert(substream->dma_device.type == SNDRV_DMA_TYPE_DEV, return NULL); snd_assert(runtime->dma_bytes> 0 && runtime->dma_bytes <= SNDRV_TRIDENT_MAX_PAGES * SNDRV_TRIDENT_PAGE_SIZE, return NULL); hdr = trident->tlb.memhdr; snd_assert(hdr != NULL, return NULL); @@ -276,7 +276,7 @@ { snd_assert(trident != NULL, return NULL); snd_assert(substream != NULL, return NULL); - if (substream->dma_device.type == SNDRV_DMA_TYPE_PCI_SG) + if (substream->dma_device.type == SNDRV_DMA_TYPE_DEV_SG) return snd_trident_alloc_sg_pages(trident, substream); else return snd_trident_alloc_cont_pages(trident, substream);