Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1236669imm; Thu, 4 Oct 2018 10:12:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV63x/UOwQkw17ZicV0Ud3OLMIDfQdwwaCfrXbne7hD2jV+dcHmVqu55M1XW6zoCCY9Ge2jNy X-Received: by 2002:a63:8343:: with SMTP id h64-v6mr6254583pge.368.1538673148811; Thu, 04 Oct 2018 10:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538673148; cv=none; d=google.com; s=arc-20160816; b=UOJ+TdGYf8zu1l45C89aDYv02Vkf3WB/M7xuoQVlo23uGMwQihND51c3L/50BfPJaU TY/g5YuSbXBYOSWaRYPRfn51fSnDw1ScFc7rXpmJsLIHnDtRtOhIfLZUGKEj8unOBKgM yQDSrb19ZhvXunz1tKmckbQNMNCt2H9T8QO62ayQdT8UQ5/CV5sldTe9hMzvHptjIVxB U+wn0sNmchOH/nOGYHlWNTsLxuhGNSR0HHsAIFY6Y1bilr8xyY3xef/6RVtr6EOd6EUn 0saixSoh1ESeegzG+r1QSw4cD0dKMkRNe2OOAj/Ytj8gODa+EavO27tufTm+a33Dc0uR k8UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=kt1+0ykuDaCrm8bOXlWtYcCpzahnPYT3yjcr3QHn+sY=; b=JOwXko+BtFV6ERHd4fZCeq1U2yN/hjQ2W2DPvDRe53/7uP+7CxQjzzLrvcXh9FJmR2 g5jsgOy+KcH3vjrU6ePRYUzNmy1YHeq8HVLdn42NRi0Xru/eIXRR8imP0Gr9zhoijSGF Wv/ens5w0koYwJVrxtP4j+VLSc9NdUrW9iw6MleIHiDc1pHjM54FYAVvHKt6sdx47ibh DfdO1Z0WywP3G59Ko/ZBwgl+2wMBgKKZ9qrn1V3jZI/rbcBEux+J/g/VS6HRwBIsU9Nw jc2HkWKp+8xHDPkrOfAagz1riftVaxrRgJBbzXC5DwXh/DzofMJZxovUzg8trBidgN1K 7dkw== 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 187-v6si6343879pfe.182.2018.10.04.10.12.11; Thu, 04 Oct 2018 10:12:28 -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 S1727634AbeJEAEw (ORCPT + 99 others); Thu, 4 Oct 2018 20:04:52 -0400 Received: from gateway24.websitewelcome.com ([192.185.50.84]:18971 "EHLO gateway24.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727536AbeJEAEw (ORCPT ); Thu, 4 Oct 2018 20:04:52 -0400 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 41B19C3CB for ; Thu, 4 Oct 2018 12:10:42 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 8798gE6BkBcCX8798gYLsL; Thu, 04 Oct 2018 12:10:42 -0500 X-Authority-Reason: nr=8 Received: from 174.206.93.92.rev.sfr.net ([92.93.206.174]:54470 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1g8796-000CXX-UB; Thu, 04 Oct 2018 12:10:41 -0500 Date: Thu, 4 Oct 2018 19:10:36 +0200 From: "Gustavo A. R. Silva" To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] powerpc/xmon/ppc-opc: Use ARRAY_SIZE macro Message-ID: <20181004171036.GA1907@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 92.93.206.174 X-Source-L: No X-Exim-ID: 1g8796-000CXX-UB X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174.206.93.92.rev.sfr.net (embeddedor) [92.93.206.174]:54470 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 5 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva --- arch/powerpc/xmon/ppc-opc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c index ac2b55b..f3f57a1 100644 --- 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); /* 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); /* 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); /* 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)"}, }; -const int powerpc_num_macros = - sizeof (powerpc_macros) / sizeof (powerpc_macros[0]); +const int powerpc_num_macros = ARRAY_SIZE(powerpc_macros); -- 2.7.4