Skip to content

Commit

Permalink
ACPI / hotplug / PCI: Eliminate acpiphp_dev_to_bridge()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki committed Jul 15, 2014
1 parent 1795cd9 commit 86f5f3c
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions drivers/pci/hotplug/acpiphp_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,20 +369,6 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
return AE_OK;
}

static struct acpiphp_bridge *acpiphp_dev_to_bridge(struct acpi_device *adev)
{
struct acpiphp_bridge *bridge = NULL;

acpi_lock_hp_context();
if (adev->hp) {
bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
if (bridge)
get_bridge(bridge);
}
acpi_unlock_hp_context();
return bridge;
}

static void cleanup_bridge(struct acpiphp_bridge *bridge)
{
struct acpiphp_slot *slot;
Expand Down Expand Up @@ -753,9 +739,15 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus)

void acpiphp_check_host_bridge(struct acpi_device *adev)
{
struct acpiphp_bridge *bridge;
struct acpiphp_bridge *bridge = NULL;

bridge = acpiphp_dev_to_bridge(adev);
acpi_lock_hp_context();
if (adev->hp) {
bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
if (bridge)
get_bridge(bridge);
}
acpi_unlock_hp_context();
if (bridge) {
pci_lock_rescan_remove();

Expand Down

0 comments on commit 86f5f3c

Please sign in to comment.