Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: ufs: core: Change the monitor function argument types

Pass a SCSI command pointer instead of a struct ufshcd_lrb pointer. This
patch prepares for combining the SCSI command and ufshcd_lrb data
structures into a single data structure.

Reviewed-by: Avri Altman <avri.altman@sandisk.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251031204029.2883185-15-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
f59568f4 ae7bf255

+22 -22
+22 -22
drivers/ufs/core/ufshcd.c
··· 2295 2295 2296 2296 /* Must only be called for SCSI commands. */ 2297 2297 static inline bool ufshcd_should_inform_monitor(struct ufs_hba *hba, 2298 - struct ufshcd_lrb *lrbp) 2298 + struct scsi_cmnd *cmd) 2299 2299 { 2300 2300 const struct ufs_hba_monitor *m = &hba->monitor; 2301 + struct request *rq = scsi_cmd_to_rq(cmd); 2302 + struct ufshcd_lrb *lrbp = &hba->lrb[rq->tag]; 2301 2303 2302 - return (m->enabled && 2303 - (!m->chunk_size || m->chunk_size == lrbp->cmd->sdb.length) && 2304 - ktime_before(hba->monitor.enabled_ts, lrbp->issue_time_stamp)); 2304 + return m->enabled && 2305 + (!m->chunk_size || m->chunk_size == cmd->sdb.length) && 2306 + ktime_before(hba->monitor.enabled_ts, lrbp->issue_time_stamp); 2305 2307 } 2306 2308 2307 - static void ufshcd_start_monitor(struct ufs_hba *hba, 2308 - const struct ufshcd_lrb *lrbp) 2309 + static void ufshcd_start_monitor(struct ufs_hba *hba, struct scsi_cmnd *cmd) 2309 2310 { 2310 - int dir = ufshcd_monitor_opcode2dir(*lrbp->cmd->cmnd); 2311 + int dir = ufshcd_monitor_opcode2dir(cmd->cmnd[0]); 2311 2312 unsigned long flags; 2312 2313 2313 2314 spin_lock_irqsave(hba->host->host_lock, flags); ··· 2317 2316 spin_unlock_irqrestore(hba->host->host_lock, flags); 2318 2317 } 2319 2318 2320 - static void ufshcd_update_monitor(struct ufs_hba *hba, const struct ufshcd_lrb *lrbp) 2319 + static void ufshcd_update_monitor(struct ufs_hba *hba, struct scsi_cmnd *cmd) 2321 2320 { 2322 - int dir = ufshcd_monitor_opcode2dir(*lrbp->cmd->cmnd); 2321 + struct request *req = scsi_cmd_to_rq(cmd); 2322 + struct ufshcd_lrb *lrbp = &hba->lrb[req->tag]; 2323 + int dir = ufshcd_monitor_opcode2dir(cmd->cmnd[0]); 2323 2324 unsigned long flags; 2324 2325 2325 2326 spin_lock_irqsave(hba->host->host_lock, flags); 2326 2327 if (dir >= 0 && hba->monitor.nr_queued[dir] > 0) { 2327 - const struct request *req = scsi_cmd_to_rq(lrbp->cmd); 2328 2328 struct ufs_hba_monitor *m = &hba->monitor; 2329 2329 ktime_t now, inc, lat; 2330 2330 ··· 2360 2358 struct ufshcd_lrb *lrbp, 2361 2359 struct ufs_hw_queue *hwq) 2362 2360 { 2361 + struct scsi_cmnd *cmd = lrbp->cmd; 2363 2362 unsigned long flags; 2364 2363 2365 2364 if (hba->monitor.enabled) { ··· 2369 2366 lrbp->compl_time_stamp = ktime_set(0, 0); 2370 2367 lrbp->compl_time_stamp_local_clock = 0; 2371 2368 } 2372 - if (lrbp->cmd) { 2373 - ufshcd_add_command_trace(hba, lrbp->cmd, UFS_CMD_SEND); 2369 + if (cmd) { 2370 + ufshcd_add_command_trace(hba, cmd, UFS_CMD_SEND); 2374 2371 ufshcd_clk_scaling_start_busy(hba); 2375 - if (unlikely(ufshcd_should_inform_monitor(hba, lrbp))) 2376 - ufshcd_start_monitor(hba, lrbp); 2372 + if (unlikely(ufshcd_should_inform_monitor(hba, cmd))) 2373 + ufshcd_start_monitor(hba, cmd); 2377 2374 } 2378 2375 2379 2376 if (hba->mcq_enabled) { ··· 2389 2386 } else { 2390 2387 spin_lock_irqsave(&hba->outstanding_lock, flags); 2391 2388 if (hba->vops && hba->vops->setup_xfer_req) 2392 - hba->vops->setup_xfer_req(hba, lrbp->task_tag, 2393 - !!lrbp->cmd); 2389 + hba->vops->setup_xfer_req(hba, lrbp->task_tag, !!cmd); 2394 2390 __set_bit(lrbp->task_tag, &hba->outstanding_reqs); 2395 2391 ufshcd_writel(hba, 1 << lrbp->task_tag, 2396 2392 REG_UTP_TRANSFER_REQ_DOOR_BELL); ··· 5630 5628 void ufshcd_compl_one_cqe(struct ufs_hba *hba, int task_tag, 5631 5629 struct cq_entry *cqe) 5632 5630 { 5633 - struct ufshcd_lrb *lrbp; 5634 - struct scsi_cmnd *cmd; 5631 + struct ufshcd_lrb *lrbp = &hba->lrb[task_tag]; 5632 + struct scsi_cmnd *cmd = lrbp->cmd; 5635 5633 enum utp_ocs ocs; 5636 5634 5637 - lrbp = &hba->lrb[task_tag]; 5638 5635 if (hba->monitor.enabled) { 5639 5636 lrbp->compl_time_stamp = ktime_get(); 5640 5637 lrbp->compl_time_stamp_local_clock = local_clock(); 5641 5638 } 5642 - cmd = lrbp->cmd; 5643 5639 if (cmd) { 5644 - if (unlikely(ufshcd_should_inform_monitor(hba, lrbp))) 5645 - ufshcd_update_monitor(hba, lrbp); 5640 + if (unlikely(ufshcd_should_inform_monitor(hba, cmd))) 5641 + ufshcd_update_monitor(hba, cmd); 5646 5642 ufshcd_add_command_trace(hba, cmd, UFS_CMD_COMP); 5647 5643 cmd->result = ufshcd_transfer_rsp_status(hba, lrbp, cqe); 5648 5644 ufshcd_release_scsi_cmd(hba, lrbp);