scsi: ufs: Simplify completion timestamp for SCSI and query commands
authorStanley Chu <stanley.chu@mediatek.com>
Mon, 6 Jul 2020 06:07:06 +0000 (14:07 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 14 Jul 2020 02:51:55 +0000 (22:51 -0400)
Simplify recording command completion time in __ufshcd_transfer_req_compl()
by assigning lrbp->compl_time_stamp in a unified location.

Link: https://lore.kernel.org/r/20200706060707.32608-2-stanley.chu@mediatek.com
Acked-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c

index efc0a6c..4a64c0a 100644 (file)
@@ -4910,6 +4910,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
 
        for_each_set_bit(index, &completed_reqs, hba->nutrs) {
                lrbp = &hba->lrb[index];
+               lrbp->compl_time_stamp = ktime_get();
                cmd = lrbp->cmd;
                if (cmd) {
                        ufshcd_add_command_trace(hba, index, "complete");
@@ -4918,13 +4919,11 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
                        cmd->result = result;
                        /* Mark completed command as NULL in LRB */
                        lrbp->cmd = NULL;
-                       lrbp->compl_time_stamp = ktime_get();
                        /* Do not touch lrbp after scsi done */
                        cmd->scsi_done(cmd);
                        __ufshcd_release(hba);
                } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
                        lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
-                       lrbp->compl_time_stamp = ktime_get();
                        if (hba->dev_cmd.complete) {
                                ufshcd_add_command_trace(hba, index,
                                                "dev_complete");