* [RFC PATCH]scsi: pm: resume device if suspend failed
@ 2012-05-11 6:54 Aaron Lu
2012-05-11 14:23 ` Alan Stern
0 siblings, 1 reply; 2+ messages in thread
From: Aaron Lu @ 2012-05-11 6:54 UTC (permalink / raw)
To: Alan Stern; +Cc: linux-scsi, linux-pm, Aaron Lu
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>
---
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;
--
1.7.9.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC PATCH]scsi: pm: resume device if suspend failed
2012-05-11 6:54 [RFC PATCH]scsi: pm: resume device if suspend failed Aaron Lu
@ 2012-05-11 14:23 ` Alan Stern
0 siblings, 0 replies; 2+ messages in thread
From: Alan Stern @ 2012-05-11 14:23 UTC (permalink / raw)
To: Aaron Lu; +Cc: linux-scsi, linux-pm
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@amd.com>
Good catch.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
> ---
> 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-11 14:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11 6:54 [RFC PATCH]scsi: pm: resume device if suspend failed Aaron Lu
2012-05-11 14:23 ` Alan Stern
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.