]> git.neil.brown.name Git - history.git/commitdiff
Move pci_enable_device and associated code above first PCI resource info access.
authorArjan van de Ven <arjan@redhat.com>
Tue, 12 Mar 2002 01:18:16 +0000 (20:18 -0500)
committerJeff Garzik <jgarzik@mandrakesoft.com>
Tue, 12 Mar 2002 01:18:16 +0000 (20:18 -0500)
drivers/net/eepro100.c

index 1246a14966fb11a0539e4f371acaecf7031fedb1..d82f6863de97c1a44351f931d1d105a241f34f86 100644 (file)
@@ -570,6 +570,19 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
        if (speedo_debug > 0  &&  did_version++ == 0)
                printk(version);
 
+       /* save power state before pci_enable_device overwrites it */
+       pm = pci_find_capability(pdev, PCI_CAP_ID_PM);
+       if (pm) {
+               u16 pwr_command;
+               pci_read_config_word(pdev, pm + PCI_PM_CTRL, &pwr_command);
+               acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK;
+       }
+
+       if (pci_enable_device(pdev))
+               goto err_out_free_mmio_region;
+
+       pci_set_master(pdev);
+
        if (!request_region(pci_resource_start(pdev, 1),
                        pci_resource_len(pdev, 1), "eepro100")) {
                printk (KERN_ERR "eepro100: cannot reserve I/O ports\n");
@@ -600,18 +613,6 @@ static int __devinit eepro100_init_one (struct pci_dev *pdev,
                           pci_resource_start(pdev, 0), irq);
 #endif
 
-       /* save power state b4 pci_enable_device overwrites it */
-       pm = pci_find_capability(pdev, PCI_CAP_ID_PM);
-       if (pm) {
-               u16 pwr_command;
-               pci_read_config_word(pdev, pm + PCI_PM_CTRL, &pwr_command);
-               acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK;
-       }
-
-       if (pci_enable_device(pdev))
-               goto err_out_free_mmio_region;
-
-       pci_set_master(pdev);
 
        if (speedo_found1(pdev, ioaddr, cards_found, acpi_idle_state) == 0)
                cards_found++;