From patchwork Sun Nov 13 09:13:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 19312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1612532wru; Sun, 13 Nov 2022 01:35:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf6xFA/xpXrV9pU22j3C9O3dBxFlfJLzP/iKb+VueSQriS/uh2faY5FWqz3fad8yuOikaseo X-Received: by 2002:a17:907:a681:b0:78d:3505:6f3e with SMTP id vv1-20020a170907a68100b0078d35056f3emr6913634ejc.611.1668332125018; Sun, 13 Nov 2022 01:35:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668332125; cv=none; d=google.com; s=arc-20160816; b=WMxivYuPt9SZVbLDTcIfdTaef7Nt0PYIPpA9UOAy6IBPyAppTRWKma22qFPBb+fCO4 Ch8zHjqKKQAKFPgMOupIuqZ5S3/6WZPG5OR+h9+Cpn9ZA2ns/OsAegOvwuBdPz/nU0Pj IXPIITgvknnB3qy/JWUhW01YRqImmKKgkknUwU/33su5IoqNEd1yT9KirlXgsSL8foeo P2ZtzeMeUIBe3VipmLh1WGOtoUCFm6BY/MI1ABLL4pPCXARn/39rLnnQjIxn7h+jQSej zfE3yh0GIN8QPwOpweUxm0O5A0Yhpmc9zuwjC12MpZE3GZ1VBotox2Szpo8/RxrHEnJV oEog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version :content-transfer-encoding:subject:cc:to:from:date; bh=QpMyYy2ErlLMS3ojP4dUH1mPItohlt0elOLI0IWqaSg=; b=tkVrDzQlGQn/uyeZf2rBXHKz/ggynqTvQSSsEG0VlC6GQnZEb0Ymr1xyf9355L+EXC nrNzHpswvM2DBREG1Ytga/2G0SdrK5uqR34lb2NjfGJhqtd5JyHsg/g4bggBXG7e0fY4 1YaX6t1eo9aXyGvGXmh8JLKYgFrmH+6PK1Y8jWS3glMf84Esk3HOW501FwPy3cI4yaGK hl/dFEiBeK+4nJ5J83fNo5yJfgP6FMrnb8CTR79DE/4TJDHpQ+chdKc/K47vFSz2MBpu XnFwSfBLM9UgOxIKNy5yZU3y5gFqsWR8EVs7lT2RrwKtk319VnLAWASK2SE9feIpkRkP 5XIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id re4-20020a170906d8c400b007330c08fe49si5394353ejb.206.2022.11.13.01.34.58; Sun, 13 Nov 2022 01:35:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235151AbiKMJSs (ORCPT + 99 others); Sun, 13 Nov 2022 04:18:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbiKMJSr (ORCPT ); Sun, 13 Nov 2022 04:18:47 -0500 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4E7D312A8B for ; Sun, 13 Nov 2022 01:18:37 -0800 (PST) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Sun, 13 Nov 2022 17:13:04 +0800 (GMT+08:00) X-Originating-IP: [182.148.14.167] Date: Sun, 13 Nov 2022 17:13:04 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, Julia.Lawall@inria.fr, joel@jms.id.au Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc/xmon: Fix array_size.cocci warning X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.1 build 20210329(c53f3fee) Copyright (c) 2002-2022 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn MIME-Version: 1.0 Message-ID: <6432107b.12b.1847043884e.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwCXq+EhtXBjzBkDAA--.79W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQAEB2FEYx0DfwALsu X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00,RCVD_IN_PBL,RDNS_NONE, T_SPF_HELO_PERMERROR,T_SPF_PERMERROR,XPRIO autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749373026186564792?= X-GMAIL-MSGID: =?utf-8?q?1749373026186564792?= Fix the following coccicheck warning: arch/powerpc/xmon/ppc-opc.c:957:67-68: WARNING: Use ARRAY_SIZE arch/powerpc/xmon/ppc-opc.c:7280:24-25: WARNING: Use ARRAY_SIZE arch/powerpc/xmon/ppc-opc.c:6972:25-26: WARNING: Use ARRAY_SIZE arch/powerpc/xmon/ppc-opc.c:7211:21-22: WARNING: Use ARRAY_SIZE Signed-off-by: KaiLong Wang --- arch/powerpc/xmon/ppc-opc.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c index 0774d711453e..ad64c2709757 100644 --- a/arch/powerpc/xmon/ppc-opc.c +++ b/arch/powerpc/xmon/ppc-opc.c @@ -954,9 +954,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. */ /* The ARX, ARY, RX and RY operands are alternate encodings of GPRs. */ @@ -6968,8 +6966,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. @@ -7207,8 +7204,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. */ @@ -7276,5 +7272,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);