From pcihpd-discuss-admin@lists.sourceforge.net Fri Apr 8 16:58:02 2005 From: Rajesh Shah To: gregkh@suse.de Subject: [Pcihpd-discuss] [patch 2/5] Clean up notify handlers on acpiphp unload Date: Fri, 8 Apr 2005 16:52:31 -0700 A root bridge may not have directly attached hotpluggable slots under it. Instead, it may have p2p bridges with slots under it. In this case, we need to clean up the p2p bridges and slots properly too. Patch below applies on top of the original patch, and fixes this problem. Without this, acpiphp leaves behind notify handlers on module unload, and subsequent module load attempts don't work properly too. Patch was tested on an ia64 Tiger4 box. Signed-off-by: Rajesh Shah Signed-off-by: Greg Kroah-Hartman --- linux-2.6.12-rc2-mm2-rshah1/drivers/pci/hotplug/acpiphp_glue.c | 34 +++++++--- 1 files changed, 26 insertions(+), 8 deletions(-) diff -puN drivers/pci/hotplug/acpiphp_glue.c~acpiphp-unload-fix drivers/pci/hotplug/acpiphp_glue.c --- linux-2.6.12-rc2-mm2/drivers/pci/hotplug/acpiphp_glue.c~acpiphp-unload-fix 2005-04-08 15:38:53.574549925 -0700 +++ linux-2.6.12-rc2-mm2-rshah1/drivers/pci/hotplug/acpiphp_glue.c 2005-04-08 15:38:53.683924924 -0700 @@ -487,18 +487,12 @@ static struct acpiphp_bridge *acpiphp_ha return NULL; } -static void remove_bridge(acpi_handle handle) +static void cleanup_bridge(struct acpiphp_bridge *bridge) { struct list_head *list, *tmp; - struct acpiphp_bridge *bridge; struct acpiphp_slot *slot; acpi_status status; - - bridge = acpiphp_handle_to_bridge(handle); - if (!bridge) { - err("Could not find bridge for handle %p\n", handle); - return; - } + acpi_handle handle = bridge->handle; status = acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, handle_hotplug_event_bridge); @@ -529,6 +523,30 @@ static void remove_bridge(acpi_handle ha kfree(bridge); } +static acpi_status +cleanup_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) +{ + struct acpiphp_bridge *bridge; + + if (!(bridge = acpiphp_handle_to_bridge(handle))) + return AE_OK; + cleanup_bridge(bridge); + return AE_OK; +} + +static void remove_bridge(acpi_handle handle) +{ + struct acpiphp_bridge *bridge; + + bridge = acpiphp_handle_to_bridge(handle); + if (bridge) { + cleanup_bridge(bridge); + } else { + /* clean-up p2p bridges under this host bridge */ + acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, + (u32)1, cleanup_p2p_bridge, NULL, NULL); + } +} static int power_on_slot(struct acpiphp_slot *slot) { _ ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Pcihpd-discuss mailing list Pcihpd-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pcihpd-discuss