Message ID | 20250507074415.2451940-2-quic_ziqichen@quicinc.com |
---|---|
State | New |
Headers | show |
Series | Bug fixes for UFS multi-frequency scaling on Qcom platform | expand |
On Wed, 2025-05-07 at 15:44 +0800, Ziqi Chen 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> Reviewed-by: Bean Huo <beanhuo@micron.com>
On 5/7/25 9:44 AM, Ziqi Chen 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> > > --- > v1 - > v2: > 1. Instead of return 'gear', return '0' directly if didn't find mapped > gear > 2. Derectly return min_t(gear,max_gear) instead assign to 'gear' then > return it. > --- > drivers/ufs/host/ufs-qcom.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index 790da25cbaf3..7f10926100a5 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -2105,10 +2105,10 @@ 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 0; That's UFS_PWM_DONT_CHANGE, please it so that the reader can more easily make sense of the code.. Actually, perhaps this function could be tagged to return an entry of this enum specifically Konrad > } > > - return gear; > + return min_t(u32, gear, hba->max_pwr_info.info.gear_rx); > } > > /*
On 5/8/2025 11:30 PM, Konrad Dybcio wrote: > That's UFS_PWM_DONT_CHANGE, please it so that the reader can more easily > make sense of the code.. Actually, perhaps this function could be tagged > to return an entry of this enum specifically Sure , Thanks Konrad . BRs, Ziqi
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 790da25cbaf3..7f10926100a5 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -2105,10 +2105,10 @@ 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 0; } - return gear; + return min_t(u32, gear, hba->max_pwr_info.info.gear_rx); } /*