summaryrefslogtreecommitdiffstats
path: root/drivers/ufs
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2022-10-18 13:29:55 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2022-10-22 03:25:59 +0000
commit579a4e9dbd53978cad8df88dc612837cdd210ce0 (patch)
tree2e61b9b06a3550c94563f29fe46a143af4f24c23 /drivers/ufs
parentdcd5b7637c6d442d957f73780a03047413ed3a10 (diff)
downloadlinux-579a4e9dbd53978cad8df88dc612837cdd210ce0.tar.bz2
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. 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>
Diffstat (limited to 'drivers/ufs')
-rw-r--r--drivers/ufs/core/ufshcd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index f83a0045a129..84ca17d29898 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8776,9 +8776,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) {