Skip to content

Commit b8c3a7b

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: ufs: Have midlayer retry start stop errors
This has the SCSI midlayer retry errors instead of driving them itself. Signed-off-by: Mike Christie <michael.christie@oracle.com> Link: https://lore.kernel.org/r/20240123002220.129141-19-michael.christie@oracle.com Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b72f2d1 commit b8c3a7b

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9475,7 +9475,17 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev,
94759475
struct scsi_sense_hdr *sshdr)
94769476
{
94779477
const unsigned char cdb[6] = { START_STOP, 0, 0, 0, pwr_mode << 4, 0 };
9478+
struct scsi_failure failure_defs[] = {
9479+
{
9480+
.allowed = 2,
9481+
.result = SCMD_FAILURE_RESULT_ANY,
9482+
},
9483+
};
9484+
struct scsi_failures failures = {
9485+
.failure_definitions = failure_defs,
9486+
};
94789487
const struct scsi_exec_args args = {
9488+
.failures = &failures,
94799489
.sshdr = sshdr,
94809490
.req_flags = BLK_MQ_REQ_PM,
94819491
.scmd_flags = SCMD_FAIL_IF_RECOVERING,
@@ -9501,7 +9511,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
95019511
struct scsi_sense_hdr sshdr;
95029512
struct scsi_device *sdp;
95039513
unsigned long flags;
9504-
int ret, retries;
9514+
int ret;
95059515

95069516
spin_lock_irqsave(hba->host->host_lock, flags);
95079517
sdp = hba->ufs_device_wlun;
@@ -9527,15 +9537,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
95279537
* callbacks hence set the RQF_PM flag so that it doesn't resume the
95289538
* already suspended childs.
95299539
*/
9530-
for (retries = 3; retries > 0; --retries) {
9531-
ret = ufshcd_execute_start_stop(sdp, pwr_mode, &sshdr);
9532-
/*
9533-
* scsi_execute() only returns a negative value if the request
9534-
* queue is dying.
9535-
*/
9536-
if (ret <= 0)
9537-
break;
9538-
}
9540+
ret = ufshcd_execute_start_stop(sdp, pwr_mode, &sshdr);
95399541
if (ret) {
95409542
sdev_printk(KERN_WARNING, sdp,
95419543
"START_STOP failed for power mode: %d, result %x\n",

0 commit comments

Comments
 (0)