[PATCH V5 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate

Ram Kumar Dwivedi posted 4 patches 1 month ago
There is a newer version of this series
[PATCH V5 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate
Posted by Ram Kumar Dwivedi 1 month ago
Remove the redundant else block that assigns PA_HS_MODE_B to hs_rate,
as it is already assigned in ufshcd_init_host_params(). This avoids
unnecessary reassignment and prevents overwriting hs_rate when it is
explicitly set to a different value.

Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
---
 drivers/ufs/host/ufs-qcom.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 9574fdc2bb0f..1a93351fb70e 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -494,12 +494,8 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
 	 * If the HS-G5 PHY gear is used, update host_params->hs_rate to Rate-A,
 	 * so that the subsequent power mode change shall stick to Rate-A.
 	 */
-	if (host->hw_ver.major == 0x5) {
-		if (host->phy_gear == UFS_HS_G5)
-			host_params->hs_rate = PA_HS_MODE_A;
-		else
-			host_params->hs_rate = PA_HS_MODE_B;
-	}
+	if (host->hw_ver.major == 0x5 && host->phy_gear == UFS_HS_G5)
+		host_params->hs_rate = PA_HS_MODE_A;
 
 	mode = host_params->hs_rate == PA_HS_MODE_B ? PHY_MODE_UFS_HS_B : PHY_MODE_UFS_HS_A;
 
-- 
2.50.1
RE: [PATCH V5 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate
Posted by Alim Akhtar 1 month ago

> -----Original Message-----
> From: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
> Sent: Tuesday, September 2, 2025 10:19 PM
> To: alim.akhtar@samsung.com; avri.altman@wdc.com;
> bvanassche@acm.org; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; mani@kernel.org;
> James.Bottomley@HansenPartnership.com; martin.petersen@oracle.com
> Cc: linux-scsi@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-arm-msm@vger.kernel.org
> Subject: [PATCH V5 2/4] ufs: ufs-qcom: Remove redundant re-assignment to
> hs_rate
> 
> Remove the redundant else block that assigns PA_HS_MODE_B to hs_rate,
> as it is already assigned in ufshcd_init_host_params(). This avoids
> unnecessary reassignment and prevents overwriting hs_rate when it is
> explicitly set to a different value.
> 
> Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
> ---
Better to send non-dependent patches separately.

Feel free to add:
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>  

>  drivers/ufs/host/ufs-qcom.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index
> 9574fdc2bb0f..1a93351fb70e 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -494,12 +494,8 @@ static int ufs_qcom_power_up_sequence(struct
> ufs_hba *hba)
>  	 * If the HS-G5 PHY gear is used, update host_params->hs_rate to
> Rate-A,
>  	 * so that the subsequent power mode change shall stick to Rate-A.
>  	 */
> -	if (host->hw_ver.major == 0x5) {
> -		if (host->phy_gear == UFS_HS_G5)
> -			host_params->hs_rate = PA_HS_MODE_A;
> -		else
> -			host_params->hs_rate = PA_HS_MODE_B;
> -	}
> +	if (host->hw_ver.major == 0x5 && host->phy_gear == UFS_HS_G5)
> +		host_params->hs_rate = PA_HS_MODE_A;
> 
>  	mode = host_params->hs_rate == PA_HS_MODE_B ?
> PHY_MODE_UFS_HS_B : PHY_MODE_UFS_HS_A;
> 
> --
> 2.50.1
Re: [PATCH V5 2/4] ufs: ufs-qcom: Remove redundant re-assignment to hs_rate
Posted by Ram Kumar Dwivedi 2 weeks, 1 day ago

On 03-Sep-25 10:23 AM, Alim Akhtar wrote:
> 
> 
>> -----Original Message-----
>> From: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
>> Sent: Tuesday, September 2, 2025 10:19 PM
>> To: alim.akhtar@samsung.com; avri.altman@wdc.com;
>> bvanassche@acm.org; robh@kernel.org; krzk+dt@kernel.org;
>> conor+dt@kernel.org; mani@kernel.org;
>> James.Bottomley@HansenPartnership.com; martin.petersen@oracle.com
>> Cc: linux-scsi@vger.kernel.org; devicetree@vger.kernel.org; linux-
>> kernel@vger.kernel.org; linux-arm-msm@vger.kernel.org
>> Subject: [PATCH V5 2/4] ufs: ufs-qcom: Remove redundant re-assignment to
>> hs_rate
>>
>> Remove the redundant else block that assigns PA_HS_MODE_B to hs_rate,
>> as it is already assigned in ufshcd_init_host_params(). This avoids
>> unnecessary reassignment and prevents overwriting hs_rate when it is
>> explicitly set to a different value.
>>
>> Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
>> ---
> Better to send non-dependent patches separately.

Hi Alim,

Thanks for the suggestion. This patch is essential for our
ufs-qcom changes to function correctly. Without it,
the rate limit would be overwritten.

Thanks,
Ram.> 
> Feel free to add:
> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>  
> 
>>  drivers/ufs/host/ufs-qcom.c | 8 ++------
>>  1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index
>> 9574fdc2bb0f..1a93351fb70e 100644
>> --- a/drivers/ufs/host/ufs-qcom.c
>> +++ b/drivers/ufs/host/ufs-qcom.c
>> @@ -494,12 +494,8 @@ static int ufs_qcom_power_up_sequence(struct
>> ufs_hba *hba)
>>  	 * If the HS-G5 PHY gear is used, update host_params->hs_rate to
>> Rate-A,
>>  	 * so that the subsequent power mode change shall stick to Rate-A.
>>  	 */
>> -	if (host->hw_ver.major == 0x5) {
>> -		if (host->phy_gear == UFS_HS_G5)
>> -			host_params->hs_rate = PA_HS_MODE_A;
>> -		else
>> -			host_params->hs_rate = PA_HS_MODE_B;
>> -	}
>> +	if (host->hw_ver.major == 0x5 && host->phy_gear == UFS_HS_G5)
>> +		host_params->hs_rate = PA_HS_MODE_A;
>>
>>  	mode = host_params->hs_rate == PA_HS_MODE_B ?
>> PHY_MODE_UFS_HS_B : PHY_MODE_UFS_HS_A;
>>
>> --
>> 2.50.1
> 
>