Skip to content

Commit 18eaf71

Browse files
bvanasscheBart Van Assche
authored andcommitted
FROMGIT: 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: I231b641942239cbcfba31058137a41e0277380a6 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: 258234315 (cherry picked from commit 579a4e9dbd53978cad8df88dc612837cdd210ce0 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next) Signed-off-by: Bart Van Assche <bvanassche@google.com>
1 parent cfc314c commit 18eaf71

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/scsi/ufs/ufshcd.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8696,9 +8696,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
86968696
for (retries = 3; retries > 0; --retries) {
86978697
ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,
86988698
HZ, 0, 0, RQF_PM, NULL);
8699-
if (!scsi_status_is_check_condition(ret) ||
8700-
!scsi_sense_valid(&sshdr) ||
8701-
sshdr.sense_key != UNIT_ATTENTION)
8699+
/*
8700+
* scsi_execute() only returns a negative value if the request
8701+
* queue is dying.
8702+
*/
8703+
if (ret <= 0)
87028704
break;
87038705
}
87048706
if (ret) {

0 commit comments

Comments
 (0)