lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230301071228.GB5409@thinkpad>
Date:   Wed, 1 Mar 2023 12:42:28 +0530
From:   Manivannan Sadhasivam <mani@...nel.org>
To:     Po-Wen Kao <powen.kao@...iatek.com>
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org,
        Alim Akhtar <alim.akhtar@...sung.com>,
        Avri Altman <avri.altman@....com>,
        Bart Van Assche <bvanassche@....org>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        wsd_upstream@...iatek.com, peter.wang@...iatek.com,
        stanley.chu@...iatek.com, alice.chao@...iatek.com,
        naomi.chu@...iatek.com, chun-hung.wu@...iatek.com,
        cc.chou@...iatek.com, eddie.huang@...iatek.com,
        mason.zhang@...iatek.com, chaotian.jing@...iatek.com,
        jiajie.hao@...iatek.com
Subject: Re: [PATCH v3 2/6] scsi: ufs: core: Rename symbols

Subject could mention the actual function that is being renamed:
sizeof_utp_transfer_cmd_desc

On Thu, Feb 23, 2023 at 11:27:52PM +0800, Po-Wen Kao wrote:
> To avoid confusion, sizeof_utp_transfer_cmd_desc() is renamed to
> ufshcd_get_ucd_size().
> 

How about:

"Naming the functions after standard operators like sizeof may cause
confusion. So let's rename it to ufshcd_get_ucd_size()."

Suggested-by: Manivannan Sadhasivam <mani@...nel.org>

Thanks,
Mani

> Signed-off-by: Po-Wen Kao <powen.kao@...iatek.com>
> Reviewed-by: Stanley Chu <stanley.chu@...iatek.com>
> Reviewed-by: Ziqi Chen <quic_ziqichen@...cinc.com>
> ---
>  drivers/ufs/core/ufs-mcq.c | 2 +-
>  drivers/ufs/core/ufshcd.c  | 8 ++++----
>  include/ufs/ufshcd.h       | 2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 3a27fa4b0024..a39746b2a8be 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -265,7 +265,7 @@ static int ufshcd_mcq_get_tag(struct ufs_hba *hba,
>  	addr = (le64_to_cpu(cqe->command_desc_base_addr) & CQE_UCD_BA) -
>  		hba->ucdl_dma_addr;
>  
> -	return div_u64(addr, sizeof_utp_transfer_cmd_desc(hba));
> +	return div_u64(addr, ufshcd_get_ucd_size(hba));
>  }
>  
>  static void ufshcd_mcq_process_cqe(struct ufs_hba *hba,
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 3b3cf78d3b10..81c9f07ebfc8 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2823,10 +2823,10 @@ static void ufshcd_map_queues(struct Scsi_Host *shost)
>  static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i)
>  {
>  	struct utp_transfer_cmd_desc *cmd_descp = (void *)hba->ucdl_base_addr +
> -		i * sizeof_utp_transfer_cmd_desc(hba);
> +		i * ufshcd_get_ucd_size(hba);
>  	struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr;
>  	dma_addr_t cmd_desc_element_addr = hba->ucdl_dma_addr +
> -		i * sizeof_utp_transfer_cmd_desc(hba);
> +		i * ufshcd_get_ucd_size(hba);
>  	u16 response_offset = offsetof(struct utp_transfer_cmd_desc,
>  				       response_upiu);
>  	u16 prdt_offset = offsetof(struct utp_transfer_cmd_desc, prd_table);
> @@ -3735,7 +3735,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
>  	size_t utmrdl_size, utrdl_size, ucdl_size;
>  
>  	/* Allocate memory for UTP command descriptors */
> -	ucdl_size = sizeof_utp_transfer_cmd_desc(hba) * hba->nutrs;
> +	ucdl_size = ufshcd_get_ucd_size(hba) * hba->nutrs;
>  	hba->ucdl_base_addr = dmam_alloc_coherent(hba->dev,
>  						  ucdl_size,
>  						  &hba->ucdl_dma_addr,
> @@ -3835,7 +3835,7 @@ static void ufshcd_host_memory_configure(struct ufs_hba *hba)
>  	prdt_offset =
>  		offsetof(struct utp_transfer_cmd_desc, prd_table);
>  
> -	cmd_desc_size = sizeof_utp_transfer_cmd_desc(hba);
> +	cmd_desc_size = ufshcd_get_ucd_size(hba);
>  	cmd_desc_dma_addr = hba->ucdl_dma_addr;
>  
>  	for (i = 0; i < hba->nutrs; i++) {
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index ed9e3d5addb3..8f79cca449e1 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -1136,7 +1136,7 @@ static inline size_t ufshcd_sg_entry_size(const struct ufs_hba *hba)
>  	({ (void)(hba); BUILD_BUG_ON(sg_entry_size != sizeof(struct ufshcd_sg_entry)); })
>  #endif
>  
> -static inline size_t sizeof_utp_transfer_cmd_desc(const struct ufs_hba *hba)
> +static inline size_t ufshcd_get_ucd_size(const struct ufs_hba *hba)
>  {
>  	return sizeof(struct utp_transfer_cmd_desc) + SG_ALL * ufshcd_sg_entry_size(hba);
>  }
> -- 
> 2.18.0
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ