===================================================================
@@ -467,6 +467,7 @@ static int __devinit acpi_pci_root_add(s
result = -ENODEV;
goto end;
}
+ root->segment = segment & 0xFFFF;
/* Check _CRS first, then _BBN. If no _BBN, default to zero. */
root->secondary.flags = IORESOURCE_BUS;
@@ -494,9 +495,18 @@ static int __devinit acpi_pci_root_add(s
}
}
+ /*
+ * PCI Routing Table
+ * -----------------
+ * Evaluate and parse _PRT, if exists.
+ */
+ status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
+ if (ACPI_SUCCESS(status))
+ result = acpi_pci_irq_add_prt(device->handle, root->segment,
+ root->secondary.start);
+
INIT_LIST_HEAD(&root->node);
root->device = device;
- root->segment = segment & 0xFFFF;
strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
device->driver_data = root;
@@ -548,16 +558,6 @@ static int __devinit acpi_pci_root_add(s
goto out_del_root;
/*
- * PCI Routing Table
- * -----------------
- * Evaluate and parse _PRT, if exists.
- */
- status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
- if (ACPI_SUCCESS(status))
- result = acpi_pci_irq_add_prt(device->handle, root->segment,
- root->secondary.start);
-
- /*
* Scan and bind all _ADR-Based Devices
*/
list_for_each_entry(child, &device->children, node)
@@ -635,6 +635,8 @@ out_del_root:
mutex_lock(&acpi_pci_root_lock);
list_del(&root->node);
mutex_unlock(&acpi_pci_root_lock);
+
+ acpi_pci_irq_del_prt(root->segment, root->secondary.start);
end:
kfree(root);
return result;