2024-01-05 02:11:55

by Chanwoo Lee

[permalink] [raw]
Subject: [PATCH 0/2] ufs:mcq:Code cleanups

From: ChanWoo Lee <[email protected]>

This series has code some cleanups to the UFS mcq code.
No functional change.

ChanWoo Lee (2):
ufs:mcq:Use ufshcd_mcq_req_to_hwq() to simplify updating hwq.
ufs:mcq:Remove unused parameters

drivers/ufs/core/ufs-mcq.c | 6 ++----
drivers/ufs/core/ufshcd.c | 5 +----
2 files changed, 3 insertions(+), 8 deletions(-)

--
2.29.0



2024-01-05 02:12:15

by Chanwoo Lee

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

From: ChanWoo Lee <[email protected]>

Use ufshcd_mcq_req_to_hwq() to remove unnecessary variables and simplify.

Signed-off-by: ChanWoo Lee <[email protected]>
---
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);
--
2.29.0


2024-01-05 02:12:42

by Chanwoo Lee

[permalink] [raw]
Subject: [PATCH 2/2] ufs:mcq:Remove unused parameters

From: ChanWoo Lee <[email protected]>

The 'hwq' parameter is not used in this function.
So, remove unused parameters.

Signed-off-by: ChanWoo Lee <[email protected]>
---
drivers/ufs/core/ufs-mcq.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index edc752e55878..8db81f1a12d5 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -258,9 +258,7 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_write_cqis);
* Current MCQ specification doesn't provide a Task Tag or its equivalent in
* the Completion Queue Entry. Find the Task Tag using an indirect method.
*/
-static int ufshcd_mcq_get_tag(struct ufs_hba *hba,
- struct ufs_hw_queue *hwq,
- struct cq_entry *cqe)
+static int ufshcd_mcq_get_tag(struct ufs_hba *hba, struct cq_entry *cqe)
{
u64 addr;

@@ -278,7 +276,7 @@ static void ufshcd_mcq_process_cqe(struct ufs_hba *hba,
struct ufs_hw_queue *hwq)
{
struct cq_entry *cqe = ufshcd_mcq_cur_cqe(hwq);
- int tag = ufshcd_mcq_get_tag(hba, hwq, cqe);
+ int tag = ufshcd_mcq_get_tag(hba, cqe);

if (cqe->command_desc_base_addr) {
ufshcd_compl_one_cqe(hba, tag, cqe);
--
2.29.0


2024-01-08 17:33:18

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH 1/2] ufs:mcq:Use ufshcd_mcq_req_to_hwq() to simplify updating hwq.

On 1/4/24 18:10, Chanwoo Lee wrote:
> From: ChanWoo Lee <[email protected]>
>
> Use ufshcd_mcq_req_to_hwq() to remove unnecessary variables and simplify.
>
> Signed-off-by: ChanWoo Lee <[email protected]>
> ---
> 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 <[email protected]>

2024-01-08 17:36:14

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH 2/2] ufs:mcq:Remove unused parameters

On 1/4/24 18:10, Chanwoo Lee wrote:
> From: ChanWoo Lee <[email protected]>
>
> The 'hwq' parameter is not used in this function.
> So, remove unused parameters.
>
> Signed-off-by: ChanWoo Lee <[email protected]>
> ---
> drivers/ufs/core/ufs-mcq.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index edc752e55878..8db81f1a12d5 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -258,9 +258,7 @@ EXPORT_SYMBOL_GPL(ufshcd_mcq_write_cqis);
> * Current MCQ specification doesn't provide a Task Tag or its equivalent in
> * the Completion Queue Entry. Find the Task Tag using an indirect method.
> */
> -static int ufshcd_mcq_get_tag(struct ufs_hba *hba,
> - struct ufs_hw_queue *hwq,
> - struct cq_entry *cqe)
> +static int ufshcd_mcq_get_tag(struct ufs_hba *hba, struct cq_entry *cqe)
> {
> u64 addr;
>
> @@ -278,7 +276,7 @@ static void ufshcd_mcq_process_cqe(struct ufs_hba *hba,
> struct ufs_hw_queue *hwq)
> {
> struct cq_entry *cqe = ufshcd_mcq_cur_cqe(hwq);
> - int tag = ufshcd_mcq_get_tag(hba, hwq, cqe);
> + int tag = ufshcd_mcq_get_tag(hba, cqe);
>
> if (cqe->command_desc_base_addr) {
> ufshcd_compl_one_cqe(hba, tag, cqe);

Reviewed-by: Bart Van Assche <[email protected]>

2024-01-24 02:37:20

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH 0/2] ufs:mcq:Code cleanups


Chanwoo,

> This series has code some cleanups to the UFS mcq code. No functional
> change.

Applied to 6.9/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering