public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers()
@ 2025-02-19 17:16 Bao D. Nguyen
  2025-02-19 17:27 ` Manivannan Sadhasivam
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bao D. Nguyen @ 2025-02-19 17:16 UTC (permalink / raw)
  To: quic_cang, quic_nitirawa, bvanassche, avri.altman, peter.wang,
	manivannan.sadhasivam, minwoo.im, adrian.hunter, martin.petersen
  Cc: linux-scsi, Bao D. Nguyen, James E.J. Bottomley,
	open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER...,
	open list

Since 'commit 104cd58d9af8 ("scsi: ufs: qcom:
Remove support for host controllers older than v2.0")',
some of the parameters passed into the ufs_qcom_cfg_timers()
function have become dead code. Clean up ufs_qcom_cfg_timers()
function to improve the readability.

Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
---
 drivers/ufs/host/ufs-qcom.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 23b9f6e..d89faf6 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -509,16 +509,10 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba,
  * ufs_qcom_cfg_timers - Configure ufs qcom cfg timers
  *
  * @hba: host controller instance
- * @gear: Current operating gear
- * @hs: current power mode
- * @rate: current operating rate (A or B)
- * @update_link_startup_timer: indicate if link_start ongoing
  * @is_pre_scale_up: flag to check if pre scale up condition.
  * Return: zero for success and non-zero in case of a failure.
  */
-static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear,
-			       u32 hs, u32 rate, bool update_link_startup_timer,
-			       bool is_pre_scale_up)
+static int ufs_qcom_cfg_timers(struct ufs_hba *hba, bool is_pre_scale_up)
 {
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
 	struct ufs_clk_info *clki;
@@ -534,11 +528,6 @@ static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear,
 	if (host->hw_ver.major < 4 && !ufshcd_is_intr_aggr_allowed(hba))
 		return 0;
 
-	if (gear == 0) {
-		dev_err(hba->dev, "%s: invalid gear = %d\n", __func__, gear);
-		return -EINVAL;
-	}
-
 	list_for_each_entry(clki, &hba->clk_list_head, list) {
 		if (!strcmp(clki->name, "core_clk")) {
 			if (is_pre_scale_up)
@@ -574,8 +563,7 @@ static int ufs_qcom_link_startup_notify(struct ufs_hba *hba,
 
 	switch (status) {
 	case PRE_CHANGE:
-		if (ufs_qcom_cfg_timers(hba, UFS_PWM_G1, SLOWAUTO_MODE,
-					0, true, false)) {
+		if (ufs_qcom_cfg_timers(hba, false)) {
 			dev_err(hba->dev, "%s: ufs_qcom_cfg_timers() failed\n",
 				__func__);
 			return -EINVAL;
@@ -831,9 +819,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
 		}
 		break;
 	case POST_CHANGE:
-		if (ufs_qcom_cfg_timers(hba, dev_req_params->gear_rx,
-					dev_req_params->pwr_rx,
-					dev_req_params->hs_rate, false, false)) {
+		if (ufs_qcom_cfg_timers(hba, false)) {
 			dev_err(hba->dev, "%s: ufs_qcom_cfg_timers() failed\n",
 				__func__);
 			/*
@@ -1348,12 +1334,9 @@ static int ufs_qcom_set_core_clk_ctrl(struct ufs_hba *hba, bool is_scale_up)
 
 static int ufs_qcom_clk_scale_up_pre_change(struct ufs_hba *hba)
 {
-	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-	struct ufs_pa_layer_attr *attr = &host->dev_req_params;
 	int ret;
 
-	ret = ufs_qcom_cfg_timers(hba, attr->gear_rx, attr->pwr_rx,
-				  attr->hs_rate, false, true);
+	ret = ufs_qcom_cfg_timers(hba, true);
 	if (ret) {
 		dev_err(hba->dev, "%s ufs cfg timer failed\n", __func__);
 		return ret;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers()
  2025-02-19 17:16 [PATCH 1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers() Bao D. Nguyen
@ 2025-02-19 17:27 ` Manivannan Sadhasivam
  2025-02-21  2:24 ` Martin K. Petersen
  2025-02-25  0:32 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2025-02-19 17:27 UTC (permalink / raw)
  To: Bao D. Nguyen
  Cc: quic_cang, quic_nitirawa, bvanassche, avri.altman, peter.wang,
	minwoo.im, adrian.hunter, martin.petersen, linux-scsi,
	James E.J. Bottomley,
	open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER...,
	open list

On Wed, Feb 19, 2025 at 09:16:06AM -0800, Bao D. Nguyen wrote:
> Since 'commit 104cd58d9af8 ("scsi: ufs: qcom:
> Remove support for host controllers older than v2.0")',
> some of the parameters passed into the ufs_qcom_cfg_timers()
> function have become dead code. Clean up ufs_qcom_cfg_timers()
> function to improve the readability.
> 
> Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
>  drivers/ufs/host/ufs-qcom.c | 25 ++++---------------------
>  1 file changed, 4 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 23b9f6e..d89faf6 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -509,16 +509,10 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba,
>   * ufs_qcom_cfg_timers - Configure ufs qcom cfg timers
>   *
>   * @hba: host controller instance
> - * @gear: Current operating gear
> - * @hs: current power mode
> - * @rate: current operating rate (A or B)
> - * @update_link_startup_timer: indicate if link_start ongoing
>   * @is_pre_scale_up: flag to check if pre scale up condition.
>   * Return: zero for success and non-zero in case of a failure.
>   */
> -static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear,
> -			       u32 hs, u32 rate, bool update_link_startup_timer,
> -			       bool is_pre_scale_up)
> +static int ufs_qcom_cfg_timers(struct ufs_hba *hba, bool is_pre_scale_up)
>  {
>  	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>  	struct ufs_clk_info *clki;
> @@ -534,11 +528,6 @@ static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear,
>  	if (host->hw_ver.major < 4 && !ufshcd_is_intr_aggr_allowed(hba))
>  		return 0;
>  
> -	if (gear == 0) {
> -		dev_err(hba->dev, "%s: invalid gear = %d\n", __func__, gear);
> -		return -EINVAL;
> -	}
> -
>  	list_for_each_entry(clki, &hba->clk_list_head, list) {
>  		if (!strcmp(clki->name, "core_clk")) {
>  			if (is_pre_scale_up)
> @@ -574,8 +563,7 @@ static int ufs_qcom_link_startup_notify(struct ufs_hba *hba,
>  
>  	switch (status) {
>  	case PRE_CHANGE:
> -		if (ufs_qcom_cfg_timers(hba, UFS_PWM_G1, SLOWAUTO_MODE,
> -					0, true, false)) {
> +		if (ufs_qcom_cfg_timers(hba, false)) {
>  			dev_err(hba->dev, "%s: ufs_qcom_cfg_timers() failed\n",
>  				__func__);
>  			return -EINVAL;
> @@ -831,9 +819,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
>  		}
>  		break;
>  	case POST_CHANGE:
> -		if (ufs_qcom_cfg_timers(hba, dev_req_params->gear_rx,
> -					dev_req_params->pwr_rx,
> -					dev_req_params->hs_rate, false, false)) {
> +		if (ufs_qcom_cfg_timers(hba, false)) {
>  			dev_err(hba->dev, "%s: ufs_qcom_cfg_timers() failed\n",
>  				__func__);
>  			/*
> @@ -1348,12 +1334,9 @@ static int ufs_qcom_set_core_clk_ctrl(struct ufs_hba *hba, bool is_scale_up)
>  
>  static int ufs_qcom_clk_scale_up_pre_change(struct ufs_hba *hba)
>  {
> -	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
> -	struct ufs_pa_layer_attr *attr = &host->dev_req_params;
>  	int ret;
>  
> -	ret = ufs_qcom_cfg_timers(hba, attr->gear_rx, attr->pwr_rx,
> -				  attr->hs_rate, false, true);
> +	ret = ufs_qcom_cfg_timers(hba, true);
>  	if (ret) {
>  		dev_err(hba->dev, "%s ufs cfg timer failed\n", __func__);
>  		return ret;
> -- 
> 2.7.4
> 

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers()
  2025-02-19 17:16 [PATCH 1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers() Bao D. Nguyen
  2025-02-19 17:27 ` Manivannan Sadhasivam
@ 2025-02-21  2:24 ` Martin K. Petersen
  2025-02-25  0:32 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-02-21  2:24 UTC (permalink / raw)
  To: Bao D. Nguyen
  Cc: quic_cang, quic_nitirawa, bvanassche, avri.altman, peter.wang,
	manivannan.sadhasivam, minwoo.im, adrian.hunter, martin.petersen,
	linux-scsi, James E.J. Bottomley,
	open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER...,
	open list


Bao,

> Since 'commit 104cd58d9af8 ("scsi: ufs: qcom: Remove support for host
> controllers older than v2.0")', some of the parameters passed into the
> ufs_qcom_cfg_timers() function have become dead code. Clean up
> ufs_qcom_cfg_timers() function to improve the readability.

Applied to 6.15/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers()
  2025-02-19 17:16 [PATCH 1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers() Bao D. Nguyen
  2025-02-19 17:27 ` Manivannan Sadhasivam
  2025-02-21  2:24 ` Martin K. Petersen
@ 2025-02-25  0:32 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-02-25  0:32 UTC (permalink / raw)
  To: quic_cang, quic_nitirawa, bvanassche, avri.altman, peter.wang,
	manivannan.sadhasivam, minwoo.im, adrian.hunter, Bao D. Nguyen
  Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley,
	open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER...,
	open list

On Wed, 19 Feb 2025 09:16:06 -0800, Bao D. Nguyen wrote:

> Since 'commit 104cd58d9af8 ("scsi: ufs: qcom:
> Remove support for host controllers older than v2.0")',
> some of the parameters passed into the ufs_qcom_cfg_timers()
> function have become dead code. Clean up ufs_qcom_cfg_timers()
> function to improve the readability.
> 
> 
> [...]

Applied to 6.15/scsi-queue, thanks!

[1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers()
      https://git.kernel.org/mkp/scsi/c/476cda194903

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-25  0:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 17:16 [PATCH 1/1] scsi: ufs: qcom: Remove dead code in ufs_qcom_cfg_timers() Bao D. Nguyen
2025-02-19 17:27 ` Manivannan Sadhasivam
2025-02-21  2:24 ` Martin K. Petersen
2025-02-25  0:32 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox