PCI: x86: use generic pci_swizzle_interrupt_pin()
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Tue, 9 Dec 2008 23:12:37 +0000 (16:12 -0700)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 7 Jan 2009 19:12:54 +0000 (11:12 -0800)
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: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
arch/x86/pci/irq.c
arch/x86/pci/visws.c

index e1d605bfeb47aba38b8c53064737e95605ae1493..4064345cf14450557580ca3dbf14b07004f1efc4 100644 (file)
@@ -1068,7 +1068,7 @@ static void __init pcibios_fixup_irqs(void)
                                struct pci_dev *bridge = dev->bus->self;
                                int bus;
 
-                               pin = (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1;
+                               pin = pci_swizzle_interrupt_pin(dev, pin);
                                bus = bridge->bus->number;
                                irq = IO_APIC_get_PCI_irq_vector(bus,
                                                PCI_SLOT(bridge->devfn), pin - 1);
@@ -1232,7 +1232,7 @@ static int pirq_enable_irq(struct pci_dev *dev)
                        while (irq < 0 && dev->bus->parent) { /* go back to the bridge */
                                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,
                                                PCI_SLOT(bridge->devfn), pin - 1);
                                if (irq >= 0)
index 16d0c0eb0d19670692aedf958a05b381ee47b7c1..2c54e7e03f535f482a820b21b60cdeb669be2d87 100644 (file)
@@ -24,17 +24,12 @@ static void pci_visws_disable_irq(struct pci_dev *dev) { }
 
 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)
 {
        u8 pin = *pinp;
 
        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;
        }
        *pinp = pin;