Skip to content

Commit 8f2c964

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Reduce the power mode change timeout
The current power mode change timeout (180 s) is so large that it can cause a watchdog timer to fire. Reduce the power mode change timeout to 10 seconds. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 2788360 commit 8f2c964

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8741,6 +8741,8 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
87418741
struct scsi_device *sdp;
87428742
unsigned long flags;
87438743
int ret, retries;
8744+
unsigned long deadline;
8745+
int32_t remaining;
87448746

87458747
spin_lock_irqsave(hba->host->host_lock, flags);
87468748
sdp = hba->ufs_device_wlun;
@@ -8773,9 +8775,14 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
87738775
* callbacks hence set the RQF_PM flag so that it doesn't resume the
87748776
* already suspended childs.
87758777
*/
8778+
deadline = jiffies + 10 * HZ;
87768779
for (retries = 3; retries > 0; --retries) {
8780+
ret = -ETIMEDOUT;
8781+
remaining = deadline - jiffies;
8782+
if (remaining <= 0)
8783+
break;
87778784
ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,
8778-
START_STOP_TIMEOUT, 0, 0, RQF_PM, NULL);
8785+
remaining / HZ, 0, 0, RQF_PM, NULL);
87798786
if (!scsi_status_is_check_condition(ret) ||
87808787
!scsi_sense_valid(&sshdr) ||
87818788
sshdr.sense_key != UNIT_ATTENTION)

0 commit comments

Comments
 (0)