提交 094ed76e 编写于 作者: A Alan Cox 提交者: Greg Kroah-Hartman

pci: Stamp out pci_find_* usage in fakephp

pci_find is not hotplug safe, so it really doesn't want to be in an
actual hotplug driver either.
Signed-off-by: NAlan Cox <alan@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 0bed208e
...@@ -181,7 +181,9 @@ static void pci_rescan_slot(struct pci_dev *temp) ...@@ -181,7 +181,9 @@ static void pci_rescan_slot(struct pci_dev *temp)
if (!pci_read_config_byte(temp, PCI_HEADER_TYPE, &hdr_type)) { if (!pci_read_config_byte(temp, PCI_HEADER_TYPE, &hdr_type)) {
temp->hdr_type = hdr_type & 0x7f; temp->hdr_type = hdr_type & 0x7f;
if (!pci_find_slot(bus->number, temp->devfn)) { if ((dev = pci_get_slot(bus, temp->devfn)) != NULL)
pci_dev_put(dev);
else {
dev = pci_scan_single_device(bus, temp->devfn); dev = pci_scan_single_device(bus, temp->devfn);
if (dev) { if (dev) {
dbg("New device on %s function %x:%x\n", dbg("New device on %s function %x:%x\n",
...@@ -205,7 +207,9 @@ static void pci_rescan_slot(struct pci_dev *temp) ...@@ -205,7 +207,9 @@ static void pci_rescan_slot(struct pci_dev *temp)
continue; continue;
temp->hdr_type = hdr_type & 0x7f; temp->hdr_type = hdr_type & 0x7f;
if (!pci_find_slot(bus->number, temp->devfn)) { if ((dev = pci_get_slot(bus, temp->devfn)) != NULL)
pci_dev_put(dev);
else {
dev = pci_scan_single_device(bus, temp->devfn); dev = pci_scan_single_device(bus, temp->devfn);
if (dev) { if (dev) {
dbg("New device on %s function %x:%x\n", dbg("New device on %s function %x:%x\n",
...@@ -305,7 +309,7 @@ static int disable_slot(struct hotplug_slot *slot) ...@@ -305,7 +309,7 @@ static int disable_slot(struct hotplug_slot *slot)
/* search for subfunctions and disable them first */ /* search for subfunctions and disable them first */
if (!(dslot->dev->devfn & 7)) { if (!(dslot->dev->devfn & 7)) {
for (func = 1; func < 8; func++) { for (func = 1; func < 8; func++) {
dev = pci_find_slot(dslot->dev->bus->number, dev = pci_get_slot(dslot->dev->bus,
dslot->dev->devfn + func); dslot->dev->devfn + func);
if (dev) { if (dev) {
hslot = get_slot_from_dev(dev); hslot = get_slot_from_dev(dev);
...@@ -315,6 +319,7 @@ static int disable_slot(struct hotplug_slot *slot) ...@@ -315,6 +319,7 @@ static int disable_slot(struct hotplug_slot *slot)
err("Hotplug slot not found for subfunction of PCI device\n"); err("Hotplug slot not found for subfunction of PCI device\n");
return -ENODEV; return -ENODEV;
} }
pci_dev_put(dev);
} else } else
dbg("No device in slot found\n"); dbg("No device in slot found\n");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册