diff options
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dbdc5f7e2b29..01e264fb50e0 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -317,13 +317,20 @@ void acpi_pci_remove_bus(struct pci_bus *bus) | |||
317 | /* ACPI bus type */ | 317 | /* ACPI bus type */ |
318 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) | 318 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) |
319 | { | 319 | { |
320 | struct pci_dev * pci_dev; | 320 | struct pci_dev *pci_dev = to_pci_dev(dev); |
321 | u64 addr; | 321 | bool is_bridge; |
322 | u64 addr; | ||
322 | 323 | ||
323 | pci_dev = to_pci_dev(dev); | 324 | /* |
325 | * pci_is_bridge() is not suitable here, because pci_dev->subordinate | ||
326 | * is set only after acpi_pci_find_device() has been called for the | ||
327 | * given device. | ||
328 | */ | ||
329 | is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE | ||
330 | || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; | ||
324 | /* Please ref to ACPI spec for the syntax of _ADR */ | 331 | /* Please ref to ACPI spec for the syntax of _ADR */ |
325 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); | 332 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); |
326 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); | 333 | *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge); |
327 | if (!*handle) | 334 | if (!*handle) |
328 | return -ENODEV; | 335 | return -ENODEV; |
329 | return 0; | 336 | return 0; |