[1/2] ufs:mcq:Use ufshcd_mcq_req_to_hwq() to simplify updating hwq.

Message ID 20240105021041.20400-2-cw9316.lee@samsung.com
State New
Headers
Series ufs:mcq:Code cleanups |

Commit Message

Chanwoo Lee Jan. 5, 2024, 2:10 a.m. UTC
  From: ChanWoo Lee <cw9316.lee@samsung.com>

Use ufshcd_mcq_req_to_hwq() to remove unnecessary variables and simplify.

Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
---
 drivers/ufs/core/ufshcd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Comments

Bart Van Assche Jan. 8, 2024, 5:31 p.m. UTC | #1
On 1/4/24 18:10, Chanwoo Lee wrote:
> From: ChanWoo Lee <cw9316.lee@samsung.com>
> 
> Use ufshcd_mcq_req_to_hwq() to remove unnecessary variables and simplify.
> 
> Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com>
> ---
>   drivers/ufs/core/ufshcd.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 30df6f6a72c6..c9d122302889 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -5597,7 +5597,6 @@ static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
>   	struct ufshcd_lrb *lrbp;
>   	struct scsi_cmnd *cmd;
>   	unsigned long flags;
> -	u32 hwq_num, utag;
>   	int tag;
>   
>   	for (tag = 0; tag < hba->nutrs; tag++) {
> @@ -5607,9 +5606,7 @@ static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
>   		    test_bit(SCMD_STATE_COMPLETE, &cmd->state))
>   			continue;
>   
> -		utag = blk_mq_unique_tag(scsi_cmd_to_rq(cmd));
> -		hwq_num = blk_mq_unique_tag_to_hwq(utag);
> -		hwq = &hba->uhq[hwq_num];
> +		hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
>   
>   		if (force_compl) {
>   			ufshcd_mcq_compl_all_cqes_lock(hba, hwq);

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
  

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 30df6f6a72c6..c9d122302889 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -5597,7 +5597,6 @@  static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
 	struct ufshcd_lrb *lrbp;
 	struct scsi_cmnd *cmd;
 	unsigned long flags;
-	u32 hwq_num, utag;
 	int tag;
 
 	for (tag = 0; tag < hba->nutrs; tag++) {
@@ -5607,9 +5606,7 @@  static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba,
 		    test_bit(SCMD_STATE_COMPLETE, &cmd->state))
 			continue;
 
-		utag = blk_mq_unique_tag(scsi_cmd_to_rq(cmd));
-		hwq_num = blk_mq_unique_tag_to_hwq(utag);
-		hwq = &hba->uhq[hwq_num];
+		hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(cmd));
 
 		if (force_compl) {
 			ufshcd_mcq_compl_all_cqes_lock(hba, hwq);