* [PATCH v1 1/1] ufs: mcq: fix incorrectly set queue depth
@ 2023-02-14 17:50 Asutosh Das
2023-02-15 18:42 ` Bart Van Assche
0 siblings, 1 reply; 2+ messages in thread
From: Asutosh Das @ 2023-02-14 17:50 UTC (permalink / raw)
To: quic_cang, martin.petersen, linux-scsi
Cc: quic_nguyenb, quic_xiaosenh, stanley.chu, adrian.hunter,
bvanassche, avri.altman, mani, beanhuo, Asutosh Das,
linux-arm-msm, Alim Akhtar, James E.J. Bottomley, Jinyoung Choi,
open list
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 --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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] ufs: mcq: fix incorrectly set queue depth
2023-02-14 17:50 [PATCH v1 1/1] ufs: mcq: fix incorrectly set queue depth Asutosh Das
@ 2023-02-15 18:42 ` Bart Van Assche
0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2023-02-15 18:42 UTC (permalink / raw)
To: Asutosh Das, quic_cang, martin.petersen, linux-scsi
Cc: quic_nguyenb, quic_xiaosenh, stanley.chu, adrian.hunter,
avri.altman, mani, beanhuo, linux-arm-msm, Alim Akhtar,
James E.J. Bottomley, Jinyoung Choi, open list
On 2/14/23 09:50, Asutosh Das wrote:
> 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().
Please add a Fixes: tag.
> 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);
> }
Please rework this code such that the success case (ret == 0) is handled
first. That is the approach followed elsewhere in the Linux kernel.
Otherwise this patch looks good to me.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-15 18:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-14 17:50 [PATCH v1 1/1] ufs: mcq: fix incorrectly set queue depth Asutosh Das
2023-02-15 18:42 ` Bart Van Assche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox