diff mbox series

[RFC,4/5] arm64: PCI: Retrieve ACPI device information directly from host bridges

Message ID 20210811153619.88922-5-boqun.feng@gmail.com (mailing list archive)
State New, archived
Headers show
Series PCI: Use the private field of pci_host_bridge for ACPI device | expand

Commit Message

Boqun Feng Aug. 11, 2021, 3:36 p.m. UTC
Now since we store the corresponding ACPI device pointer in the
->private of pci_host_bridge, use it instead of the sysdata to retrieve
the ACPI device information. Doing this decouples the dependency on the
pci_config_window structure in Hyper-V virtual PCI, because passing a
NULL pointer as the ACPI device is the soly reason of the dependency.

The decoupling avoids adding pci_config_window in hv_pcibus_dev and also
makes the code cleaner.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 arch/arm64/kernel/pci.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 2276689b5411..783971749eb7 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -82,25 +82,13 @@  int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
-	struct pci_config_window *cfg;
 	struct acpi_device *adev;
 	struct device *bus_dev;
 
 	if (acpi_disabled)
 		return 0;
 
-	cfg = bridge->bus->sysdata;
-
-	/*
-	 * On Hyper-V there is no corresponding ACPI device for a root bridge,
-	 * therefore ->parent is set as NULL by the driver. And set 'adev' as
-	 * NULL in this case because there is no proper ACPI device.
-	 */
-	if (!cfg->parent)
-		adev = NULL;
-	else
-		adev = to_acpi_device(cfg->parent);
-
+	adev = acpi_pci_root_device(bridge);
 	bus_dev = &bridge->bus->dev;
 
 	ACPI_COMPANION_SET(&bridge->dev, adev);