[alsa-cvslog] CVS: alsa-driver/acore memalloc.patch,1.7,1.8 sgbuf.c,1.9,1.10
Brought to you by:
perex
From: Takashi I. <ti...@us...> - 2004-07-30 12:59:03
|
Update of /cvsroot/alsa/alsa-driver/acore In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2138/acore Modified Files: memalloc.patch sgbuf.c Log Message: Clean up DMA buffer allocation routines. - snd_dma_alloc_pages*() take the device type and device pointer directly as arguments. snd_dma_free_pages() takes only dma_buffer instance. - snd_dma_device struct is removed in each driver's instance (no longer needed due to the change above). - snd_malloc_pages_fallback() is removed since it's no longer used. - The buffer reservation / preallocation in snd-page-alloc module is performed only when the buffer id is given. Normal PCM buffers won't be reserved any more (unless the driver specifies). The module keeps the linked list of free-reserved buffers, instead of the whole buffers Reservation is done via snd_dma_reserve_buf(), and retrieved via snd_dma_get_reserved_buf()). - Other misc clean-ups/fixes. Index: memalloc.patch =================================================================== RCS file: /cvsroot/alsa/alsa-driver/acore/memalloc.patch,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- memalloc.patch 16 Apr 2004 09:24:44 -0000 1.7 +++ memalloc.patch 30 Jul 2004 12:58:54 -0000 1.8 @@ -111,34 +111,9 @@ /* * -@@ -781,9 +844,24 @@ - case SNDRV_DMA_TYPE_DEV: - case SNDRV_DMA_TYPE_DEV_SG: - if (mem->dev.dev) { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) - len += sprintf(page + len, "%s [%s]", - mem->dev.type == SNDRV_DMA_TYPE_DEV_SG ? "DEV-SG" : "DEV", - mem->dev.dev->bus_id); -+#else -+ struct pci_dev *pci = (struct pci_dev *)mem->dev.dev; -+ len += sprintf(page + len, "%s ", -+ mem->dev.type == SNDRV_DMA_TYPE_DEV_SG ? "PCI-SG" : "PCI"); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0) -+ len += sprintf(page + len, "[%02x:%02x:%02x]", -+ pci->bus->number, -+ pci->bus->primary, -+ pci->bus->secondary); -+#else -+ len += sprintf(page + len, "[%s]", -+ pci->slot_name); -+#endif /* < 2.4.0 */ -+#endif - } else - len += sprintf(page + len, "ISA"); - break; -@@ -840,3 +918,5 @@ +@@ -840,3 +903,5 @@ + EXPORT_SYMBOL(snd_malloc_pages); - EXPORT_SYMBOL(snd_malloc_pages_fallback); EXPORT_SYMBOL(snd_free_pages); + +#include "memalloc.inc1" Index: sgbuf.c =================================================================== RCS file: /cvsroot/alsa/alsa-driver/acore/sgbuf.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- sgbuf.c 8 Mar 2004 09:20:39 -0000 1.9 +++ sgbuf.c 30 Jul 2004 12:58:54 -0000 1.10 @@ -57,7 +57,7 @@ unsigned int i; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) unsigned long rmask; - struct pci_dev *pci = (struct pci_dev *)sgbuf->dev.dev; + struct pci_dev *pci = (struct pci_dev *)sgbuf->dev; rmask = pci->dma_mask; if (rmask) rmask = ~rmask; @@ -127,7 +127,7 @@ return 0; } -void *snd_malloc_sgbuf_pages(const struct snd_dma_device *dev, +void *snd_malloc_sgbuf_pages(struct device *dev, size_t size, struct snd_dma_buffer *dmab, size_t *res_size) { @@ -140,8 +140,7 @@ if (! sgbuf) return NULL; memset(sgbuf, 0, sizeof(*sgbuf)); - sgbuf->dev = *dev; - sgbuf->dev.type = SNDRV_DMA_TYPE_DEV; + sgbuf->dev = dev; pages = snd_sgbuf_aligned_pages(size); sgbuf->tblsize = sgbuf_align_table(pages); sgbuf->table = kmalloc(sizeof(*sgbuf->table) * sgbuf->tblsize, GFP_KERNEL); |