aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-12-08 23:30:51 -0500
committerLen Brown <len.brown@intel.com>2008-12-30 21:28:19 -0500
commit063563b4b8f87e2be0e127ccf3a8e6eef6309ff4 (patch)
treed2e1c9c8d7c0d29d52df1ae9117cbd1cd516a4d9 /drivers/acpi
parentc458033c9b72a81b890d97ec6339694bab252383 (diff)
ACPI: PCI: lookup _PRT entry by PCI dev and pin, not segment/bus/dev/pin
There's no reason to pass around segment, bus, and device independently when we can just pass the pci_dev pointer, which carries all those already. The pci_dev contains an interrupt pin, too, but we still have to pass both the pci_dev and the pin because when we use a bridge to derive an IRQ, we need the pin from the downstream device, not the bridge. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/pci_irq.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index c4a5c49809db..aabf8a965aff 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -69,11 +69,13 @@ static inline char pin_name(int pin)
69 PCI IRQ Routing Table (PRT) Support 69 PCI IRQ Routing Table (PRT) Support
70 -------------------------------------------------------------------------- */ 70 -------------------------------------------------------------------------- */
71 71
72static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, 72static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(struct pci_dev *dev,
73 int bus, 73 int pin)
74 int device, int pin)
75{ 74{
76 struct acpi_prt_entry *entry = NULL; 75 struct acpi_prt_entry *entry = NULL;
76 int segment = pci_domain_nr(dev->bus);
77 int bus = dev->bus->number;
78 int device = PCI_SLOT(dev->devfn);
77 79
78 if (!acpi_prt.count) 80 if (!acpi_prt.count)
79 return NULL; 81 return NULL;
@@ -385,23 +387,18 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry,
385 * failure: return -1 387 * failure: return -1
386 */ 388 */
387static int 389static int
388acpi_pci_irq_lookup(struct pci_bus *bus, 390acpi_pci_irq_lookup(struct pci_dev *dev, int pin,
389 int device,
390 int pin,
391 int *triggering, 391 int *triggering,
392 int *polarity, char **link, irq_lookup_func func) 392 int *polarity, char **link, irq_lookup_func func)
393{ 393{
394 struct acpi_prt_entry *entry = NULL; 394 struct acpi_prt_entry *entry = NULL;
395 int segment = pci_domain_nr(bus);
396 int bus_nr = bus->number;
397 int ret; 395 int ret;
398 396
399 397
400 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 398 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Searching for _PRT entry for %s[%c]\n",
401 "Searching for _PRT entry for %04x:%02x:%02x[%c]\n", 399 pci_name(dev), pin_name(pin)));
402 segment, bus_nr, device, pin_name(pin)));
403 400
404 entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); 401 entry = acpi_pci_irq_find_prt_entry(dev, pin);
405 if (!entry) { 402 if (!entry) {
406 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_PRT entry not found\n")); 403 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_PRT entry not found\n"));
407 return -1; 404 return -1;
@@ -447,7 +444,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,
447 pin = bridge_pin; 444 pin = bridge_pin;
448 } 445 }
449 446
450 irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), 447 irq = acpi_pci_irq_lookup(bridge,
451 pin, triggering, polarity, 448 pin, triggering, polarity,
452 link, func); 449 link, func);
453 } 450 }
@@ -493,7 +490,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
493 * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT 490 * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
494 * values override any BIOS-assigned IRQs set during boot. 491 * values override any BIOS-assigned IRQs set during boot.
495 */ 492 */
496 gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, 493 gsi = acpi_pci_irq_lookup(dev, pin,
497 &triggering, &polarity, &link, 494 &triggering, &polarity, &link,
498 acpi_pci_allocate_irq); 495 acpi_pci_allocate_irq);
499 496
@@ -574,7 +571,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev)
574 /* 571 /*
575 * First we check the PCI IRQ routing table (PRT) for an IRQ. 572 * First we check the PCI IRQ routing table (PRT) for an IRQ.
576 */ 573 */
577 gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, 574 gsi = acpi_pci_irq_lookup(dev, pin,
578 &triggering, &polarity, NULL, 575 &triggering, &polarity, NULL,
579 acpi_pci_free_irq); 576 acpi_pci_free_irq);
580 /* 577 /*