From 42c444b5bbbd5f3bcdfac095ba15247cea922dc1 Mon Sep 17 00:00:00 2001 From: Alex Chiang Date: Mon, 30 Mar 2009 10:50:14 -0600 Subject: [PATCH] --- yaml --- r: 142755 b: refs/heads/master c: 5d4a4b25ddc3e864d3a562c024bebdc922118854 h: refs/heads/master i: 142753: 1ed2f074886d163cb6b3d3772f2f76cb9d5f4bbb 142751: 50fd761ec5098689960aaff5b9b3673e9e91cc6c v: v3 --- [refs] | 2 +- trunk/drivers/pci/hotplug/acpiphp_glue.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index b7f91996a126..a668eea74fe1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c2ac7cdc6707a8a3fc5cdaebb65cb724ba8ecdef +refs/heads/master: 5d4a4b25ddc3e864d3a562c024bebdc922118854 diff --git a/trunk/drivers/pci/hotplug/acpiphp_glue.c b/trunk/drivers/pci/hotplug/acpiphp_glue.c index 803d9ddd6e75..a33794d9e0dc 100644 --- a/trunk/drivers/pci/hotplug/acpiphp_glue.c +++ b/trunk/drivers/pci/hotplug/acpiphp_glue.c @@ -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 @@ -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); @@ -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);