diff options
| author | Bart Van Assche <bvanassche@acm.org> | 2025-10-31 23:39:21 +0300 |
|---|---|---|
| committer | Martin K. Petersen <martin.petersen@oracle.com> | 2025-11-13 01:02:32 +0300 |
| commit | ae7bf255b10e4c8382faec06f527ba832c18be24 (patch) | |
| tree | 5da40f4d4f5ac7aa906c76970da276ac9addb422 | |
| parent | 3e7fff3fee5b7fa1538b2cef023733cf10366a4a (diff) | |
| download | linux-ae7bf255b10e4c8382faec06f527ba832c18be24.tar.xz | |
scsi: ufs: core: Only call ufshcd_should_inform_monitor() for SCSI commands
ufshcd_should_inform_monitor() only returns 'true' for SCSI commands.
Instead of checking inside ufshcd_should_inform_monitor() whether its
second argument represents a SCSI command, only call this function for
SCSI commands. This patch prepares for removing the lrbp->cmd member.
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251031204029.2883185-14-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
| -rw-r--r-- | drivers/ufs/core/ufshcd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index f478d5b5230d..dbdb8c30ca09 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2293,12 +2293,13 @@ static inline int ufshcd_monitor_opcode2dir(u8 opcode) return -EINVAL; } +/* Must only be called for SCSI commands. */ static inline bool ufshcd_should_inform_monitor(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) { const struct ufs_hba_monitor *m = &hba->monitor; - return (m->enabled && lrbp && lrbp->cmd && + return (m->enabled && (!m->chunk_size || m->chunk_size == lrbp->cmd->sdb.length) && ktime_before(hba->monitor.enabled_ts, lrbp->issue_time_stamp)); } @@ -2368,9 +2369,9 @@ static inline void ufshcd_send_command(struct ufs_hba *hba, if (lrbp->cmd) { ufshcd_add_command_trace(hba, lrbp->cmd, UFS_CMD_SEND); ufshcd_clk_scaling_start_busy(hba); + if (unlikely(ufshcd_should_inform_monitor(hba, lrbp))) + ufshcd_start_monitor(hba, lrbp); } - if (unlikely(ufshcd_should_inform_monitor(hba, lrbp))) - ufshcd_start_monitor(hba, lrbp); if (hba->mcq_enabled) { int utrd_size = sizeof(struct utp_transfer_req_desc); |
