linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pciehp_resume: don't add existing device
@ 2016-11-09 18:05 Ravi Chandra Sadineni
  2016-11-09 19:58 ` Lukas Wunner
  2016-11-09 21:15 ` Rajat Jain
  0 siblings, 2 replies; 5+ messages in thread
From: Ravi Chandra Sadineni @ 2016-11-09 18:05 UTC (permalink / raw)
  To: linux-pci
  Cc: tbroch, rajatja, gwendal, bhelgaas, ravisadineni, keith.busch,
	paul.gortmaker, Ravi Chandra Sadineni

If a slot was occupied before supend, and nothing has changed after
resume, we call pciehp_enable_slot() although it fails a little
later with the message:
   Device XXXX:XX:XX.X already exists at XXXX:XX:XX, cannot hot-add
   Cannot add device at XXXX:XX:XX

This was partly discussed here: https://lkml.org/lkml/2013/7/9/452
and I'm pulling only the part4 of that patch, since it does not change
anything functionally (or atleast does not seem to make it worse), but
prevents uncomfortable messages pointed above.
---
 drivers/pci/hotplug/pciehp_core.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 612b21a..873cff8 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -290,6 +290,7 @@ static int pciehp_resume(struct pcie_device *dev)
 {
 	struct controller *ctrl;
 	struct slot *slot;
+	struct pci_bus *pbus = dev->port->subordinate;
 	u8 status;
 
 	ctrl = get_service_data(dev);
@@ -302,10 +303,13 @@ static int pciehp_resume(struct pcie_device *dev)
 	/* Check if slot is occupied */
 	pciehp_get_adapter_status(slot, &status);
 	mutex_lock(&slot->hotplug_lock);
-	if (status)
-		pciehp_enable_slot(slot);
-	else
+	if (status) {
+		if (list_empty(&pbus->devices))
+			pciehp_enable_slot(slot);
+	}
+	else {
 		pciehp_disable_slot(slot);
+	}
 	mutex_unlock(&slot->hotplug_lock);
 	return 0;
 }
-- 
2.6.6


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

end of thread, other threads:[~2016-11-11  7:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-09 18:05 [PATCH] pciehp_resume: don't add existing device Ravi Chandra Sadineni
2016-11-09 19:58 ` Lukas Wunner
2016-11-09 20:59   ` Rajat Jain
2016-11-11  7:23     ` Lukas Wunner
2016-11-09 21:15 ` Rajat Jain

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).