Message ID | 20250502042432.88434-2-quic_ziqichen@quicinc.com |
---|---|
State | New |
Headers | show |
Series | Bug fixes for UFS multi-frequency scaling on Qcom platform | expand |
Hi Avri, On 5/2/2025 1:10 PM, Avri Altman wrote: >> The vop freq_to_gear() may return a gear greater than the negotiated max >> gear, return the negotiated max gear if the mapped gear is greater than it. >> >> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> >> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> >> --- >> drivers/ufs/host/ufs-qcom.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index >> 46cca52aa6f1..f5ea703d8ef5 100644 >> --- a/drivers/ufs/host/ufs-qcom.c >> +++ b/drivers/ufs/host/ufs-qcom.c >> @@ -1938,9 +1938,11 @@ static u32 ufs_qcom_freq_to_gear_speed(struct >> ufs_hba *hba, unsigned long freq) >> break; >> default: >> dev_err(hba->dev, "%s: Unsupported clock freq : %lu\n", >> __func__, freq); >> - break; >> + return gear; > Mayby return 0 so it is clear that you are not returning a gear > >> } >> >> + gear = min_t(u32, gear, hba->max_pwr_info.info.gear_rx); > return min_t(u32, gear, hba->max_pwr_info.info.gear_rx); > Thanks, the way you suggested is more concise. I will update and use this way. Ziqi > Thanks, > Avri >> + >> return gear; >> } >> >> -- >> 2.34.1 >> >
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 46cca52aa6f1..f5ea703d8ef5 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1938,9 +1938,11 @@ static u32 ufs_qcom_freq_to_gear_speed(struct ufs_hba *hba, unsigned long freq) break; default: dev_err(hba->dev, "%s: Unsupported clock freq : %lu\n", __func__, freq); - break; + return gear; } + gear = min_t(u32, gear, hba->max_pwr_info.info.gear_rx); + return gear; }