Skip to content

Commit

Permalink
PCI/ACPI: Use DEVICE_ACPI_HANDLE rather than searching acpi_pci_roots
Browse files Browse the repository at this point in the history
When we bind a device to an ACPI handle, the handle is stored in
dev->archdata.acpi_handle.  For such devices, there's no need to
search the acpi_pci_roots list with acpi_get_pci_rootbridge_handle();
we can just use DEVICE_ACPI_HANDLE(dev) directly.

[bhelgaas: changelog, reorder "if" to avoid negation]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
  • Loading branch information
Yinghai Lu authored and Bjorn Helgaas committed Sep 24, 2012
1 parent c29aabe commit 059e4ba
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions include/linux/pci-acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,24 @@ extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle);
static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
{
struct pci_bus *pbus = pdev->bus;

/* Find a PCI root bus */
while (!pci_is_root_bus(pbus))
pbus = pbus->parent;
return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
pbus->number);

return DEVICE_ACPI_HANDLE(pbus->bridge);
}

static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
{
if (!pci_is_root_bus(pbus))
return DEVICE_ACPI_HANDLE(&(pbus->self->dev));
return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
pbus->number);
struct device *dev;

if (pci_is_root_bus(pbus))
dev = pbus->bridge;
else
dev = &pbus->self->dev;

return DEVICE_ACPI_HANDLE(dev);
}
#endif

Expand Down

0 comments on commit 059e4ba

Please sign in to comment.