Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4298103imm; Mon, 8 Oct 2018 19:28:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV617vuVnlBYf6zR/DeMsuqRDrLHV4qtsPgyegH6hO+b7na0MD/oWXLbywKlz9j7Px9BgIYbH X-Received: by 2002:a62:be1a:: with SMTP id l26-v6mr18441611pff.204.1539052088967; Mon, 08 Oct 2018 19:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539052088; cv=none; d=google.com; s=arc-20160816; b=uRbg2f29qt6iqrZzunL+n2dNKL/XklVzEVa4C2B4HLDFupE1Y+1m537ibV9cRd+f8X LqM/N2YZIcuQUbWofWmPanNNuvDqMy0Xs6WiIAT5j7UqAUnAqxpUpgD5uv3sYsosyqFN RNJ7NWgT6iIJYULWYG6qWnQt0LloWx6Tu/LqBW2adYH+VoDH+Zo/obKA946UnR6rvllc TcHvLlv0JswF9QFamnUwCeRS4VTIkfygC7OCKgg90pJY3EGftmUZoZx6wIbY9r8wbgPM 6M1rO+aHWnzzWtl1HB+Vyvwd7m5biWoIbxAI0f3K6LmC4TKIT903FNh7dHv7tSkNBeU+ blwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=zl/mnTv1nIk8oNAC7K+UwjO5QDhXmDzkBKHmp6dFUAw=; b=oW7691asdIgpBNtMF7Kc3o5d1XWxUKSjptmJB7GxhWVSy/hZtpWecQ2qf8nlFx+JX8 4dT5rYls/s4GPdhDsYSoDUQ93buYTXGmX/dnJ1avTCEz0m/cE06PqeQNW+rb8PorJb7g LxoJ/edQHU0nB2Ohb3ETR2U65YiovIaK/eX49mVwJ4Lj/addYZTdLWmvgpWwjCjR8S7i w+pjYkYykgNG0O3U9MfHo1DkTW60WztFBBUDWycQYYTQinAtObLn89h75fKxm8aMHDFl DBcRF94ShoXF9COW4K/DpSfbFICdiIMu+tzovx3e0KgvPfF5mcDdp31r1yZtv6iLbF5H my3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7-v6si20026786pgn.82.2018.10.08.19.27.52; Mon, 08 Oct 2018 19:28:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbeJIJmJ (ORCPT + 99 others); Tue, 9 Oct 2018 05:42:09 -0400 Received: from smtprelay0080.hostedemail.com ([216.40.44.80]:38579 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726565AbeJIJmJ (ORCPT ); Tue, 9 Oct 2018 05:42:09 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 682E8181D3368; Tue, 9 Oct 2018 02:27:30 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3871:3872:4250:4321:5007:7903:10004:10400:10848:11026:11232:11473:11658:11914:12048:12296:12438:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21451:21627:30054:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: north71_72f1545fc415 X-Filterd-Recvd-Size: 2794 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA; Tue, 9 Oct 2018 02:27:29 +0000 (UTC) Message-ID: <8e2f906a85c3cfe0715982370a6d96f08a37987c.camel@perches.com> Subject: Re: [PATCH] powerpc/xmon/ppc-opc: Use ARRAY_SIZE macro From: Joe Perches To: "Gustavo A. R. Silva" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Date: Mon, 08 Oct 2018 19:27:28 -0700 In-Reply-To: <20181004171036.GA1907@embeddedor.com> References: <20181004171036.GA1907@embeddedor.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-10-04 at 19:10 +0200, Gustavo A. R. Silva wrote: > Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element. [] > diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c [] > @@ -966,8 +966,7 @@ const struct powerpc_operand powerpc_operands[] = > { 0xff, 11, NULL, NULL, PPC_OPERAND_SIGNOPT }, > }; > > -const unsigned int num_powerpc_operands = (sizeof (powerpc_operands) > - / sizeof (powerpc_operands[0])); > +const unsigned int num_powerpc_operands = ARRAY_SIZE(powerpc_operands); It seems this is unused and could be deleted. > /* The functions used to insert and extract complicated operands. */ > > @@ -6980,8 +6979,7 @@ const struct powerpc_opcode powerpc_opcodes[] = { > {"fcfidu.", XRC(63,974,1), XRA_MASK, POWER7|PPCA2, PPCVLE, {FRT, FRB}}, > }; > > -const int powerpc_num_opcodes = > - sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]); > +const int powerpc_num_opcodes = ARRAY_SIZE(powerpc_opcodes); This is used once and should probably be replaced where it is used with ARRAY_SIZE > /* The VLE opcode table. > > @@ -7219,8 +7217,7 @@ const struct powerpc_opcode vle_opcodes[] = { > {"se_bl", BD8(58,0,1), BD8_MASK, PPCVLE, 0, {B8}}, > }; > > -const int vle_num_opcodes = > - sizeof (vle_opcodes) / sizeof (vle_opcodes[0]); > +const int vle_num_opcodes = ARRAY_SIZE(vle_opcodes); Also apparently unused and could be deleted. > > /* The macro table. This is only used by the assembler. */ > > @@ -7288,5 +7285,4 @@ const struct powerpc_macro powerpc_macros[] = { > {"e_clrlslwi",4, PPCVLE, "e_rlwinm %0,%1,%3,(%2)-(%3),31-(%3)"}, > }; > ld > -const int powerpc_num_macros = > - sizeof (powerpc_macros) / sizeof (powerpc_macros[0]); > +const int powerpc_num_macros = ARRAY_SIZE(powerpc_macros); Also apparently unused and could be deleted.