Commit 3783ad83 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by David S. Miller

[TG32]: Use pci_get_slot() to find 5704 peers, to handle domains properly.

parent 82b3a0c2
......@@ -7523,23 +7523,24 @@ static char * __devinit tg3_phy_string(struct tg3 *tp)
static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp)
{
struct pci_dev *peer = NULL;
unsigned int func;
struct pci_dev *peer;
unsigned int func, devnr = tp->pdev->devfn & ~7;
for (func = 0; func < 7; func++) {
unsigned int devfn = tp->pdev->devfn;
devfn &= ~7;
devfn |= func;
if (devfn == tp->pdev->devfn)
continue;
peer = pci_find_slot(tp->pdev->bus->number, devfn);
if (peer)
for (func = 0; func < 8; func++) {
peer = pci_get_slot(tp->pdev->bus, devnr | func);
if (peer && peer != tp->pdev)
break;
pci_dev_put(peer);
}
if (!peer || peer == tp->pdev)
BUG();
/*
* We don't need to keep the refcount elevated; there's no way
* to remove one half of this device without removing the other
*/
pci_dev_put(peer);
return peer;
}
......
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