Patchwork [2/5] PCI,ACPI: Add _PRT interrupt routing info before enumerating devices

login
register
mail settings
Submitter Taku Izumi
Date Oct. 30, 2012, 6:24 a.m.
Message ID <20121030152450.92d4c106.izumi.taku@jp.fujitsu.com>
Download mbox | patch
Permalink /patch/195295/
State Accepted
Headers show

Comments

Taku Izumi - Oct. 30, 2012, 6:24 a.m.
Author: Bjorn Helgaas <bhelgaas@google.com>

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>
[insert acpi_pci_irq_del_prt() on hostbridge addition failure]
Signed-off-by: Taku Izumi <izumim.taku@jp.fujitsu.com>
---
 drivers/acpi/pci_root.c |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

Index: Bjorn-next-0925/drivers/acpi/pci_root.c
===================================================================
--- Bjorn-next-0925.orig/drivers/acpi/pci_root.c
+++ Bjorn-next-0925/drivers/acpi/pci_root.c
@@ -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;