SCSI: No sleep stop for devices in disconnection
PATCH 1/1 SCSI: No sleep stop for devices in disconnection
Quoted 1 line
From
75de5ee7afc17322c61a1188b21e59b13b4a2bdbMon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Wed, 6 Oct 2010 15:33:37 +0200
Subject: [PATCH] SCSI: No sleep stop for devices in disconnection
If the system is going to sleep while a device is being disconnected, the commands send during preparation for sleep are likely to fail. However if that happens it can be ignored as the devices are going away anyway. This can happen with eSATA because it takes long to process a disconnection.
Signed-off-by Oliver Neukum <[email protected]>
--- drivers/scsi/scsi_pm.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-)
drivers/scsi/scsi_pm.c +14 -3
@@ -17,16 +17,27 @@static int scsi_dev_type_suspend (struct device *dev,pm_message_t msg) {struct device_driver *drv; -int err; +struct scsi_device *sdev; +int err, state; - err =scsi_device_quiesce (to_scsi_device (dev)); + sdev =to_scsi_device (dev); + err =scsi_device_quiesce (sdev);if (err ==0 ) { drv = dev->driver;if (drv && drv->suspend) err = drv->suspend (dev, msg); }dev_dbg (dev,"scsi suspend: %d\n" , err); -return err; + + state = sdev->sdev_state; +switch (state) { +case SDEV_CANCEL : +case SDEV_DEL : +/* lost a race against a disconnection handler */ +return 0 ; +default : +return err; + } }static int scsi_dev_type_resume (struct device *dev)
Signature · 1 line
1.7.1