ACPI / hotplug / PCI: Mark stale PCI devices disconnected
authorMika Westerberg <mika.westerberg@linux.intel.com>
Tue, 29 May 2018 16:02:23 +0000 (19:02 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 4 Jun 2018 17:08:06 +0000 (12:08 -0500)
Following PCIehp mark the unplugged PCI devices disconnected.  This makes
sure PCI core code leaves the now missing hardware registers alone.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/pci/hotplug/acpiphp_glue.c

index bc9e19642567da374b6dc9ffc613e19bd8071a3d..b526565b0464e62fd8caf3cfe5e9d1568c980054 100644 (file)
@@ -649,6 +649,11 @@ static void trim_stale_devices(struct pci_dev *dev)
                alive = pci_device_is_present(dev);
 
        if (!alive) {
+               pci_dev_set_disconnected(dev, NULL);
+               if (pci_has_subordinate(dev))
+                       pci_walk_bus(dev->subordinate, pci_dev_set_disconnected,
+                                    NULL);
+
                pci_stop_and_remove_bus_device(dev);
                if (adev)
                        acpi_bus_trim(adev);