linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Fix bridge_d3 update on device removal
@ 2016-09-06  4:20 Lukas Wunner
  2016-09-07 15:47 ` Mika Westerberg
  2016-09-13 21:02 ` Bjorn Helgaas
  0 siblings, 2 replies; 6+ messages in thread
From: Lukas Wunner @ 2016-09-06  4:20 UTC (permalink / raw)
  To: linux-pci; +Cc: Mika Westerberg, Rafael J. Wysocki

Starting with v4.8, we allow a PCIe port to runtime suspend to D3hot if
the port itself and its children satisfy a number of conditions.  Once a
child is removed, we recheck those conditions in case the removed device
was blocking the port from suspending.

The rechecking needs to happen *after* the device has been removed from
the bus it resides on.  Otherwise when walking the port's subordinate
bus in pci_bridge_d3_update(), the device being removed would
erroneously still be taken into account.

However the device is removed from the bus_list in pci_destroy_dev() and
we currently recheck *before* that.  Fix it.

Fixes: 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend")
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/pci/remove.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index d1ef7ac..f9357e0 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -40,6 +40,7 @@ static void pci_destroy_dev(struct pci_dev *dev)
 	list_del(&dev->bus_list);
 	up_write(&pci_bus_sem);
 
+	pci_bridge_d3_device_removed(dev);
 	pci_free_resources(dev);
 	put_device(&dev->dev);
 }
@@ -96,8 +97,6 @@ static void pci_remove_bus_device(struct pci_dev *dev)
 		dev->subordinate = NULL;
 	}
 
-	pci_bridge_d3_device_removed(dev);
-
 	pci_destroy_dev(dev);
 }
 
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-09-13 21:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-06  4:20 [PATCH] PCI: Fix bridge_d3 update on device removal Lukas Wunner
2016-09-07 15:47 ` Mika Westerberg
2016-09-07 16:07   ` Rafael J. Wysocki
2016-09-13 21:02 ` Bjorn Helgaas
2016-09-13 21:03   ` Rafael J. Wysocki
2016-09-13 21:13   ` Lukas Wunner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).