Merge branch 'misc.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / arch / arm64 / kernel / pci.c
index 1006ed2..2276689 100644 (file)
@@ -82,14 +82,29 @@ int acpi_pci_bus_find_domain_nr(struct pci_bus *bus)
 
 int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
 {
-       if (!acpi_disabled) {
-               struct pci_config_window *cfg = bridge->bus->sysdata;
-               struct acpi_device *adev = to_acpi_device(cfg->parent);
-               struct device *bus_dev = &bridge->bus->dev;
+       struct pci_config_window *cfg;
+       struct acpi_device *adev;
+       struct device *bus_dev;
 
-               ACPI_COMPANION_SET(&bridge->dev, adev);
-               set_dev_node(bus_dev, acpi_get_node(acpi_device_handle(adev)));
-       }
+       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);
+
+       bus_dev = &bridge->bus->dev;
+
+       ACPI_COMPANION_SET(&bridge->dev, adev);
+       set_dev_node(bus_dev, acpi_get_node(acpi_device_handle(adev)));
 
        return 0;
 }