Skip to content

Commit be1611e

Browse files
fbarratmpe
authored andcommitted
pci/hotplug/pnv-php: Relax check when disabling slot
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 <alastair@d-silva.org> Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20191121134918.7155-10-fbarrat@linux.ibm.com
1 parent ea53919 commit be1611e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/pci/hotplug/pnv_php.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,13 @@ static int pnv_php_disable_slot(struct hotplug_slot *slot)
566566
struct pnv_php_slot *php_slot = to_pnv_php_slot(slot);
567567
int ret;
568568

569-
if (php_slot->state != PNV_PHP_STATE_POPULATED)
569+
/*
570+
* Allow to disable a slot already in the registered state to
571+
* cover cases where the slot couldn't be enabled and never
572+
* reached the populated state
573+
*/
574+
if (php_slot->state != PNV_PHP_STATE_POPULATED &&
575+
php_slot->state != PNV_PHP_STATE_REGISTERED)
570576
return 0;
571577

572578
/* Remove all devices behind the slot */

0 commit comments

Comments
 (0)