Commit b1c86792 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Jesse Barnes

PCI: x86: use generic pci_swizzle_interrupt_pin()

Use the generic pci_swizzle_interrupt_pin() instead of arch-specific code.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: hpa@zytor.com
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 1be9baa0
...@@ -1068,7 +1068,7 @@ static void __init pcibios_fixup_irqs(void) ...@@ -1068,7 +1068,7 @@ static void __init pcibios_fixup_irqs(void)
struct pci_dev *bridge = dev->bus->self; struct pci_dev *bridge = dev->bus->self;
int bus; int bus;
pin = (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1; pin = pci_swizzle_interrupt_pin(dev, pin);
bus = bridge->bus->number; bus = bridge->bus->number;
irq = IO_APIC_get_PCI_irq_vector(bus, irq = IO_APIC_get_PCI_irq_vector(bus,
PCI_SLOT(bridge->devfn), pin - 1); PCI_SLOT(bridge->devfn), pin - 1);
...@@ -1232,7 +1232,7 @@ static int pirq_enable_irq(struct pci_dev *dev) ...@@ -1232,7 +1232,7 @@ static int pirq_enable_irq(struct pci_dev *dev)
while (irq < 0 && dev->bus->parent) { /* go back to the bridge */ while (irq < 0 && dev->bus->parent) { /* go back to the bridge */
struct pci_dev *bridge = dev->bus->self; struct pci_dev *bridge = dev->bus->self;
pin = (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1; pin = pci_swizzle_interrupt_pin(dev, pin);
irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
PCI_SLOT(bridge->devfn), pin - 1); PCI_SLOT(bridge->devfn), pin - 1);
if (irq >= 0) if (irq >= 0)
......
...@@ -24,17 +24,12 @@ static void pci_visws_disable_irq(struct pci_dev *dev) { } ...@@ -24,17 +24,12 @@ static void pci_visws_disable_irq(struct pci_dev *dev) { }
unsigned int pci_bus0, pci_bus1; unsigned int pci_bus0, pci_bus1;
static inline u8 bridge_swizzle(u8 pin, u8 slot)
{
return (((pin - 1) + slot) % 4) + 1;
}
static u8 __init visws_swizzle(struct pci_dev *dev, u8 *pinp) static u8 __init visws_swizzle(struct pci_dev *dev, u8 *pinp)
{ {
u8 pin = *pinp; u8 pin = *pinp;
while (dev->bus->self) { /* Move up the chain of bridges. */ while (dev->bus->self) { /* Move up the chain of bridges. */
pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); pin = pci_swizzle_interrupt_pin(dev, pin);
dev = dev->bus->self; dev = dev->bus->self;
} }
*pinp = pin; *pinp = pin;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment