Skip to content

Commit

Permalink
[SCSI] scsi_pm: resume device if suspend failed
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Alan Stern <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
  • Loading branch information
Aaron Lu authored and James Bottomley committed May 22, 2012
1 parent 6192bd7 commit d20ec59
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/scsi/scsi_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(to_scsi_device(dev));
}
}
dev_dbg(dev, "scsi suspend: %d\n", err);
return err;
Expand Down

0 comments on commit d20ec59

Please sign in to comment.