diff -ur linux-2.6.5-rc2-ovb2/sound/pci/au88x0/au88x0.c linux-2.6.5-rc2-void/sound/pci/au88x0/au88x0.c --- linux-2.6.5-rc2-ovb2/sound/pci/au88x0/au88x0.c 2004-03-25 21:09:05.000000000 -0500 +++ linux-2.6.5-rc2-void/sound/pci/au88x0/au88x0.c 2004-03-25 21:10:04.000000000 -0500 @@ -68,60 +68,57 @@ MODULE_DEVICE_TABLE(pci, snd_vortex_ids); -static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) +static void vortex_fix_latency(struct pci_dev *vortex) { - struct pci_dev *via = NULL; int rc; - - /* autodetect if workarounds are required */ - while ((via = pci_find_device(PCI_VENDOR_ID_VIA, - PCI_DEVICE_ID_VIA_8365_1, via))) { - if (fix == 255) { + if (!(rc = pci_write_config_byte(vortex, 0x40, 0xff))) { printk(KERN_INFO CARD_NAME - ": detected VIA KT133/KM133. activating workaround...\n"); - fix = 3; // do latency and via bridge workaround - } - break; + ": vortex latency is 0xff\n"); + } else { + printk(KERN_WARNING CARD_NAME + ": could not set vortex latency: pci error 0x%x\n", rc); } +} - /* do not do anything if autodetection was enabled and found no VIA */ - if (fix == 255) - return; +static void vortex_fix_agp_bridge(struct pci_dev *via) +{ + int rc; + u8 value; - /* fix vortex latency */ - if (fix & 0x01) { - if (!(rc = pci_write_config_byte(vortex, 0x40, 0xff))) { - printk(KERN_INFO CARD_NAME - ": vortex latency is 0xff\n"); - } else { - printk(KERN_WARNING CARD_NAME - ": could not set vortex latency: pci error 0x%x\n", - rc); - } + /* + * only set the bit (Extend PCI#2 Internal Master for + * Efficient Handling of Dummy Requests) if the can + * read the config and it is not already set + */ + + if (!(rc = pci_read_config_byte(via, 0x42, &value)) + && ((value & 0x10) + || !(rc = pci_write_config_byte(via, 0x42, value | 0x10)))) { + printk(KERN_INFO CARD_NAME + ": bridge config is 0x%x\n", value | 0x10); + } else { + printk(KERN_WARNING CARD_NAME + ": could not set vortex latency: pci error 0x%x\n", rc); } +} - /* fix via agp bridge */ - if (via && (fix & 0x02)) { - u8 value; - - /* - * only set the bit (Extend PCI#2 Internal Master for - * Efficient Handling of Dummy Requests) if the can - * read the config and it is not already set - */ - - if (!(rc = pci_read_config_byte(via, 0x42, &value)) - && ((value & 0x10) - || !(rc = - pci_write_config_byte(via, 0x42, value | 0x10)))) { +static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) +{ + struct pci_dev *via; - printk(KERN_INFO CARD_NAME - ": bridge config is 0x%x\n", value | 0x10); - } else { - printk(KERN_WARNING CARD_NAME - ": could not set vortex latency: pci error 0x%x\n", - rc); + /* autodetect if workarounds are required */ + if (fix == 255) { + via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL); + if (via) { + printk(KERN_INFO CARD_NAME ": detected VIA KT133/KM133. activating workaround...\n"); + vortex_fix_latency(vortex); + vortex_fix_agp_bridge(via); } + } else { + if (fix & 0x1) + vortex_fix_latency(vortex); + if ((fix & 0x2) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL))) + vortex_fix_agp_bridge(via); } }