On Mon, 2019-09-09 at 17:45 +0200, Frederic Barrat wrote:
> 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.
> 
> Signed-off-by: Frederic Barrat <fbar...@linux.ibm.com>
> ---
>  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 f0a7360154e7..5ca51d67db4b 100644
> --- a/drivers/pci/hotplug/pnv_php.c
> +++ b/drivers/pci/hotplug/pnv_php.c
> @@ -523,7 +523,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 */

Reviewed-by: Alastair D'Silva <alast...@d-silva.org>

-- 
Alastair D'Silva
Open Source Developer
Linux Technology Centre, IBM Australia
mob: 0423 762 819

Reply via email to