]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: ufs: core: Fix hba->last_dme_cmd_tstamp timestamp updating logic
authorVamshi Gajjela <vamshigajjela@google.com>
Wed, 24 Jul 2024 13:51:26 +0000 (19:21 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Aug 2024 03:45:44 +0000 (05:45 +0200)
commit2ac8f14d7f9db22fc0fcf94c4823d4937211d838
tree1874adbff16b6c2f88155312310d3055abf76c55
parentcac638238584b46a22f1e9af1f2f2802c73c9944
scsi: ufs: core: Fix hba->last_dme_cmd_tstamp timestamp updating logic

commit ab9fd06cb8f0db0854291833fc40c789e43a361f upstream.

The ufshcd_add_delay_before_dme_cmd() always introduces a delay of
MIN_DELAY_BEFORE_DME_CMDS_US between DME commands even when it's not
required. The delay is added when the UFS host controller supplies the
quirk UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS.

Fix the logic to update hba->last_dme_cmd_tstamp to ensure subsequent DME
commands have the correct delay in the range of 0 to
MIN_DELAY_BEFORE_DME_CMDS_US.

Update the timestamp at the end of the function to ensure it captures the
latest time after any necessary delay has been applied.

Signed-off-by: Vamshi Gajjela <vamshigajjela@google.com>
Link: https://lore.kernel.org/r/20240724135126.1786126-1-vamshigajjela@google.com
Fixes: cad2e03d8607 ("ufs: add support to allow non standard behaviours (quirks)")
Cc: stable@vger.kernel.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/ufs/ufshcd.c