diff mbox series

[v1,1/1] ufs: mcq: fix incorrectly set queue depth

Message ID da085383bec5c08bf34220ec6cc577f7a1b49ba8.1676396928.git.quic_asutoshd@quicinc.com
State New
Headers show
Series [v1,1/1] ufs: mcq: fix incorrectly set queue depth | expand

Commit Message

Asutosh Das Feb. 14, 2023, 5:50 p.m. UTC
ufshcd_config_mcq() may change the can_queue value.
The current code invokes scsi_add_host() before ufshcd_config_mcq().
So the tags are limited to the old can_queue value.

Fix this by invoking scsi_add_host() after ufshcd_config_mcq().

Signed-off-by: Asutosh Das <quic_asutoshd@quicinc.com>
---
 drivers/ufs/core/ufshcd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 3b3cf78..04e42b2 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8535,6 +8535,8 @@  static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
 				use_mcq_mode = false;
 				dev_err(hba->dev, "MCQ mode is disabled, err=%d\n",
 					 ret);
+			} else {
+				ufshcd_config_mcq(hba);
 			}
 			ret = scsi_add_host(host, hba->dev);
 			if (ret) {
@@ -8542,10 +8544,10 @@  static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
 				return ret;
 			}
 			hba->scsi_host_added = true;
-		}
-		/* MCQ may be disabled if ufshcd_alloc_mcq() fails */
-		if (is_mcq_supported(hba) && use_mcq_mode)
+		} else if (is_mcq_supported(hba)) {
+			/* UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH is set */
 			ufshcd_config_mcq(hba);
+		}
 	}
 
 	ufshcd_tune_unipro_params(hba);