All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jason Wang <wangborong@cdjrlc.com>, kuba@kernel.org
Cc: davem@davemloft.net, tariqt@nvidia.com, netdev@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size
Date: Tue, 17 Aug 2021 17:39:18 -0700	[thread overview]
Message-ID: <d96db1d04062a2a88eb51f319c2aef0a440755c3.camel@perches.com> (raw)
In-Reply-To: <20210817121106.44189-1-wangborong@cdjrlc.com>

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++) {



  reply	other threads:[~2021-08-18  0:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-08-18 12:28   ` Tariq Toukan
2021-08-18 22:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d96db1d04062a2a88eb51f319c2aef0a440755c3.camel@perches.com \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tariqt@nvidia.com \
    --cc=wangborong@cdjrlc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.