diff options
| author | Yinghai Lu <yinghai@kernel.org> | 2012-09-24 16:51:23 -0400 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-09-24 16:51:23 -0400 |
| commit | 059e4ba292c69cb400cda92fbd37f25d4eec564b (patch) | |
| tree | c9c3682700550fadeba47b2253c48592f8c5c97d | |
| parent | c29aabe22eafb4914aecebab6e99623894d81564 (diff) | |
PCI/ACPI: Use DEVICE_ACPI_HANDLE rather than searching acpi_pci_roots
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
| -rw-r--r-- | include/linux/pci-acpi.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 248fba2af98a..9a22b5efb384 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
| @@ -22,19 +22,24 @@ extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle); | |||
| 22 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | 22 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) |
| 23 | { | 23 | { |
| 24 | struct pci_bus *pbus = pdev->bus; | 24 | struct pci_bus *pbus = pdev->bus; |
| 25 | |||
| 25 | /* Find a PCI root bus */ | 26 | /* Find a PCI root bus */ |
| 26 | while (!pci_is_root_bus(pbus)) | 27 | while (!pci_is_root_bus(pbus)) |
| 27 | pbus = pbus->parent; | 28 | pbus = pbus->parent; |
| 28 | return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), | 29 | |
| 29 | pbus->number); | 30 | return DEVICE_ACPI_HANDLE(pbus->bridge); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) | 33 | static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) |
| 33 | { | 34 | { |
| 34 | if (!pci_is_root_bus(pbus)) | 35 | struct device *dev; |
| 35 | return DEVICE_ACPI_HANDLE(&(pbus->self->dev)); | 36 | |
| 36 | return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), | 37 | if (pci_is_root_bus(pbus)) |
| 37 | pbus->number); | 38 | dev = pbus->bridge; |
| 39 | else | ||
| 40 | dev = &pbus->self->dev; | ||
| 41 | |||
| 42 | return DEVICE_ACPI_HANDLE(dev); | ||
| 38 | } | 43 | } |
| 39 | #endif | 44 | #endif |
| 40 | 45 | ||
