Re: [RFC PATCH]scsi: pm: resume device if suspend failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 11 May 2012, Aaron Lu wrote:

> For scsi devices which use scsi bus runtime callback, runtime suspend
> will call scsi_dev_type_suspend, and if the drv->suspend failed, the
> device will still be in active state. But since scsi_device_quiesce is
> called, the device will not be able to respond any more commands.
> So add a check here to see if err occured, if so, bring the device back
> to normal state with scsi_device_resume.
> 
> Signed-off-by: Aaron Lu <Aaron.Lu@xxxxxxx>

Good catch.
        
Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

> ---
>  drivers/scsi/scsi_pm.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
> index c467064..33b8bf9 100644
> --- a/drivers/scsi/scsi_pm.c
> +++ b/drivers/scsi/scsi_pm.c
> @@ -24,8 +24,11 @@ static int scsi_dev_type_suspend(struct device *dev, pm_message_t msg)
>  	err = scsi_device_quiesce(to_scsi_device(dev));
>  	if (err == 0) {
>  		drv = dev->driver;
> -		if (drv && drv->suspend)
> +		if (drv && drv->suspend) {
>  			err = drv->suspend(dev, msg);
> +			if (err)
> +				scsi_device_resume(dev);
> +		}
>  	}
>  	dev_dbg(dev, "scsi suspend: %d\n", err);
>  	return err;

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux