ACPI / hotplug / PCI: Rework acpiphp_handle_to_bridge()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 13 Jul 2013 21:27:24 +0000 (23:27 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 23 Jul 2013 02:00:20 +0000 (04:00 +0200)
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>
drivers/pci/hotplug/acpiphp_glue.c

index ef7b25c1db57e0f1f0be85f39e0ed4a20d40a128..6cfd8a6847662f6bd43c61eba4f466bd794b6987 100644 (file)
@@ -454,18 +454,20 @@ static int detect_ejectable_slots(acpi_handle handle)
 
 static struct acpiphp_bridge *acpiphp_handle_to_bridge(acpi_handle handle)
 {
-       struct acpiphp_bridge *bridge;
+       struct acpiphp_context *context;
+       struct acpiphp_bridge *bridge = NULL;
 
-       mutex_lock(&bridge_mutex);
-       list_for_each_entry(bridge, &bridge_list, list)
-               if (bridge->handle == handle) {
+       mutex_lock(&acpiphp_context_lock);
+       context = acpiphp_get_context(handle);
+       if (context) {
+               bridge = context->bridge;
+               if (bridge)
                        get_bridge(bridge);
-                       mutex_unlock(&bridge_mutex);
-                       return bridge;
-               }
-       mutex_unlock(&bridge_mutex);
 
-       return NULL;
+               acpiphp_put_context(context);
+       }
+       mutex_unlock(&acpiphp_context_lock);
+       return bridge;
 }
 
 static void cleanup_bridge(struct acpiphp_bridge *bridge)
This page took 0.025765 seconds and 5 git commands to generate.