aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 931d0b44eace..91eceaf3131b 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -441,7 +441,9 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
441 list_del(&bridge->list); 441 list_del(&bridge->list);
442 mutex_unlock(&bridge_mutex); 442 mutex_unlock(&bridge_mutex);
443 443
444 mutex_lock(&acpiphp_context_lock);
444 bridge->is_going_away = true; 445 bridge->is_going_away = true;
446 mutex_unlock(&acpiphp_context_lock);
445} 447}
446 448
447/** 449/**
@@ -941,6 +943,7 @@ static void handle_hotplug_event(acpi_handle handle, u32 type, void *data)
941{ 943{
942 struct acpiphp_context *context; 944 struct acpiphp_context *context;
943 u32 ost_code = ACPI_OST_SC_SUCCESS; 945 u32 ost_code = ACPI_OST_SC_SUCCESS;
946 acpi_status status;
944 947
945 switch (type) { 948 switch (type) {
946 case ACPI_NOTIFY_BUS_CHECK: 949 case ACPI_NOTIFY_BUS_CHECK:
@@ -976,13 +979,20 @@ static void handle_hotplug_event(acpi_handle handle, u32 type, void *data)
976 979
977 mutex_lock(&acpiphp_context_lock); 980 mutex_lock(&acpiphp_context_lock);
978 context = acpiphp_get_context(handle); 981 context = acpiphp_get_context(handle);
979 if (context && !WARN_ON(context->handle != handle)) { 982 if (!context || WARN_ON(context->handle != handle)
980 get_bridge(context->func.parent); 983 || context->func.parent->is_going_away)
981 acpiphp_put_context(context); 984 goto err_out;
982 acpi_hotplug_execute(hotplug_event_work, context, type); 985
986 get_bridge(context->func.parent);
987 acpiphp_put_context(context);
988 status = acpi_hotplug_execute(hotplug_event_work, context, type);
989 if (ACPI_SUCCESS(status)) {
983 mutex_unlock(&acpiphp_context_lock); 990 mutex_unlock(&acpiphp_context_lock);
984 return; 991 return;
985 } 992 }
993 put_bridge(context->func.parent);
994
995 err_out:
986 mutex_unlock(&acpiphp_context_lock); 996 mutex_unlock(&acpiphp_context_lock);
987 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; 997 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
988 998