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

PCI: arm: use generic pci_swizzle_interrupt_pin()

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

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 57c2cf71
...@@ -491,17 +491,17 @@ EXPORT_SYMBOL(pcibios_bus_to_resource); ...@@ -491,17 +491,17 @@ EXPORT_SYMBOL(pcibios_bus_to_resource);
*/ */
u8 __devinit pci_std_swizzle(struct pci_dev *dev, u8 *pinp) u8 __devinit pci_std_swizzle(struct pci_dev *dev, u8 *pinp)
{ {
int pin = *pinp - 1; int pin = *pinp;
while (dev->bus->self) { while (dev->bus->self) {
pin = (pin + PCI_SLOT(dev->devfn)) & 3; pin = pci_swizzle_interrupt_pin(dev, pin);
/* /*
* move up the chain of bridges, * move up the chain of bridges,
* swizzling as we go. * swizzling as we go.
*/ */
dev = dev->bus->self; dev = dev->bus->self;
} }
*pinp = pin + 1; *pinp = pin;
return PCI_SLOT(dev->devfn); return PCI_SLOT(dev->devfn);
} }
......
...@@ -63,13 +63,7 @@ ...@@ -63,13 +63,7 @@
* *
* Where A = pin 1, B = pin 2 and so on and pin=0 = default = A. * Where A = pin 1, B = pin 2 and so on and pin=0 = default = A.
* Thus, each swizzle is ((pin-1) + (device#-4)) % 4 * Thus, each swizzle is ((pin-1) + (device#-4)) % 4
*
* The following code swizzles for exactly one bridge.
*/ */
static inline int bridge_swizzle(int pin, unsigned int slot)
{
return (pin + slot) & 3;
}
/* /*
* This routine handles multiple bridges. * This routine handles multiple bridges.
...@@ -81,15 +75,14 @@ static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp) ...@@ -81,15 +75,14 @@ static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp)
if (pin == 0) if (pin == 0)
pin = 1; pin = 1;
pin -= 1;
while (dev->bus->self) { while (dev->bus->self) {
pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)); pin = pci_swizzle_interrupt_pin(dev, pin);
/* /*
* move up the chain of bridges, swizzling as we go. * move up the chain of bridges, swizzling as we go.
*/ */
dev = dev->bus->self; dev = dev->bus->self;
} }
*pinp = pin + 1; *pinp = pin;
return PCI_SLOT(dev->devfn); return PCI_SLOT(dev->devfn);
} }
......
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