lkml.org 
[lkml]   [2022]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4 2/4] ufs: core: Remove redundant desc_size variable from hba
From
On 11/27/22 04:08, Arthur Simchaev wrote:
> Always read the descriptor with QUERY_DESC_MAX_SIZE.
> According to the spec, the device returns the actual size
>
> Reviewed-by: Bean Huo <beanhuo@micron.com>
> Signed-off-by: Arthur Simchaev <Arthur.Simchaev@wdc.com>
> ---
> drivers/ufs/core/ufshcd.c | 53 +++++++++++++----------------------------------
> include/ufs/ufs.h | 1 -
> include/ufs/ufshcd.h | 1 -
> 3 files changed, 14 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 2e47c69..70e96b6 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -3377,28 +3377,11 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
> void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
> int *desc_len)
> {
> - if (desc_id >= QUERY_DESC_IDN_MAX || desc_id == QUERY_DESC_IDN_RFU_0 ||
> - desc_id == QUERY_DESC_IDN_RFU_1)
> - *desc_len = 0;
> - else
> - *desc_len = hba->desc_size[desc_id];
> + /*Always returns QUERY_DESC_MAX_SIZE*/
> + *desc_len = QUERY_DESC_MAX_SIZE;
> }
> EXPORT_SYMBOL(ufshcd_map_desc_id_to_length);

Comments should explain something that is nontrivial instead of duplicating the
code. Additionally, this change makes ufshcd_map_desc_id_to_length() too short
too keep it as a function. Please remove this function entirely and insert the
following code into the callers of this function:

desc_len = QUERY_DESC_MAX_SIZE

Thanks,

Bart.

\
 
 \ /
  Last update: 2022-12-08 00:37    [W:0.109 / U:0.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site