]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: ufs: core: Change the type of one ufshcd_add_command_trace() argument
authorBart Van Assche <bvanassche@acm.org>
Fri, 31 Oct 2025 20:39:19 +0000 (13:39 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 12 Nov 2025 22:02:32 +0000 (17:02 -0500)
Change the 'tag' argument into a SCSI command pointer. This patch
prepares for the removal of the hba->lrb[] array.

Reviewed-by: Avri Altman <avri.altman@sandisk.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251031204029.2883185-12-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c

index 87892a13ef571a2eae54264f492ccf060e85abab..edf56e9e825b71dd2e20a6df130fca7893436f00 100644 (file)
@@ -473,7 +473,7 @@ static void ufshcd_add_uic_command_trace(struct ufs_hba *hba,
                                 ufshcd_readl(hba, REG_UIC_COMMAND_ARG_3));
 }
 
-static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
+static void ufshcd_add_command_trace(struct ufs_hba *hba, struct scsi_cmnd *cmd,
                                     enum ufs_trace_str_t str_t)
 {
        u64 lba = 0;
@@ -481,9 +481,9 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
        u32 doorbell = 0;
        u32 intr;
        u32 hwq_id = 0;
-       struct ufshcd_lrb *lrbp = &hba->lrb[tag];
-       struct scsi_cmnd *cmd = lrbp->cmd;
        struct request *rq = scsi_cmd_to_rq(cmd);
+       unsigned int tag = rq->tag;
+       struct ufshcd_lrb *lrbp = &hba->lrb[tag];
        int transfer_len = -1;
 
        /* trace UPIU also */
@@ -501,7 +501,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
                       be32_to_cpu(lrbp->ucd_req_ptr->sc.exp_data_transfer_len);
                lba = scsi_get_lba(cmd);
                if (opcode == WRITE_10)
-                       group_id = lrbp->cmd->cmnd[6];
+                       group_id = cmd->cmnd[6];
        } else if (opcode == UNMAP) {
                /*
                 * The number of Bytes to be unmapped beginning with the lba.
@@ -2367,7 +2367,7 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag,
                lrbp->compl_time_stamp_local_clock = 0;
        }
        if (lrbp->cmd) {
-               ufshcd_add_command_trace(hba, task_tag, UFS_CMD_SEND);
+               ufshcd_add_command_trace(hba, lrbp->cmd, UFS_CMD_SEND);
                ufshcd_clk_scaling_start_busy(hba);
        }
        if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
@@ -5641,7 +5641,7 @@ void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag,
        if (cmd) {
                if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
                        ufshcd_update_monitor(hba, lrbp);
-               ufshcd_add_command_trace(hba, task_tag, UFS_CMD_COMP);
+               ufshcd_add_command_trace(hba, cmd, UFS_CMD_COMP);
                cmd->result = ufshcd_transfer_rsp_status(hba, lrbp, cqe);
                ufshcd_release_scsi_cmd(hba, lrbp);
                /* Do not touch lrbp after scsi done */