* [PATCH] simplify pci_irq internal interfaces
@ 2005-03-18 20:21 Bjorn Helgaas
0 siblings, 0 replies; only message in thread
From: Bjorn Helgaas @ 2005-03-18 20:21 UTC (permalink / raw)
To: ACPI List
Pass around the struct pci_dev when looking up PRT entries rather
than prematurely extracting segment/bus/device.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
===== drivers/acpi/pci_irq.c 1.37 vs edited =====
--- 1.37/drivers/acpi/pci_irq.c 2005-03-01 09:57:29 -07:00
+++ edited/drivers/acpi/pci_irq.c 2005-03-18 12:52:08 -07:00
@@ -51,9 +51,7 @@
static struct acpi_prt_entry *
acpi_pci_irq_find_prt_entry (
- int segment,
- int bus,
- int device,
+ struct pci_dev *dev,
int pin)
{
struct list_head *node = NULL;
@@ -67,15 +65,14 @@
/*
* Parse through all PRT entries looking for a match on the specified
* PCI device's segment, bus, device, and pin (don't care about func).
- *
*/
spin_lock(&acpi_prt_lock);
list_for_each(node, &acpi_prt.entries) {
entry = list_entry(node, struct acpi_prt_entry, node);
- if ((segment == entry->id.segment)
- && (bus == entry->id.bus)
- && (device == entry->id.device)
- && (pin == entry->pin)) {
+ if ((entry->id.segment == pci_domain_nr(dev->bus))
+ && (entry->id.bus == dev->bus->number)
+ && (entry->id.device == PCI_SLOT(dev->devfn))
+ && (entry->pin == pin)) {
spin_unlock(&acpi_prt_lock);
return_PTR(entry);
}
@@ -277,24 +274,20 @@
*/
static int
acpi_pci_irq_lookup (
- struct pci_bus *bus,
- int device,
+ struct pci_dev *dev,
int pin,
int *edge_level,
int *active_high_low)
{
struct acpi_prt_entry *entry = NULL;
- int segment = pci_domain_nr(bus);
- int bus_nr = bus->number;
int irq;
ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Searching for PRT entry for %02x:%02x:%02x[%c]\n",
- segment, bus_nr, device, ('A' + pin)));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Searching for PRT entry for %s[%c]\n",
+ pci_name(dev), 'A' + pin));
- entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
+ entry = acpi_pci_irq_find_prt_entry(dev, pin);
if (!entry) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n"));
return_VALUE(-1);
@@ -359,8 +352,8 @@
pin = bridge_pin;
}
- irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
- pin, edge_level, active_high_low);
+ irq = acpi_pci_irq_lookup(bridge, pin, edge_level,
+ active_high_low);
}
if (irq < 0) {
@@ -411,7 +404,7 @@
* First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
* values override any BIOS-assigned IRQs set during boot.
*/
- irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, &edge_level, &active_high_low);
+ irq = acpi_pci_irq_lookup(dev, pin, &edge_level, &active_high_low);
/*
* If no PRT entry was found, we'll try to derive an IRQ from the
@@ -481,8 +474,7 @@
/*
* First we check the PCI IRQ routing table (PRT) for an IRQ.
*/
- gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
- &edge_level, &active_high_low);
+ gsi = acpi_pci_irq_lookup(dev, pin, &edge_level, &active_high_low);
/*
* If no PRT entry was found, we'll try to derive an IRQ from the
* device's parent bridge.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-18 20:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-18 20:21 [PATCH] simplify pci_irq internal interfaces Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox