diff options
author | Bart Van Assche <bvanassche@acm.org> | 2022-10-18 13:29:55 -0700 |
---|---|---|
committer | Bart Van Assche <bvanassche@google.com> | 2023-03-15 23:30:58 +0000 |
commit | b7a525a2d042fb3d1812c3ea50ab4030084d3d56 (patch) | |
tree | cbe21e30575d04b36ec76c93ffcb734cf84b3c3f | |
parent | d4f8c8584f6965c1f68fb09bbcbf15c339e6cadc (diff) | |
download | common-b7a525a2d042fb3d1812c3ea50ab4030084d3d56.tar.gz |
UPSTREAM: scsi: ufs: Try harder to change the power mode
Instead of only retrying the START STOP UNIT command if a unit attention is
reported, repeat it if any SCSI error is reported by the device or if the
command timed out.
Change-Id: I4cd4365bc37f1483ae1d8a4e4009c51e0217a736
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20221018202958.1902564-8-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bug: 258442751
Bug: 273761554
(cherry picked from commit 579a4e9dbd53978cad8df88dc612837cdd210ce0)
Signed-off-by: Bart Van Assche <bvanassche@google.com>
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c08ad8503fdb..e2e363bfac9c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8861,9 +8861,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, for (retries = 3; retries > 0; --retries) { ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, HZ, 0, 0, RQF_PM, NULL); - if (!scsi_status_is_check_condition(ret) || - !scsi_sense_valid(&sshdr) || - sshdr.sense_key != UNIT_ATTENTION) + /* + * scsi_execute() only returns a negative value if the request + * queue is dying. + */ + if (ret <= 0) break; } if (ret) { |