Update of /cvsroot/alsa/alsa-kernel/core In directory usw-pr-cvs1:/tmp/cvs-serv17043/core
Modified Files: memory.c wrappers.c Log Message: moved pci_alloc_consistent() hack function to wrappers.c, in order to avoid redefinition of the original function. Index: memory.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/core/memory.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- memory.c 11 Sep 2002 15:55:50 -0000 1.20 +++ memory.c 12 Sep 2002 09:02:11 -0000 1.21 @@ -538,43 +538,3 @@ return 0; #endif } - -#ifdef HACK_PCI_ALLOC_CONSISTENT -/* - * A dirty hack... when the kernel code is fixed this should be removed. - * - * since pci_alloc_consistent always tries GFP_DMA when the requested - * pci memory region is below 32bit, it happens quite often that even - * 2 order of pages cannot be allocated. - * - * so in the following, we allocate at first without dma_mask, so that - * allocation will be done without GFP_DMA. if the area doesn't match - * with the requested region, then realloate with the original dma_mask - * again. - */ - -#undef pci_alloc_consistent - -void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size, - dma_addr_t *dma_handle) -{ - void *ret; - u64 dma_mask; - unsigned long rmask; - - if (hwdev == NULL) - return pci_alloc_consistent(hwdev, size, dma_handle); - dma_mask = hwdev->dma_mask; - rmask = ~((unsigned long)dma_mask); - hwdev->dma_mask = 0xffffffff; /* do without masking */ - ret = pci_alloc_consistent(hwdev, size, dma_handle); - if (ret && ((*dma_handle + size - 1) & rmask)) { - pci_free_consistent(hwdev, size, ret, *dma_handle); - ret = 0; - } - hwdev->dma_mask = dma_mask; /* restore */ - if (! ret) - ret = pci_alloc_consistent(hwdev, size, dma_handle); - return ret; -} -#endif /* hack */ Index: wrappers.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/core/wrappers.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- wrappers.c 12 Aug 2002 08:43:45 -0000 1.5 +++ wrappers.c 12 Sep 2002 09:02:11 -0000 1.6 @@ -59,3 +59,49 @@ vfree(obj); } #endif + + +/* check the condition in <sound/core.h> !! */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) +#if defined(__i386__) || defined(__ppc__) || defined(__x86_64__) + +#include <linux/pci.h> + +/* + * A dirty hack... when the kernel code is fixed this should be removed. + * + * since pci_alloc_consistent always tries GFP_DMA when the requested + * pci memory region is below 32bit, it happens quite often that even + * 2 order of pages cannot be allocated. + * + * so in the following, we allocate at first without dma_mask, so that + * allocation will be done without GFP_DMA. if the area doesn't match + * with the requested region, then realloate with the original dma_mask + * again. + */ + +void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size, + dma_addr_t *dma_handle) +{ + void *ret; + u64 dma_mask; + unsigned long rmask; + + if (hwdev == NULL) + return pci_alloc_consistent(hwdev, size, dma_handle); + dma_mask = hwdev->dma_mask; + rmask = ~((unsigned long)dma_mask); + hwdev->dma_mask = 0xffffffff; /* do without masking */ + ret = pci_alloc_consistent(hwdev, size, dma_handle); + if (ret && ((*dma_handle + size - 1) & rmask)) { + pci_free_consistent(hwdev, size, ret, *dma_handle); + ret = 0; + } + hwdev->dma_mask = dma_mask; /* restore */ + if (! ret) + ret = pci_alloc_consistent(hwdev, size, dma_handle); + return ret; +} + +#endif +#endif ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog