public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Subject: [PATCH 15/20] ACPI: PCI: combine lookup and derive
Date: Mon, 08 Dec 2008 21:31:16 -0700	[thread overview]
Message-ID: <20081209043116.26415.69210.stgit@bob.kio> (raw)
In-Reply-To: <20081209042833.26415.24906.stgit@bob.kio>

This folds acpi_pci_irq_derive() into acpi_pci_irq_lookup() so it
can be easily used by both acpi_pci_irq_enable() and acpi_pci_irq_disable().

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
 drivers/acpi/pci_irq.c |   55 ++++++++++--------------------------------------
 1 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index b2885ce..431d00b 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -384,6 +384,8 @@ static struct acpi_prt_entry *
 acpi_pci_irq_lookup(struct pci_dev *dev, int pin)
 {
 	struct acpi_prt_entry *entry;
+	struct pci_dev *bridge;
+	u8 bridge_pin, orig_pin = pin;
 
 	entry = acpi_pci_irq_find_prt_entry(dev, pin);
 	if (entry) {
@@ -392,19 +394,6 @@ acpi_pci_irq_lookup(struct pci_dev *dev, int pin)
 		return entry;
 	}
 
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No %s[%c] _PRT entry\n",
-			  pci_name(dev), pin_name(pin)));
-	return NULL;
-}
-
-static struct acpi_prt_entry *
-acpi_pci_irq_derive(struct pci_dev *dev, int pin)
-{
-	struct acpi_prt_entry *entry = NULL;
-	struct pci_dev *bridge;
-	u8 bridge_pin = 0, orig_pin = pin;
-
-
 	/* 
 	 * Attempt to derive an IRQ for this device from a parent bridge's
 	 * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge).
@@ -425,7 +414,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, int pin)
 			pin = bridge_pin;
 		}
 
-		entry = acpi_pci_irq_lookup(bridge, pin);
+		entry = acpi_pci_irq_find_prt_entry(bridge, pin);
 		if (entry) {
 			ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 					 "Derived GSI for %s INT %c from %s\n",
@@ -469,26 +458,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
 		return 0;
 	}
 
-	/* 
-	 * First we check the PCI IRQ routing table (PRT) for an IRQ.  PRT
-	 * values override any BIOS-assigned IRQs set during boot.
-	 */
 	entry = acpi_pci_irq_lookup(dev, pin);
-
-	/*
-	 * If no PRT entry was found, we'll try to derive an IRQ from the
-	 * device's parent bridge.
-	 */
-	if (!entry)
-		entry = acpi_pci_irq_derive(dev, pin);
-
-	if (entry)
-		gsi = acpi_pci_allocate_irq(entry, &triggering, &polarity,
-					    &link);
-	else
-		gsi = -1;
-
-	if (gsi < 0) {
+	if (!entry) {
 		/*
 		 * IDE legacy mode controller IRQs are magic. Why do compat
 		 * extensions always make such a nasty mess.
@@ -497,6 +468,13 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
 				(dev->class & 0x05) == 0)
 			return 0;
 	}
+
+	if (entry)
+		gsi = acpi_pci_allocate_irq(entry, &triggering, &polarity,
+					    &link);
+	else
+		gsi = -1;
+
 	/*
 	 * No IRQ known to the ACPI subsystem - maybe the BIOS / 
 	 * driver reported one, then use it. Exit in any case.
@@ -552,18 +530,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
 	if (!pin)
 		return;
 
-	/*
-	 * First we check the PCI IRQ routing table (PRT) for an IRQ.
-	 */
 	entry = acpi_pci_irq_lookup(dev, pin);
-
-	/*
-	 * If no PRT entry was found, we'll try to derive an IRQ from the
-	 * device's parent bridge.
-	 */
-	if (!entry)
-		entry = acpi_pci_irq_derive(dev, pin);
-
 	if (!entry)
 		return;
 


  parent reply	other threads:[~2008-12-09  4:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-09  4:30 [PATCH 00/20] ACPI: PCI: simplify _PRT handling Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 01/20] ACPI: PCI: use conventional PCI address format Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 02/20] ACPI: PCI: remove unnecessary null pointer checks Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 03/20] ACPI: PCI: simplify buffer management for evaluating _PRT Bjorn Helgaas
2008-12-31  4:15   ` [PATCH] ACPI: simplify buffer management for acpi_pci_bind() etc Len Brown
2008-12-09  4:30 ` [PATCH 04/20] ACPI: PCI: ignore _PRT function information Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 05/20] ACPI: PCI: fix GSI/IRQ naming confusion Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 06/20] ACPI: PCI: move struct acpi_prt_entry declaration out of public header file Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 07/20] ACPI: PCI: add a helper to convert _PRT INTx pin number to name Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 08/20] ACPI: PCI: always use the PCI INTx pin values, not the _PRT ones Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 09/20] ACPI: PCI: use 1-based encoding for _PRT quirks Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 10/20] ACPI: PCI: lookup _PRT entry by PCI dev and pin, not segment/bus/dev/pin Bjorn Helgaas
2008-12-09  4:30 ` [PATCH 11/20] ACPI: PCI: tweak _PRT lookup debug Bjorn Helgaas
2008-12-09  4:31 ` [PATCH 12/20] ACPI: PCI: remove callback from acpi_pci_irq_lookup & acpi_pci_irq_derive Bjorn Helgaas
2008-12-09  4:31 ` [PATCH 13/20] ACPI: PCI: use positive logic to simplify code Bjorn Helgaas
2008-12-09  4:31 ` [PATCH 14/20] ACPI: PCI: follow typical PCI INTx swizzling pattern Bjorn Helgaas
2008-12-09  4:31 ` Bjorn Helgaas [this message]
2008-12-09  4:31 ` [PATCH 16/20] ACPI: PCI: simplify list of _PRT entries Bjorn Helgaas
2008-12-09  4:31 ` [PATCH 17/20] ACPI: PCI: simplify struct acpi_prt_entry Bjorn Helgaas
2008-12-09  4:31 ` [PATCH 18/20] ACPI: PCI: expand acpi_pci_allocate_irq() and acpi_pci_free_irq() inline Bjorn Helgaas
2008-12-09  4:31 ` [PATCH 19/20] ACPI: PCI: whitespace and useless initialization cleanup Bjorn Helgaas
2008-12-09  4:31 ` [PATCH 20/20] ACPI: PCI: add HP copyright Bjorn Helgaas
2008-12-31  4:17 ` [PATCH 00/20] ACPI: PCI: simplify _PRT handling Len Brown

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=20081209043116.26415.69210.stgit@bob.kio \
    --to=bjorn.helgaas@hp.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.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