linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Joe Perches <joe@perches.com>, 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: Wed, 18 Aug 2021 15:28:19 +0300	[thread overview]
Message-ID: <5612b0fa-5623-f7d9-6dbe-e2f7165611a6@gmail.com> (raw)
In-Reply-To: <d96db1d04062a2a88eb51f319c2aef0a440755c3.camel@perches.com>



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

  reply	other threads:[~2021-08-18 12:28 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
2021-08-18 12:28   ` Tariq Toukan [this message]
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=5612b0fa-5623-f7d9-6dbe-e2f7165611a6@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).