aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-09-24 16:51:23 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-09-24 16:51:23 -0400
commit059e4ba292c69cb400cda92fbd37f25d4eec564b (patch)
treec9c3682700550fadeba47b2253c48592f8c5c97d /include
parentc29aabe22eafb4914aecebab6e99623894d81564 (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
Diffstat (limited to 'include')
-rw-r--r--include/linux/pci-acpi.h17
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);
22static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 22static 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
32static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) 33static 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