diff options
author | Bart Van Assche <bvanassche@acm.org> | 2022-10-18 13:29:55 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-13 09:42:20 +0200 |
commit | 6ab081571f6a4f6b2eab6b5328f8a4273faa40d0 (patch) | |
tree | 628717d3fe0caf23d2dbf5053251c78c844faa88 /drivers/ufs/core | |
parent | 9fc3adc6d0fe96e79e21990faebc252814ee18a4 (diff) | |
download | linux-stable-6ab081571f6a4f6b2eab6b5328f8a4273faa40d0.tar.gz linux-stable-6ab081571f6a4f6b2eab6b5328f8a4273faa40d0.tar.bz2 linux-stable-6ab081571f6a4f6b2eab6b5328f8a4273faa40d0.zip |
scsi: ufs: Try harder to change the power mode
[ Upstream commit 579a4e9dbd53978cad8df88dc612837cdd210ce0 ]
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>
Stable-dep-of: fe8637f7708c ("scsi: ufs: core: Increase the START STOP UNIT timeout from one to ten seconds")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/ufs/core')
-rw-r--r-- | drivers/ufs/core/ufshcd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 977bd4b9dd0b..36437d39b93c 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8830,9 +8830,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) { |