diff -urN linux.ac/drivers/video/sis/sis_main.c linux.dilinger/drivers/video/sis/sis_main.c --- linux.ac/drivers/video/sis/sis_main.c Tue Mar 27 06:15:18 2001 +++ linux.dilinger/drivers/video/sis/sis_main.c Tue Mar 27 19:59:10 2001 @@ -2017,7 +2017,7 @@ { struct pci_dev *pdev = NULL; struct board *b; - int pdev_valid = 0; + int err = -1; unsigned long rom_vbase; u32 reg32; u16 reg16; @@ -2035,14 +2035,16 @@ } #endif - if (sisfb_off) - return -ENXIO; + do { + if (sisfb_off) { + err = -ENXIO; + break; + } - pci_for_each_dev(pdev) { for (b = sisdev_list; b->vendor; b++) { - if ((b->vendor == pdev->vendor) - && (b->device == pdev->device)) { - pdev_valid = 1; + pdev = pci_find_device(b->vendor, b->device, NULL); + if (pdev) { + err = 0; strcpy(fb_info.modename, b->name); ivideo.chip_id = pdev->device; pci_read_config_byte(pdev, PCI_REVISION_ID, &ivideo.revision_id); @@ -2053,12 +2055,18 @@ } } - if (pdev_valid) - break; - } + /* Note: old behavior was to call pci_enable_device iff + * sisvga_enabled wasn't set. Since we access resources + * regardless of sisvga_enabled, we enable the device + * in all cases. If this is wrong, have it check + * if !sisvga_enabled here. */ + if (!err) + err = pci_enable_device(pdev); + + } while (0); - if (!pdev_valid) - return -1; + if (err) + return err; switch (ivideo.chip_id) { case PCI_DEVICE_ID_SI_300: @@ -2107,9 +2115,6 @@ = pci_resource_start(pdev, 2) + 0x30; sisfb_mmio_size = pci_resource_len(pdev, 1); - - if (!sisvga_enabled) - if (pci_enable_device(pdev)) return -EIO; #ifdef NOBIOS sishw_ext.VirtualRomBase = rom_vbase = (unsigned long) rom_data;