Message ID | 20250403211937.2225615-18-bvanassche@acm.org |
---|---|
State | New |
Headers | show |
Series | Optimize the hot path in the UFS driver | expand |
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index acbf173a3732..6dcac4143f4f 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8733,9 +8733,16 @@ static int ufshcd_alloc_mcq(struct ufs_hba *hba, u32 ufs_dev_qd) return ret; hba->nutrs = ret; - ret = ufshcd_mcq_init(hba); - if (ret) - goto err; + if (hba->host->nr_hw_queues == 0) { + /* + * ufshcd_mcq_init() is independent of hba->nutrs. Hence, only + * call ufshcd_mcq_init() the first time ufshcd_alloc_mcq() is + * called. + */ + ret = ufshcd_mcq_init(hba); + if (ret) + goto err; + } /* * Previously allocated memory for nutrs may not be enough in MCQ mode.
Make sure that ufshcd_mcq_init() is called once even if ufshcd_alloc_mcq() is called twice. Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/ufs/core/ufshcd.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)