Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp414527pxb; Wed, 18 Aug 2021 05:30:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSXakyJKAFb8sNRgif4EjmGX/FHDaHBCywTWuRRIhNq22/Fk5nsq05Ms6WAggnhLwHzPBL X-Received: by 2002:a6b:8d8a:: with SMTP id p132mr6779009iod.81.1629289829133; Wed, 18 Aug 2021 05:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629289829; cv=none; d=google.com; s=arc-20160816; b=YuPX6vMhbDKYKmmBqAALYP3I68yGWsJLTAprrh6WFK3zG5wAEggi+r/cnj6UfVuq5g hu2W7vBKUfqEzvyP0kySdWPhb/PVoJPSjPF9rzE5UXsJivlf9OEIV1rY1UXyZKxpuVQ/ RtYIeOKw9c7hYfIniPNVe3Xktpycd6a1euNrfBjlLBDnC6tgOXlwXydVdfE/D+0K1LVm waFTYF3hnltXVgEc7xFJuRHJoKzoHMb0eoypeZXNDnrRPOR4BudKbjUkFGAC135eGRCW MSw42K4zhrkR4yZxz3DezxZ2X+hg5+tT8K23yuVJ/MIVxjIgxipNoG7MEJoonA7GZRZe KI/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ASCrLZq+5KaiR51SjpL26ngVy47N8yw0XayWraK3fo0=; b=ybYi6kvCDNgICfZwWxabELzNOyZt99MiM0d2mh/pkiBJBlroWLgcttnG4WcG2V//f+ O1skTqatKGMDUofWy/DLrvvrJe5t01ScWBHfN+6EqEUXlhWQn7lyrY04CZUxF0lmHHPh zz4K8bn9QWOaS6w5e/40qgS1TJqX17RUkpuObdToX8xRz8TUEdn3sYeyoMqE72gbTbbL i8DEfHgReJAt8uCg+shy/M39iG1zl5RBuTGRaRrCz7bAb+08M44Wf9g61oUZooEoVa17 tc+buapXmMBvTuSpptoQiu1Czy7WKqOdREyl66OwtmHZWE1O9MVSSd4PSNTvBYG261Qh EJXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=q4mKB2Ip; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si600652ilk.152.2021.08.18.05.30.17; Wed, 18 Aug 2021 05:30:29 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=q4mKB2Ip; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236028AbhHRM3D (ORCPT + 99 others); Wed, 18 Aug 2021 08:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235738AbhHRM26 (ORCPT ); Wed, 18 Aug 2021 08:28:58 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9733C061764; Wed, 18 Aug 2021 05:28:23 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id bo19so2848353edb.9; Wed, 18 Aug 2021 05:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ASCrLZq+5KaiR51SjpL26ngVy47N8yw0XayWraK3fo0=; b=q4mKB2IpTwz3Or9BZAZcXjO1t2Oy1cn+u6d0gGgg8ZeQN7ZI9MwnkwdC93xjkhkdiq qdC7hwb8gLZi9ihKkucCNaEB+g/q1pv2LwNW+T7xylyJ91cJfDF0mRWgnVpI0V14FohU 3dhhJZ3n80tnuGqFYJxpQ3BYAZwXF6VBjnjkB7yUpX48Fsm0PRpeD/ReRPsz8LD4jY1T Ws3EFjvw2mCc7BNmRIAIchCenQtGZ8UobE3+gm9K7jt8UyuMp8tPVcm/T6/CFWbPY6HQ jPjNWf1yQ1k/lZGAlR0OcqmIGcYXhpvDjeTQL5+gG6TvgEtDK8itVaiZMJxxyFgQl3X9 q7Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ASCrLZq+5KaiR51SjpL26ngVy47N8yw0XayWraK3fo0=; b=E4EFx2svYewvv0sYxtDk6PWoMCvz3B01sPLUCtYTkUZVk5mS7u7/NLpgbFn8FqeKqw Vt/9Cv8zZj/Ct7tjM/nkrb29B9p/ohaGMd5M8xXI5hM617hdwJnxkWdLXkwSNqdXkbZ6 G9c+KACtxS8AeUZa4cGjb0zcIytlOyFuGhZ2W2hzGgW/dnCpYa8GTMzEB72c4hz1GD/7 vVIKXGxSDfaCpJ+PUw00oDc6bp9y43+ygRC7miL0EGnFGnnWS9f7/ZWNOvVQcfwtj9bl ZaIgl1W55KRchG0GmtUBr/YnsU4nEn0FS76OVFcWKqI6dI8qMAaydSpfVIT6iu283fhX 4tgQ== X-Gm-Message-State: AOAM5308c/d93UFiIRGT6dGayfnUiNquY5CZz6/y6U0jyu2NsUwbPktV +4swOtS4uYQWuHqSBGCIZmPh4At9niw= X-Received: by 2002:a05:6402:4243:: with SMTP id g3mr9801588edb.85.1629289702250; Wed, 18 Aug 2021 05:28:22 -0700 (PDT) Received: from [192.168.0.108] ([176.228.98.2]) by smtp.gmail.com with ESMTPSA id v15sm948186ejq.116.2021.08.18.05.28.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Aug 2021 05:28:21 -0700 (PDT) Subject: Re: [PATCH] net/mlx4: Use ARRAY_SIZE to get an array's size To: Joe Perches , 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 References: <20210817121106.44189-1-wangborong@cdjrlc.com> From: Tariq Toukan Message-ID: <5612b0fa-5623-f7d9-6dbe-e2f7165611a6@gmail.com> Date: Wed, 18 Aug 2021 15:28:19 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Thanks for your patch. Tariq