aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-15 16:03:14 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-15 19:45:21 -0400
commit86f5f3ca49e3d20c1a5e83917b2c8b98a7c95506 (patch)
tree39cdc562463e0fb96707c5472619bcdade76d568 /drivers/pci
parent1795cd9b3a91d4b5473c97f491d63892442212ab (diff)
ACPI / hotplug / PCI: Eliminate acpiphp_dev_to_bridge()
Since acpiphp_dev_to_bridge() is only called by acpiphp_check_host_bridge(), move the code from it to that function directly which reduces the call chain depth and makes the code slightly easier to follow. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 602d153c7055..08043f9c1dd5 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -369,20 +369,6 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
369 return AE_OK; 369 return AE_OK;
370} 370}
371 371
372static struct acpiphp_bridge *acpiphp_dev_to_bridge(struct acpi_device *adev)
373{
374 struct acpiphp_bridge *bridge = NULL;
375
376 acpi_lock_hp_context();
377 if (adev->hp) {
378 bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
379 if (bridge)
380 get_bridge(bridge);
381 }
382 acpi_unlock_hp_context();
383 return bridge;
384}
385
386static void cleanup_bridge(struct acpiphp_bridge *bridge) 372static void cleanup_bridge(struct acpiphp_bridge *bridge)
387{ 373{
388 struct acpiphp_slot *slot; 374 struct acpiphp_slot *slot;
@@ -753,9 +739,15 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus)
753 739
754void acpiphp_check_host_bridge(struct acpi_device *adev) 740void acpiphp_check_host_bridge(struct acpi_device *adev)
755{ 741{
756 struct acpiphp_bridge *bridge; 742 struct acpiphp_bridge *bridge = NULL;
757 743
758 bridge = acpiphp_dev_to_bridge(adev); 744 acpi_lock_hp_context();
745 if (adev->hp) {
746 bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
747 if (bridge)
748 get_bridge(bridge);
749 }
750 acpi_unlock_hp_context();
759 if (bridge) { 751 if (bridge) {
760 pci_lock_rescan_remove(); 752 pci_lock_rescan_remove();
761 753