* [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size
@ 2021-08-17 12:11 Jason Wang
2021-08-18 0:39 ` Joe Perches
2021-08-18 22:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Jason Wang @ 2021-08-17 12:11 UTC (permalink / raw
To: kuba; +Cc: davem, tariqt, netdev, linux-rdma, linux-kernel, Jason Wang
The ARRAY_SIZE macro is defined to get an array's size which is
more compact and more formal in linux source. Thus, we can replace
the long sizeof(arr)/sizeof(arr[0]) with the compact ARRAY_SIZE.
Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
---
drivers/net/ethernet/mellanox/mlx4/qp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 2584bc038f94..b149e601f673 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -739,7 +739,7 @@ static void mlx4_cleanup_qp_zones(struct mlx4_dev *dev)
int i;
for (i = 0;
- i < sizeof(qp_table->zones_uids)/sizeof(qp_table->zones_uids[0]);
+ i < ARRAY_SIZE(qp_table->zones_uids);
i++) {
struct mlx4_bitmap *bitmap =
mlx4_zone_get_bitmap(qp_table->zones,
--
2.32.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size
2021-08-17 12:11 [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size Jason Wang
@ 2021-08-18 0:39 ` Joe Perches
2021-08-18 12:28 ` Tariq Toukan
2021-08-18 22:20 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2021-08-18 0:39 UTC (permalink / raw
To: Jason Wang, kuba; +Cc: davem, tariqt, netdev, linux-rdma, linux-kernel
On Tue, 2021-08-17 at 20:11 +0800, Jason Wang wrote:
> The ARRAY_SIZE macro is defined to get an array's size which is
> more compact and more formal in linux source. Thus, we can replace
> the long sizeof(arr)/sizeof(arr[0]) with the compact ARRAY_SIZE.
[]
> diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
[]
> @@ -739,7 +739,7 @@ static void mlx4_cleanup_qp_zones(struct mlx4_dev *dev)
> int i;
>
>
> for (i = 0;
> - i < sizeof(qp_table->zones_uids)/sizeof(qp_table->zones_uids[0]);
> + i < ARRAY_SIZE(qp_table->zones_uids);
> i++) {
trivia: could now be a single line
for (i = 0; i < ARRAY_SIZE(qp_table->zones_uids); i++) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size
2021-08-18 0:39 ` Joe Perches
@ 2021-08-18 12:28 ` Tariq Toukan
0 siblings, 0 replies; 4+ messages in thread
From: Tariq Toukan @ 2021-08-18 12:28 UTC (permalink / raw
To: Joe Perches, Jason Wang, kuba
Cc: davem, tariqt, netdev, linux-rdma, linux-kernel
On 8/18/2021 3:39 AM, Joe Perches wrote:
> On Tue, 2021-08-17 at 20:11 +0800, Jason Wang wrote:
>> The ARRAY_SIZE macro is defined to get an array's size which is
>> more compact and more formal in linux source. Thus, we can replace
>> the long sizeof(arr)/sizeof(arr[0]) with the compact ARRAY_SIZE.
> []
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
> []
>> @@ -739,7 +739,7 @@ static void mlx4_cleanup_qp_zones(struct mlx4_dev *dev)
>> int i;
>>
>>
>> for (i = 0;
>> - i < sizeof(qp_table->zones_uids)/sizeof(qp_table->zones_uids[0]);
>> + i < ARRAY_SIZE(qp_table->zones_uids);
>> i++) {
>
> trivia: could now be a single line
>
> for (i = 0; i < ARRAY_SIZE(qp_table->zones_uids); i++) {
>
>
I'm fine with both suggestions.
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Thanks for your patch.
Tariq
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size
2021-08-17 12:11 [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size Jason Wang
2021-08-18 0:39 ` Joe Perches
@ 2021-08-18 22:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-18 22:20 UTC (permalink / raw
To: Jason Wang; +Cc: kuba, davem, tariqt, netdev, linux-rdma, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Tue, 17 Aug 2021 20:11:06 +0800 you wrote:
> The ARRAY_SIZE macro is defined to get an array's size which is
> more compact and more formal in linux source. Thus, we can replace
> the long sizeof(arr)/sizeof(arr[0]) with the compact ARRAY_SIZE.
>
> Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/qp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- net/mlx4: Use ARRAY_SIZE to get an array's size
https://git.kernel.org/netdev/net-next/c/19b8ece42c56
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-18 22:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-17 12:11 [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size Jason Wang
2021-08-18 0:39 ` Joe Perches
2021-08-18 12:28 ` Tariq Toukan
2021-08-18 22:20 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.