diff mbox series

[v2,2/4] scsi: ufs: Remove redundant null checking of devfreq instance

Message ID 20201216131639.4128-3-stanley.chu@mediatek.com
State New
Headers show
Series None | expand

Commit Message

Stanley Chu Dec. 16, 2020, 1:16 p.m. UTC
hba->devfreq is zero-initialized thus it is not required
to check its existence in ufshcd_add_lus() function which
is invoked during initialization only.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Comments

Can Guo Dec. 18, 2020, 5:58 a.m. UTC | #1
On 2020-12-16 21:16, Stanley Chu wrote:
> hba->devfreq is zero-initialized thus it is not required

> to check its existence in ufshcd_add_lus() function which

> is invoked during initialization only.

> 

> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>

> ---

>  drivers/scsi/ufs/ufshcd.c | 14 ++++++--------

>  1 file changed, 6 insertions(+), 8 deletions(-)

> 

> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c

> index a91b73a1fc48..9cc16598136d 100644

> --- a/drivers/scsi/ufs/ufshcd.c

> +++ b/drivers/scsi/ufs/ufshcd.c

> @@ -7636,15 +7636,13 @@ static int ufshcd_add_lus(struct ufs_hba *hba)

>  			&hba->pwr_info,

>  			sizeof(struct ufs_pa_layer_attr));

>  		hba->clk_scaling.saved_pwr_info.is_valid = true;

> -		if (!hba->devfreq) {


Just FYI, checking this was due to consideration for supporting UFS 
cards
which can do hot-plug. But UFS cards seems out of the picture for a long 
time.
Anyways, if someday UFS cards come back in future, let's add these 
checks back again.

Thanks,

Can Guo.

> -			hba->clk_scaling.is_allowed = true;

> -			ret = ufshcd_devfreq_init(hba);

> -			if (ret)

> -				goto out;

> +		hba->clk_scaling.is_allowed = true;

> +		ret = ufshcd_devfreq_init(hba);

> +		if (ret)

> +			goto out;

> 

> -			hba->clk_scaling.is_enabled = true;

> -			ufshcd_clkscaling_init_sysfs(hba);

> -		}

> +		hba->clk_scaling.is_enabled = true;

> +		ufshcd_clkscaling_init_sysfs(hba);

>  	}

> 

>  	ufs_bsg_probe(hba);
Can Guo Dec. 18, 2020, 6:09 a.m. UTC | #2
On 2020-12-16 21:16, Stanley Chu wrote:
> hba->devfreq is zero-initialized thus it is not required

> to check its existence in ufshcd_add_lus() function which

> is invoked during initialization only.

> 

> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>

> ---

>  drivers/scsi/ufs/ufshcd.c | 14 ++++++--------

>  1 file changed, 6 insertions(+), 8 deletions(-)

> 

> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c

> index a91b73a1fc48..9cc16598136d 100644

> --- a/drivers/scsi/ufs/ufshcd.c

> +++ b/drivers/scsi/ufs/ufshcd.c

> @@ -7636,15 +7636,13 @@ static int ufshcd_add_lus(struct ufs_hba *hba)

>  			&hba->pwr_info,

>  			sizeof(struct ufs_pa_layer_attr));

>  		hba->clk_scaling.saved_pwr_info.is_valid = true;

> -		if (!hba->devfreq) {

> -			hba->clk_scaling.is_allowed = true;

> -			ret = ufshcd_devfreq_init(hba);

> -			if (ret)

> -				goto out;

> +		hba->clk_scaling.is_allowed = true;

> +		ret = ufshcd_devfreq_init(hba);

> +		if (ret)

> +			goto out;

> 

> -			hba->clk_scaling.is_enabled = true;

> -			ufshcd_clkscaling_init_sysfs(hba);

> -		}

> +		hba->clk_scaling.is_enabled = true;

> +		ufshcd_clkscaling_init_sysfs(hba);

>  	}

> 

>  	ufs_bsg_probe(hba);


Reviewed-by: Can Guo <cang@codeaurora.org>
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index a91b73a1fc48..9cc16598136d 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7636,15 +7636,13 @@  static int ufshcd_add_lus(struct ufs_hba *hba)
 			&hba->pwr_info,
 			sizeof(struct ufs_pa_layer_attr));
 		hba->clk_scaling.saved_pwr_info.is_valid = true;
-		if (!hba->devfreq) {
-			hba->clk_scaling.is_allowed = true;
-			ret = ufshcd_devfreq_init(hba);
-			if (ret)
-				goto out;
+		hba->clk_scaling.is_allowed = true;
+		ret = ufshcd_devfreq_init(hba);
+		if (ret)
+			goto out;
 
-			hba->clk_scaling.is_enabled = true;
-			ufshcd_clkscaling_init_sysfs(hba);
-		}
+		hba->clk_scaling.is_enabled = true;
+		ufshcd_clkscaling_init_sysfs(hba);
 	}
 
 	ufs_bsg_probe(hba);