diff mbox series

[v1,2/2] scsi: ufs: Clean up some lines from ufshcd_hba_exit()

Message ID 1607497100-27570-3-git-send-email-cang@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series Two changes related with UFS clock scaling | expand

Commit Message

Can Guo Dec. 9, 2020, 6:58 a.m. UTC
ufshcd_hba_exit() is always called after ufshcd_exit_clk_scaling() and
ufshcd_exit_clk_gating(), so no need to suspend clock scaling again in
ufshcd_hba_exit().

Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Stanley Chu Dec. 9, 2020, 8:22 a.m. UTC | #1
Hi Can,

On Tue, 2020-12-08 at 22:58 -0800, Can Guo wrote:
> ufshcd_hba_exit() is always called after ufshcd_exit_clk_scaling() and
> ufshcd_exit_clk_gating(), so no need to suspend clock scaling again in
> ufshcd_hba_exit().
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>
> ---
>  drivers/scsi/ufs/ufshcd.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 12266bd..0a5b197 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -7765,6 +7765,7 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
>  	if (ret) {
>  		pm_runtime_put_sync(hba->dev);
>  		ufshcd_exit_clk_scaling(hba);
> +		ufshcd_exit_clk_gating(hba);

How about moving above two lines to ufshcd_hba_exit()?

Otherwise looks good to me!
Reviewed-by: Stanley Chu <stanleyc.chu@mediatek.com>

>  		ufshcd_hba_exit(hba);
>  	}
>  }
> @@ -8203,10 +8204,6 @@ static void ufshcd_hba_exit(struct ufs_hba *hba)
>  	if (hba->is_powered) {
>  		ufshcd_variant_hba_exit(hba);
>  		ufshcd_setup_vreg(hba, false);
> -		ufshcd_suspend_clkscaling(hba);
> -		if (ufshcd_is_clkscaling_supported(hba))
> -			if (hba->devfreq)
> -				ufshcd_suspend_clkscaling(hba);
>  		ufshcd_setup_clocks(hba, false);
>  		ufshcd_setup_hba_vreg(hba, false);
>  		hba->is_powered = false;
Can Guo Dec. 9, 2020, 8:29 a.m. UTC | #2
On 2020-12-09 16:22, Stanley Chu wrote:
> Hi Can,
> 
> On Tue, 2020-12-08 at 22:58 -0800, Can Guo wrote:
>> ufshcd_hba_exit() is always called after ufshcd_exit_clk_scaling() and
>> ufshcd_exit_clk_gating(), so no need to suspend clock scaling again in
>> ufshcd_hba_exit().
>> 
>> Signed-off-by: Can Guo <cang@codeaurora.org>
>> ---
>>  drivers/scsi/ufs/ufshcd.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>> 
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index 12266bd..0a5b197 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -7765,6 +7765,7 @@ static void ufshcd_async_scan(void *data, 
>> async_cookie_t cookie)
>>  	if (ret) {
>>  		pm_runtime_put_sync(hba->dev);
>>  		ufshcd_exit_clk_scaling(hba);
>> +		ufshcd_exit_clk_gating(hba);
> 
> How about moving above two lines to ufshcd_hba_exit()?
> 
> Otherwise looks good to me!
> Reviewed-by: Stanley Chu <stanleyc.chu@mediatek.com>

You read my mind - I thought about that too, but in ufshcd_init(),
they are separately called on different error out paths.

11232 exit_gating:
11233 	ufshcd_exit_clk_scaling(hba);
11234 	ufshcd_exit_clk_gating(hba);
11235 out_disable:
11236 	hba->is_irq_enabled = false;
11237 	ufshcd_hba_exit(hba);

Thanks,

Can Guo.

> 
>>  		ufshcd_hba_exit(hba);
>>  	}
>>  }
>> @@ -8203,10 +8204,6 @@ static void ufshcd_hba_exit(struct ufs_hba 
>> *hba)
>>  	if (hba->is_powered) {
>>  		ufshcd_variant_hba_exit(hba);
>>  		ufshcd_setup_vreg(hba, false);
>> -		ufshcd_suspend_clkscaling(hba);
>> -		if (ufshcd_is_clkscaling_supported(hba))
>> -			if (hba->devfreq)
>> -				ufshcd_suspend_clkscaling(hba);
>>  		ufshcd_setup_clocks(hba, false);
>>  		ufshcd_setup_hba_vreg(hba, false);
>>  		hba->is_powered = false;
Bean Huo Dec. 9, 2020, 10:17 p.m. UTC | #3
On Tue, 2020-12-08 at 22:58 -0800, Can Guo wrote:
> ufshcd_hba_exit() is always called after ufshcd_exit_clk_scaling()
> and
> ufshcd_exit_clk_gating(), so no need to suspend clock scaling again
> in
> ufshcd_hba_exit().
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Can Guo Dec. 10, 2020, 12:49 a.m. UTC | #4
On 2020-12-10 06:17, Bean Huo wrote:
> On Tue, 2020-12-08 at 22:58 -0800, Can Guo wrote:
>> ufshcd_hba_exit() is always called after ufshcd_exit_clk_scaling()
>> and
>> ufshcd_exit_clk_gating(), so no need to suspend clock scaling again
>> in
>> ufshcd_hba_exit().
>> 
>> Signed-off-by: Can Guo <cang@codeaurora.org>
> Reviewed-by: Bean Huo <beanhuo@micron.com>

Hi Bean,

Thanks for you review. But I sent V2 yesterday,
in which this patch is slightly updated.

Thanks,

Can Guo.
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 12266bd..0a5b197 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -7765,6 +7765,7 @@  static void ufshcd_async_scan(void *data, async_cookie_t cookie)
 	if (ret) {
 		pm_runtime_put_sync(hba->dev);
 		ufshcd_exit_clk_scaling(hba);
+		ufshcd_exit_clk_gating(hba);
 		ufshcd_hba_exit(hba);
 	}
 }
@@ -8203,10 +8204,6 @@  static void ufshcd_hba_exit(struct ufs_hba *hba)
 	if (hba->is_powered) {
 		ufshcd_variant_hba_exit(hba);
 		ufshcd_setup_vreg(hba, false);
-		ufshcd_suspend_clkscaling(hba);
-		if (ufshcd_is_clkscaling_supported(hba))
-			if (hba->devfreq)
-				ufshcd_suspend_clkscaling(hba);
 		ufshcd_setup_clocks(hba, false);
 		ufshcd_setup_hba_vreg(hba, false);
 		hba->is_powered = false;