diff mbox series

[v2,1/1] scsi: ufs: core: Rename ufshcd_wb_presrv_usrspc_keep_vcc_on()

Message ID 02ae5e133f6ebf23b54d943e6d1d9de2544eb80e.1743192926.git.quic_nguyenb@quicinc.com (mailing list archive)
State New
Headers show
Series [v2,1/1] scsi: ufs: core: Rename ufshcd_wb_presrv_usrspc_keep_vcc_on() | expand

Commit Message

Bao D. Nguyen March 28, 2025, 8:17 p.m. UTC
The ufshcd_wb_presrv_usrspc_keep_vcc_on() function has deviated
from its original implementation. The "_keep_vcc_on" part of the
function name is misleading. Rename the function to
ufshcd_wb_curr_buff_threshold_check() to improve the
readability. Also, updated the comments in the function.
There is no change to the functionality.

Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
---
Changes in v2:
Reverted to original implementation. Only changed the function
name. Updated the commit message (Avri's and Bart's comments).
---
 drivers/ufs/core/ufshcd.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Avri Altman March 29, 2025, 9:45 a.m. UTC | #1
> The ufshcd_wb_presrv_usrspc_keep_vcc_on() function has deviated from its
> original implementation. The "_keep_vcc_on" part of the function name is
> misleading. Rename the function to
> ufshcd_wb_curr_buff_threshold_check() to improve the readability. Also,
> updated the comments in the function.
> There is no change to the functionality.
> 
> Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Reviewed-by: Avri Altman <avri.altman@sandisk.com>

> ---
> Changes in v2:
> Reverted to original implementation. Only changed the function name.
> Updated the commit message (Avri's and Bart's comments).
> ---
>  drivers/ufs/core/ufshcd.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index
> 4e1e214..310707f 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -6083,7 +6083,7 @@ int ufshcd_wb_toggle_buf_flush(struct ufs_hba
> *hba, bool enable)
>  	return ret;
>  }
> 
> -static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba,
> +static bool ufshcd_wb_curr_buff_threshold_check(struct ufs_hba *hba,
>  						u32 avail_buf)
>  {
>  	u32 cur_buf;
> @@ -6165,15 +6165,13 @@ static bool ufshcd_wb_need_flush(struct
> ufs_hba *hba)
>  	}
> 
>  	/*
> -	 * The ufs device needs the vcc to be ON to flush.
>  	 * With user-space reduction enabled, it's enough to enable flush
>  	 * by checking only the available buffer. The threshold
>  	 * defined here is > 90% full.
>  	 * With user-space preserved enabled, the current-buffer
>  	 * should be checked too because the wb buffer size can reduce
>  	 * when disk tends to be full. This info is provided by current
> -	 * buffer (dCurrentWriteBoosterBufferSize). There's no point in
> -	 * keeping vcc on when current buffer is empty.
> +	 * buffer (dCurrentWriteBoosterBufferSize).
>  	 */
>  	index = ufshcd_wb_get_query_index(hba);
>  	ret = ufshcd_query_attr_retry(hba,
> UPIU_QUERY_OPCODE_READ_ATTR, @@ -6188,7 +6186,7 @@ static bool
> ufshcd_wb_need_flush(struct ufs_hba *hba)
>  	if (!hba->dev_info.b_presrv_uspc_en)
>  		return avail_buf <= UFS_WB_BUF_REMAIN_PERCENT(10);
> 
> -	return ufshcd_wb_presrv_usrspc_keep_vcc_on(hba, avail_buf);
> +	return ufshcd_wb_curr_buff_threshold_check(hba, avail_buf);
>  }
> 
>  static void ufshcd_rpm_dev_flush_recheck_work(struct work_struct *work)
> --
> 2.7.4
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 4e1e214..310707f 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -6083,7 +6083,7 @@  int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable)
 	return ret;
 }
 
-static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba,
+static bool ufshcd_wb_curr_buff_threshold_check(struct ufs_hba *hba,
 						u32 avail_buf)
 {
 	u32 cur_buf;
@@ -6165,15 +6165,13 @@  static bool ufshcd_wb_need_flush(struct ufs_hba *hba)
 	}
 
 	/*
-	 * The ufs device needs the vcc to be ON to flush.
 	 * With user-space reduction enabled, it's enough to enable flush
 	 * by checking only the available buffer. The threshold
 	 * defined here is > 90% full.
 	 * With user-space preserved enabled, the current-buffer
 	 * should be checked too because the wb buffer size can reduce
 	 * when disk tends to be full. This info is provided by current
-	 * buffer (dCurrentWriteBoosterBufferSize). There's no point in
-	 * keeping vcc on when current buffer is empty.
+	 * buffer (dCurrentWriteBoosterBufferSize).
 	 */
 	index = ufshcd_wb_get_query_index(hba);
 	ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR,
@@ -6188,7 +6186,7 @@  static bool ufshcd_wb_need_flush(struct ufs_hba *hba)
 	if (!hba->dev_info.b_presrv_uspc_en)
 		return avail_buf <= UFS_WB_BUF_REMAIN_PERCENT(10);
 
-	return ufshcd_wb_presrv_usrspc_keep_vcc_on(hba, avail_buf);
+	return ufshcd_wb_curr_buff_threshold_check(hba, avail_buf);
 }
 
 static void ufshcd_rpm_dev_flush_recheck_work(struct work_struct *work)