Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp9581pxb; Tue, 17 Aug 2021 17:41:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSvC2G5xXED9eXlWWa/IzjO1rG1FBKuTu18n6EI7lSAwHwwip21XOGsGWWUl2FrUpoOO21 X-Received: by 2002:a92:da46:: with SMTP id p6mr4224231ilq.161.1629247290538; Tue, 17 Aug 2021 17:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629247290; cv=none; d=google.com; s=arc-20160816; b=u7uxxFs4i8iXQguQAylssujXw25iRLSGwBhLEUQiNFc44QKEknWDlRMemC+nQJnW3q I8GGYQcd9e6/ShaQm67PPcWavojR1q00QgjTeomsS9ep6tFv9pbK/+l8m5wprvscnyCn 1LgSrIoSmU1RkqlmrKDPO64Idq6FA3Xjs8VgUoHdkN5vLlJkgGzCDl53bLwIQyBaTKq5 oNM3WTktxcJmeN+el87znPdkxEYL+283ALynjyz4jhaLbvZ/PPSBT+ZpMVynBSoyGYKC ViqeFaQOSziOGDBdY96fNKmur7T2Zoj4d50DFeJSSR//cEWU82W6zoPbW+tWRdrCzHj4 fgnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=4H9lYAKjTcLCmpcfKHJ3MQsUnyoC1T57PPOSrszXJb4=; b=m/y7Z5iwfnZjJfx6HK1J4pA5JCrhLyp/f3mn5k62PXpysGGpMGZvYj/oslXKUQkcyX TWqkyJ+5YDDUKNBKT0LXb4PxYb0+eSKcN9b0iXrkTjq9RmcgiqEfDLOxc/o4cGCcPzAb NVMJOgKKsx8esO+wMhOHBQqYl7T8GPj+6hM+BKp1DO3+qaMy6ok2aMMtB98PgMgJeIb0 A0A5RLpSG9PEkIqA53XEy9qtRAzRT9oXOv+VS6UPu6C1Wup8LvkifGLoLJw4E98zynlc sUfmYISlnGxTlWtrmmSePW0WqtcTT+zH2wckqNNdTrGe8Dh1iMA3Ycr0q58agNoG8Utv IbVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si2512587jak.117.2021.08.17.17.41.19; Tue, 17 Aug 2021 17:41:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237143AbhHRAj4 (ORCPT + 99 others); Tue, 17 Aug 2021 20:39:56 -0400 Received: from smtprelay0052.hostedemail.com ([216.40.44.52]:36988 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232410AbhHRAjz (ORCPT ); Tue, 17 Aug 2021 20:39:55 -0400 Received: from omf09.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 09BE7837F24D; Wed, 18 Aug 2021 00:39:21 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA id A5A501E04D4; Wed, 18 Aug 2021 00:39:19 +0000 (UTC) Message-ID: Subject: Re: [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size From: Joe Perches To: Jason Wang , kuba@kernel.org Cc: davem@davemloft.net, tariqt@nvidia.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 17 Aug 2021 17:39:18 -0700 In-Reply-To: <20210817121106.44189-1-wangborong@cdjrlc.com> References: <20210817121106.44189-1-wangborong@cdjrlc.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.03 X-Stat-Signature: dz48nf6d9o5s49khmid9bhzxjdkbjf3u X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: A5A501E04D4 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+jgr6IHto8RE+dUh89yfcZj1brUyoKS4E= X-HE-Tag: 1629247159-857219 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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++) {