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: <fad57299-7a79-4073-8f83-410e32e28a48@huawei.com>
Date: Mon, 19 Aug 2024 09:05:22 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Zhang Zekun <zhangzekun11@...wei.com>, <yisen.zhuang@...wei.com>,
	<salil.mehta@...wei.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <netdev@...r.kernel.org>
CC: <shaojijie@...wei.com>
Subject: Re: [PATCH net-next] net: hns3: Use ARRAY_SIZE() to improve
 readability

on 2024/8/18 13:25, Zhang Zekun wrote:
> There is a helper function ARRAY_SIZE() to help calculating the
> u32 array size, and we don't need to do it mannually. So, let's
> use ARRAY_SIZE() to calculate the array size, and improve the code
> readability.
>
> Signed-off-by: Zhang Zekun <zhangzekun11@...wei.com>

Reviewed-by: Jijie Shao<shaojijie@...wei.com>

	Jijie Shao

> ---
>   drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c
> index 65b9dcd38137..6db415d8b917 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c
> @@ -134,17 +134,17 @@ void hclgevf_get_regs(struct hnae3_handle *handle, u32 *version,
>   	reg += hclgevf_reg_get_header(reg);
>   
>   	/* fetching per-VF registers values from VF PCIe register space */
> -	reg_um = sizeof(cmdq_reg_addr_list) / sizeof(u32);
> +	reg_um = ARRAY_SIZE(cmdq_reg_addr_list);
>   	reg += hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_CMDQ, reg_um, reg);
>   	for (i = 0; i < reg_um; i++)
>   		*reg++ = hclgevf_read_dev(&hdev->hw, cmdq_reg_addr_list[i]);
>   
> -	reg_um = sizeof(common_reg_addr_list) / sizeof(u32);
> +	reg_um = ARRAY_SIZE(common_reg_addr_list);
>   	reg += hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_COMMON, reg_um, reg);
>   	for (i = 0; i < reg_um; i++)
>   		*reg++ = hclgevf_read_dev(&hdev->hw, common_reg_addr_list[i]);
>   
> -	reg_um = sizeof(ring_reg_addr_list) / sizeof(u32);
> +	reg_um = ARRAY_SIZE(ring_reg_addr_list);
>   	for (j = 0; j < hdev->num_tqps; j++) {
>   		reg += hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_RING, reg_um, reg);
>   		for (i = 0; i < reg_um; i++)
> @@ -153,7 +153,7 @@ void hclgevf_get_regs(struct hnae3_handle *handle, u32 *version,
>   						  HCLGEVF_RING_REG_OFFSET * j);
>   	}
>   
> -	reg_um = sizeof(tqp_intr_reg_addr_list) / sizeof(u32);
> +	reg_um = ARRAY_SIZE(tqp_intr_reg_addr_list);
>   	for (j = 0; j < hdev->num_msi_used - 1; j++) {
>   		reg += hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_TQP_INTR, reg_um, reg);
>   		for (i = 0; i < reg_um; i++)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ