summary refs log tree commit diff
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2012-10-30 15:24:50 +0900
committerBjorn Helgaas <bhelgaas@google.com>2012-11-05 16:10:16 -0700
commitd4761ba2d6adbe24c792ec6223a5884ae4e82430 (patch)
tree8a455923e3d5073b12889ef7fd27fa4a26c06a2e
parent79c4412298771b8996302806abc8a11e760da9b3 (diff)
downloadlinux-d4761ba2d6adbe24c792ec6223a5884ae4e82430.tar.gz
PCI/ACPI: Add _PRT interrupt routing info before enumerating devices
We used to add the _PRT after enumerating devices behind a new host
bridge.  This moves the _PRT addition *before* the enumeration, since
it no longer depends on the struct pci_bus existing.  This is one
step towards consolidating the .add/.start methods.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Taku Izumi <izumim.taku@jp.fujitsu.com>
-rw-r--r--drivers/acpi/pci_root.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index db31edaab9ce..66f3ae74d130 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -501,6 +501,20 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 	strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
 	device->driver_data = root;
 
+	printk(KERN_INFO PREFIX "%s [%s] (domain %04x %pR)\n",
+	       acpi_device_name(device), acpi_device_bid(device),
+	       root->segment, &root->secondary);
+
+	/*
+	 * 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);
+
 	root->mcfg_addr = acpi_pci_root_get_mcfg_addr(device->handle);
 
 	/*
@@ -518,10 +532,6 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 	list_add_tail(&root->node, &acpi_pci_roots);
 	mutex_unlock(&acpi_pci_root_lock);
 
-	printk(KERN_INFO PREFIX "%s [%s] (domain %04x %pR)\n",
-	       acpi_device_name(device), acpi_device_bid(device),
-	       root->segment, &root->secondary);
-
 	/*
 	 * Scan the Root Bridge
 	 * --------------------
@@ -548,16 +558,6 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 		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;