Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142755
b: refs/heads/master
c: 5d4a4b2
h: refs/heads/master
i:
  142753: 1ed2f07
  142751: 50fd761
v: v3
  • Loading branch information
Alex Chiang authored and Jesse Barnes committed Apr 6, 2009
1 parent fb9c1ed commit 42c444b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c2ac7cdc6707a8a3fc5cdaebb65cb724ba8ecdef
refs/heads/master: 5d4a4b25ddc3e864d3a562c024bebdc922118854
14 changes: 14 additions & 0 deletions trunk/drivers/pci/hotplug/acpiphp_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
* - The one in acpiphp_bridge has its refcount elevated by pci_get_slot()
* when the bridge is scanned and it loses a refcount when the bridge
* is removed.
* - When a P2P bridge is present, we elevate the refcount on the subordinate
* bus. It loses the refcount when the the driver unloads.
*/

#include <linux/init.h>
Expand Down Expand Up @@ -440,6 +442,12 @@ static void add_p2p_bridge(acpi_handle *handle, struct pci_dev *pci_dev)
goto err;
}

/*
* Grab a ref to the subordinate PCI bus in case the bus is
* removed via PCI core logical hotplug. The ref pins the bus
* (which we access during module unload).
*/
get_device(&bridge->pci_bus->dev);
spin_lock_init(&bridge->res_lock);

init_bridge_misc(bridge);
Expand Down Expand Up @@ -619,6 +627,12 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
slot = next;
}

/*
* Only P2P bridges have a pci_dev
*/
if (bridge->pci_dev)
put_device(&bridge->pci_bus->dev);

pci_dev_put(bridge->pci_dev);
list_del(&bridge->list);
kfree(bridge);
Expand Down

0 comments on commit 42c444b

Please sign in to comment.