Skip to content

Commit f4750af

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Initialize hba->reserved_slot earlier
Move the hba->reserved_slot and the host->can_queue assignments from ufshcd_config_mcq() into ufshcd_alloc_mcq(). The advantages of this change are as follows: - It becomes easier to verify that these two parameters are updated if hba->nutrs is updated. - It prevents unnecessary assignments to these two parameters. While ufshcd_config_mcq() is called during host reset, ufshcd_alloc_mcq() is not. Cc: Can Guo <[email protected]> Reviewed-by: Peter Wang <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent b53eb9a commit f4750af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8678,6 +8678,9 @@ static int ufshcd_alloc_mcq(struct ufs_hba *hba)
86788678
if (ret)
86798679
goto err;
86808680

8681+
hba->host->can_queue = hba->nutrs - UFSHCD_NUM_RESERVED;
8682+
hba->reserved_slot = hba->nutrs - UFSHCD_NUM_RESERVED;
8683+
86818684
return 0;
86828685
err:
86838686
hba->nutrs = old_nutrs;
@@ -8699,9 +8702,6 @@ static void ufshcd_config_mcq(struct ufs_hba *hba)
86998702
ufshcd_mcq_make_queues_operational(hba);
87008703
ufshcd_mcq_config_mac(hba, hba->nutrs);
87018704

8702-
hba->host->can_queue = hba->nutrs - UFSHCD_NUM_RESERVED;
8703-
hba->reserved_slot = hba->nutrs - UFSHCD_NUM_RESERVED;
8704-
87058705
ufshcd_mcq_enable(hba);
87068706
hba->mcq_enabled = true;
87078707

0 commit comments

Comments
 (0)