linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taku Izumi <izumi.taku@jp.fujitsu.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH 2/5] PCI,ACPI: Add _PRT interrupt routing info before enumerating devices
Date: Tue, 30 Oct 2012 15:24:50 +0900	[thread overview]
Message-ID: <20121030152450.92d4c106.izumi.taku@jp.fujitsu.com> (raw)
In-Reply-To: <20121030062124.BE34D2E0805@m003.s.css.fujitsu.com>

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(-)

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;


  parent reply	other threads:[~2012-10-30  6:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30  6:21 [RFC PATCH 0/5] acpi,pci: disentangle ACPI-related code and PCI-related code at hostbridge Taku Izumi
2012-10-30  6:24 ` [PATCH 1/5] ACPI: Pass segment/bus to _PRT add/del so they don't depend on pci_bus Taku Izumi
2012-10-30  6:24 ` Taku Izumi [this message]
2012-10-30  6:25 ` [PATCH 3/5] PCI,ACPI: Remove _PRT info when removing a host bridge Taku Izumi
2012-10-30  6:26 ` [PATCH 4/5] PCI: Change the signature of pci_ext_cfg_avail function Taku Izumi
2012-10-30  6:27 ` [PATCH 5/5] PCI,ACPI: Requesting _OSC control before scanning pci tree in acpi_pci_root_add() Taku Izumi
2012-11-07 23:05 ` [RFC PATCH 0/5] acpi,pci: disentangle ACPI-related code and PCI-related code at hostbridge Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121030152450.92d4c106.izumi.taku@jp.fujitsu.com \
    --to=izumi.taku@jp.fujitsu.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).