Thread (19 messages) 19 messages, 3 authors, 2020-01-29
STALE2318d LANDED: 2 (0M)
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 09/11] pci/hotplug/pnv-php: Relax check when disabling slot

From: Frederic Barrat <hidden>
Date: 2019-11-21 14:04:22
Subsystem: linux for powerpc (32-bit and 64-bit), pci subsystem, the rest · Maintainers: Madhavan Srinivasan, Michael Ellerman, Bjorn Helgaas, Linus Torvalds

The driver only allows to disable a slot in the POPULATED
state. However, if an error occurs while enabling the slot, say
because the link couldn't be trained, then the POPULATED state may not
be reached, yet the power state of the slot is on. So allow to disable
a slot in the REGISTERED state. Removing the devices will do nothing
since it's not populated, and we'll set the power state of the slot
back to off.

Reviewed-by: Alastair D'Silva <redacted>
Reviewed-by: Andrew Donnellan <redacted>
Signed-off-by: Frederic Barrat <redacted>
---
Changelog:
v2: no change


 drivers/pci/hotplug/pnv_php.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 0cb6a4897905..f2de76390aff 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -566,7 +566,13 @@ static int pnv_php_disable_slot(struct hotplug_slot *slot)
 	struct pnv_php_slot *php_slot = to_pnv_php_slot(slot);
 	int ret;
 
-	if (php_slot->state != PNV_PHP_STATE_POPULATED)
+	/*
+	 * Allow to disable a slot already in the registered state to
+	 * cover cases where the slot couldn't be enabled and never
+	 * reached the populated state
+	 */
+	if (php_slot->state != PNV_PHP_STATE_POPULATED &&
+	    php_slot->state != PNV_PHP_STATE_REGISTERED)
 		return 0;
 
 	/* Remove all devices behind the slot */
-- 
2.21.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help