summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-09-29 18:36:15 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2006-10-18 11:36:11 -0700
commit094ed76e8988d46158b036ab150e0c22aff6db3a (patch)
treeae77d7c28a164d94372ca264816dca9b43f6cd77 /drivers/pci
parent0bed208efcb25bed4dc2026488a4417aa68e7c92 (diff)
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: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/fakephp.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 05a4f0f9018..aaeb1129132 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -181,7 +181,9 @@ static void pci_rescan_slot(struct pci_dev *temp)
if (!pci_read_config_byte(temp, PCI_HEADER_TYPE, &hdr_type)) {
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);
if (dev) {
dbg("New device on %s function %x:%x\n",
@@ -205,7 +207,9 @@ static void pci_rescan_slot(struct pci_dev *temp)
continue;
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);
if (dev) {
dbg("New device on %s function %x:%x\n",
@@ -305,7 +309,7 @@ static int disable_slot(struct hotplug_slot *slot)
/* search for subfunctions and disable them first */
if (!(dslot->dev->devfn & 7)) {
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);
if (dev) {
hslot = get_slot_from_dev(dev);
@@ -315,6 +319,7 @@ static int disable_slot(struct hotplug_slot *slot)
err("Hotplug slot not found for subfunction of PCI device\n");
return -ENODEV;
}
+ pci_dev_put(dev);
} else
dbg("No device in slot found\n");
}