Update of /cvsroot/alsa/alsa-kernel/isa In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18820/alsa-kernel/isa
Modified Files: cmi8330.c es18xx.c sscape.c Log Message: Big DMA cleanup originated by Russell King <[EMAIL PROTECTED]> * Russel - introduced 'struct device' support for 2.6 dma_alloc_coherent() * Jaroslav - removed all bus-specific allocation functions - extended snd_dma_alloc_pages/snd_dma_free_pages to handle all bus types - recoded all (or almost all) device drivers - sgbuf functions are bus independent now Index: cmi8330.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/isa/cmi8330.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- cmi8330.c 21 Jan 2004 18:32:46 -0000 1.25 +++ cmi8330.c 2 Mar 2004 15:32:36 -0000 1.26 @@ -438,7 +438,9 @@ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &chip->streams[SNDRV_PCM_STREAM_PLAYBACK].ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &chip->streams[SNDRV_PCM_STREAM_CAPTURE].ops); - snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 128*1024); + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_ISA, + snd_pcm_isa_flags(0), + 64*1024, 128*1024); chip->pcm = pcm; return 0; Index: es18xx.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/isa/es18xx.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- es18xx.c 26 Jan 2004 14:27:13 -0000 1.40 +++ es18xx.c 2 Mar 2004 15:32:36 -0000 1.41 @@ -1598,7 +1598,10 @@ sprintf(pcm->name, "ESS AudioDrive ES%x", chip->version); chip->pcm = pcm; - snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_ISA, + snd_pcm_isa_flags(0), + 64*1024, + chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); if (rpcm) *rpcm = pcm; Index: sscape.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/isa/sscape.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- sscape.c 21 Jan 2004 18:32:46 -0000 1.9 +++ sscape.c 2 Mar 2004 15:32:36 -0000 1.10 @@ -168,23 +168,20 @@ } -struct dmabuf { - size_t size; - unsigned char *data; - dma_addr_t addr; -}; - /* * Allocates some kernel memory that we can use for DMA. * I think this means that the memory has to map to * contiguous pages of physical memory. */ -static struct dmabuf *get_dmabuf(struct dmabuf *buf, unsigned long s) +static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, unsigned long size) { if (buf) { - buf->data = snd_malloc_isa_pages_fallback(s, &buf->addr, &buf->size); - if (!buf->data) { - snd_printk(KERN_ERR "sscape: Failed to allocate %lu bytes for DMA\n", s); + struct snd_dma_device dev; + memset(&dev, 0, sizeof(dev)); + dev.type = SNDRV_DMA_TYPE_ISA; + dev.dev.flags = GFP_DMA|GFP_ATOMIC; + if (snd_dma_alloc_pages_fallback(&dev, size, buf) < 0) { + snd_printk(KERN_ERR "sscape: Failed to allocate %lu bytes for DMA\n", size); return NULL; } } @@ -195,10 +192,15 @@ /* * Release the DMA-able kernel memory ... */ -static void free_dmabuf(struct dmabuf *buf) +static void free_dmabuf(struct snd_dma_buffer *buf) { - if (buf && buf->data) - snd_free_isa_pages(buf->size, buf->data, buf->addr); + if (buf && buf->area) { + struct snd_dma_device dev; + memset(&dev, 0, sizeof(dev)); + dev.type = SNDRV_DMA_TYPE_ISA; + dev.dev.flags = GFP_DMA|GFP_ATOMIC; + snd_dma_free_pages(&dev, buf); + } } @@ -456,7 +458,7 @@ size_t size) { unsigned long flags; - struct dmabuf dma; + struct snd_dma_buffer dma; int ret; if (!get_dmabuf(&dma, PAGE_ALIGN(size))) @@ -500,8 +502,8 @@ * comes from USERSPACE. We have already verified * the userspace pointer ... */ - len = min(size, dma.size); - __copy_from_user(dma.data, data, len); + len = min(size, dma.bytes); + __copy_from_user(dma.area, data, len); data += len; size -= len; ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog