diff options
| -rw-r--r-- | drivers/pci/hotplug/pciehp_pci.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 6aa6a1be4555..922b1831c680 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
| @@ -204,10 +204,11 @@ int pciehp_configure_device(struct slot *p_slot) | |||
| 204 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | 204 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; |
| 205 | int num, fn; | 205 | int num, fn; |
| 206 | 206 | ||
| 207 | dev = pci_find_slot(p_slot->bus, PCI_DEVFN(p_slot->device, 0)); | 207 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); |
| 208 | if (dev) { | 208 | if (dev) { |
| 209 | err("Device %s already exists at %x:%x, cannot hot-add\n", | 209 | err("Device %s already exists at %x:%x, cannot hot-add\n", |
| 210 | pci_name(dev), p_slot->bus, p_slot->device); | 210 | pci_name(dev), p_slot->bus, p_slot->device); |
| 211 | pci_dev_put(dev); | ||
| 211 | return -EINVAL; | 212 | return -EINVAL; |
| 212 | } | 213 | } |
| 213 | 214 | ||
| @@ -243,18 +244,20 @@ int pciehp_unconfigure_device(struct slot *p_slot) | |||
| 243 | int rc = 0; | 244 | int rc = 0; |
| 244 | int j; | 245 | int j; |
| 245 | u8 bctl = 0; | 246 | u8 bctl = 0; |
| 247 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | ||
| 246 | 248 | ||
| 247 | dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, | 249 | dbg("%s: bus/dev = %x/%x\n", __FUNCTION__, p_slot->bus, |
| 248 | p_slot->device); | 250 | p_slot->device); |
| 249 | 251 | ||
| 250 | for (j=0; j<8 ; j++) { | 252 | for (j=0; j<8 ; j++) { |
| 251 | struct pci_dev* temp = pci_find_slot(p_slot->bus, | 253 | struct pci_dev* temp = pci_get_slot(parent, |
| 252 | (p_slot->device << 3) | j); | 254 | (p_slot->device << 3) | j); |
| 253 | if (!temp) | 255 | if (!temp) |
| 254 | continue; | 256 | continue; |
| 255 | if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { | 257 | if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { |
| 256 | err("Cannot remove display device %s\n", | 258 | err("Cannot remove display device %s\n", |
| 257 | pci_name(temp)); | 259 | pci_name(temp)); |
| 260 | pci_dev_put(temp); | ||
| 258 | continue; | 261 | continue; |
| 259 | } | 262 | } |
| 260 | if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | 263 | if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { |
| @@ -262,10 +265,12 @@ int pciehp_unconfigure_device(struct slot *p_slot) | |||
| 262 | if (bctl & PCI_BRIDGE_CTL_VGA) { | 265 | if (bctl & PCI_BRIDGE_CTL_VGA) { |
| 263 | err("Cannot remove display device %s\n", | 266 | err("Cannot remove display device %s\n", |
| 264 | pci_name(temp)); | 267 | pci_name(temp)); |
| 268 | pci_dev_put(temp); | ||
| 265 | continue; | 269 | continue; |
| 266 | } | 270 | } |
| 267 | } | 271 | } |
| 268 | pci_remove_bus_device(temp); | 272 | pci_remove_bus_device(temp); |
| 273 | pci_dev_put(temp); | ||
| 269 | } | 274 | } |
| 270 | /* | 275 | /* |
| 271 | * Some PCI Express root ports require fixup after hot-plug operation. | 276 | * Some PCI Express root ports require fixup after hot-plug operation. |
