[PATCH 3/3] ses: Retry Power-on-reset check condition

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

 



During startup any SCSI request might encounter a 'Power-on/reset'
sense code, which just can be retried.
In the case of ses it needs to be retried, otherwise ses will
errorneously detect this as a failure and not attach the driver.

Signed-off-by: Hannes Reinecke <hare@xxxxxxxx>
---
 drivers/scsi/ses.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index c1f96b0..9c8b3db 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -110,14 +110,20 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code,
 		0
 	};
 	unsigned char recv_page_code;
+	int retries = SES_RETRIES;
 	struct scsi_sense_hdr sshdr;
 
+retry:
 	ret =  scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen,
-				&sshdr, SES_TIMEOUT, SES_RETRIES, NULL);
+				&sshdr, SES_TIMEOUT, retries, NULL);
 	if (unlikely(ret)) {
-		if (status_byte(ret) == CHECK_CONDITION &&
-		    sshdr.asc == 0x25 && sshdr.ascq == 0x00) {
-			ret = -ENODEV;
+		if (status_byte(ret) == CHECK_CONDITION) {
+			if (sshdr.asc == 0x29) {
+				retries--;
+				goto retry;
+			}
+			if (sshdr.asc == 0x25 && sshdr.ascq == 0x00)
+				ret = -ENODEV;
 		}
 		return ret;
 	}
-- 
1.8.5.6




[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