diff options
author | Aaron Lu <aaron.lu@amd.com> | 2012-05-15 02:43:00 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-05-22 06:09:50 -0400 |
commit | d20ec597cba1e8ea407c9a7c668a9e04fc057c83 (patch) | |
tree | 8b4807a70dbeaca14a882ef96bc0410bcf1f464f /drivers/scsi | |
parent | 6192bd7cdc37e2df9391403235b72668a5bf27da (diff) |
[SCSI] scsi_pm: resume device if suspend failed
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@amd.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_pm.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c index f661a41fa4c6..d4201ded3b22 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) | |||
24 | err = scsi_device_quiesce(to_scsi_device(dev)); | 24 | err = scsi_device_quiesce(to_scsi_device(dev)); |
25 | if (err == 0) { | 25 | if (err == 0) { |
26 | drv = dev->driver; | 26 | drv = dev->driver; |
27 | if (drv && drv->suspend) | 27 | if (drv && drv->suspend) { |
28 | err = drv->suspend(dev, msg); | 28 | err = drv->suspend(dev, msg); |
29 | if (err) | ||
30 | scsi_device_resume(to_scsi_device(dev)); | ||
31 | } | ||
29 | } | 32 | } |
30 | dev_dbg(dev, "scsi suspend: %d\n", err); | 33 | dev_dbg(dev, "scsi suspend: %d\n", err); |
31 | return err; | 34 | return err; |