diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-13 17:27:24 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-22 22:00:20 -0400 |
commit | ed13febf8fac1a08f939f97378574937a7d2f121 (patch) | |
tree | 23935eb937d0e41bbfa3312617ac0801449a001b | |
parent | 87831273438d66167dddc6d73e42d49671cb56bb (diff) |
ACPI / hotplug / PCI: Rework acpiphp_handle_to_bridge()
Using the hotplug context objects introduced previously rework the
ACPI-based PCI hotplug (ACPIPHP) core code to get to acpiphp_bridge
objects associated with hotplug bridges from those context objects
rather than from the global list of hotplug bridges.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index ef7b25c1db57..6cfd8a684766 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -454,18 +454,20 @@ static int detect_ejectable_slots(acpi_handle handle) | |||
454 | 454 | ||
455 | static struct acpiphp_bridge *acpiphp_handle_to_bridge(acpi_handle handle) | 455 | static struct acpiphp_bridge *acpiphp_handle_to_bridge(acpi_handle handle) |
456 | { | 456 | { |
457 | struct acpiphp_bridge *bridge; | 457 | struct acpiphp_context *context; |
458 | struct acpiphp_bridge *bridge = NULL; | ||
458 | 459 | ||
459 | mutex_lock(&bridge_mutex); | 460 | mutex_lock(&acpiphp_context_lock); |
460 | list_for_each_entry(bridge, &bridge_list, list) | 461 | context = acpiphp_get_context(handle); |
461 | if (bridge->handle == handle) { | 462 | if (context) { |
463 | bridge = context->bridge; | ||
464 | if (bridge) | ||
462 | get_bridge(bridge); | 465 | get_bridge(bridge); |
463 | mutex_unlock(&bridge_mutex); | ||
464 | return bridge; | ||
465 | } | ||
466 | mutex_unlock(&bridge_mutex); | ||
467 | 466 | ||
468 | return NULL; | 467 | acpiphp_put_context(context); |
468 | } | ||
469 | mutex_unlock(&acpiphp_context_lock); | ||
470 | return bridge; | ||
469 | } | 471 | } |
470 | 472 | ||
471 | static void cleanup_bridge(struct acpiphp_bridge *bridge) | 473 | static void cleanup_bridge(struct acpiphp_bridge *bridge) |