[parisc-linux-cvs] 2.4.17-pa3, harmony/ccio patch
Helge Deller
deller@gmx.de
Sat, 5 Jan 2002 02:38:52 +0100
--------------Boundary-00=_S8ZF6G496WIZSD37GL2J
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
On Saturday 05 January 2002 02:37, Helge Deller wrote:
> CVSROOT: /var/cvs
> Module name: linux
> Changes by: deller 02/01/04 18:37:03
>
> Modified files:
> drivers/sound : harmony.c
>
> Log message:
> Final fix for harmony on ccio machines.
> Thanks to Thomas Bogendoerfer and Grant Grundler for finding the bug.
--------------Boundary-00=_S8ZF6G496WIZSD37GL2J
Content-Type: text/plain;
charset="iso-8859-1";
name="diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="diff"
Index: harmony.c
===================================================================
RCS file: /var/cvs/linux/drivers/sound/harmony.c,v
retrieving revision 1.18
diff -u -p -r1.18 harmony.c
--- harmony.c 2002/01/04 23:51:15 1.18
+++ harmony.c 2002/01/05 01:35:02
@@ -231,20 +231,18 @@ static struct harmony_buffer played_buf,
static int __init harmony_alloc_buffer(struct harmony_buffer *b,
- int buffer_count, int prefer_consistent)
+ int buffer_count)
{
b->len = buffer_count * HARMONY_BUF_SIZE;
- if (prefer_consistent)
- b->addr = pci_alloc_consistent(harmony.fake_pci_dev,
+ b->addr = pci_alloc_consistent(harmony.fake_pci_dev,
b->len, &b->dma_handle);
- else
- b->addr = NULL; /* don't use DMA consistent memory */
if (b->addr) {
b->dma_consistent = 1;
DPRINTK(KERN_INFO PFX "consistent memory: 0x%lx, played_buf: 0x%lx\n",
(unsigned long)b->dma_handle, (unsigned long)b->addr);
} else {
b->dma_consistent = 0;
+ /* kmalloc()ed memory will HPMC on ccio machines ! */
b->addr = kmalloc(b->len, GFP_KERNEL);
if (!b->addr) {
printk(KERN_ERR PFX "couldn't allocate memory\n");
@@ -1223,12 +1221,11 @@ harmony_driver_callback(struct parisc_de
/* a fake pci_dev is needed for pci_* functions under ccio */
harmony.fake_pci_dev = ccio_get_fake(dev);
- /* Initialize the memory buffers,
- * graveyard and silent buffers don't really need consistent memory */
- if (harmony_alloc_buffer(&played_buf, MAX_BUFS, 1) ||
- harmony_alloc_buffer(&recorded_buf, MAX_BUFS, 1) ||
- harmony_alloc_buffer(&graveyard, 1, 0) ||
- harmony_alloc_buffer(&silent, 1, 0)) {
+ /* Initialize the memory buffers */
+ if (harmony_alloc_buffer(&played_buf, MAX_BUFS) ||
+ harmony_alloc_buffer(&recorded_buf, MAX_BUFS) ||
+ harmony_alloc_buffer(&graveyard, 1) ||
+ harmony_alloc_buffer(&silent, 1)) {
harmony_free_buffer(&played_buf);
harmony_free_buffer(&recorded_buf);
harmony_free_buffer(&graveyard);
--------------Boundary-00=_S8ZF6G496WIZSD37GL2J--