scsi: ufs: Try to save power mode change and UIC cmd completion timeout
authorCan Guo <cang@codeaurora.org>
Tue, 3 Nov 2020 06:24:40 +0000 (22:24 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 5 Nov 2020 04:13:33 +0000 (23:13 -0500)
commit0f52fcb99ea2738a0a0f28e12cf4dd427069dd2a
treef3110a69ca26f4c93815c2bcbab764e25f5195d8
parentda3fecb0040324c08f1587e5bff1f15f36be1872
scsi: ufs: Try to save power mode change and UIC cmd completion timeout

Use the uic_cmd->cmd_active as a flag to track the lifecycle of an UIC cmd.
The flag is set before sending the UIC cmd and cleared in IRQ handler. When
a PMC or UIC cmd completion timeout happens, if the flag is not set,
instead of returning timeout error, we still treat it as a successful
operation.  This is to deal with the scenario in which completion has been
raised but the one waiting for the completion cannot be awaken in time due
to kernel scheduling problem.

Link: https://lore.kernel.org/r/1604384682-15837-3-git-send-email-cang@codeaurora.org
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h