From nobody Mon Oct 6 15:28:47 2025 Received: from sonic310-22.consmr.mail.gq1.yahoo.com (sonic310-22.consmr.mail.gq1.yahoo.com [98.137.69.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EBB1176AC8 for ; Sat, 19 Jul 2025 23:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=98.137.69.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752966201; cv=none; b=b6xNhYxgeDcD84e34lR65pmOCnp5Fa5sVe7cgeSt6zVPuyw8jKGkXDgbqAnwVFZFwSYFk5XEKi5nVvCM0CKeFuPcjdkzWBGNR2N5EdM4LiVS0Lk4n1divM7yC6ko0UJQx7qh5oUk4zDJLfkEVmm+5JWDRJ3hPNC3tMYhGDxHoBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752966201; c=relaxed/simple; bh=8hdbAKwnFmTXx4szhbKumxlLnhZDQ4snGBbnChoqlzw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:References; b=c5QO5xhXIbHpiGQXYexL3UNxT3xYry/ZdF6yHQ6oBNvPCNJJbqWjDb6XDJWGgeAL3is54Gi9+wiEaEMn2aIjBD2Nb6DaHxBVv+eGmBLfVJiXYERKOI/ZgWHN2PYonypBFJazpQQqV8Ey24LKaHbMMB+yEmXmmDyqRHJ2YqzFkD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=aol.com; spf=pass smtp.mailfrom=aol.com; dkim=fail (2048-bit key) header.d=aol.com header.i=@aol.com header.b=i4C1XFGb reason="signature verification failed"; arc=none smtp.client-ip=98.137.69.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=aol.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aol.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=aol.com header.i=@aol.com header.b="i4C1XFGb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1752966198; bh=Ce6Dt8pLkw9UGkCntDHrb1L0yj8e9KlBmSuxz9VENrA=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=i4C1XFGbvfWH4KAPcR2WgKQtZSynQFUInpnQNMLUTjuU0AHB6IlTvv9qVkDih+3ZBjLCcMi+AL88aKCCBLI+xpyIHrg4q33sIuah8mrhnuKJgIm8GPo6A1KCscYXwJgtLP7lCZ4wzibQJubz+5V5+7UGQUaXvLczl4Yqd1/2BDoFEIdD9v0/sn3ee+YmgJ1sckiTeBtfVWiarW4zTgkcQtjfAeniUxblQ7A6Pfipowiw18Ed6q34dFRUt+KBUx/mbRSyR2mTF52sU66o6BSut7F6oFtj7YbkibmaMNztk0txOILJClHt1zvP55A5lQNqO/k+QoS5pzmK11PGIjuP1w== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1752966198; bh=32ZjcdF0z+MPoka80O0aEUjO6pGezSXcdEV3D1srxmp=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=NOTRMuxLM0kvKL07S6dieGKZzMd2Fxz1mjV+EuSi7cwJkkf0JS2KpooHY07pHa053gbnwhuRTS3pCtKHGdgjzVx0oLwqEX5P5US1iLsU0PqHlivqyxz4kF6wxxSlo3Uw17ksPO7EPA1xZKS8kBMuFANEkSXgiViJcBtr5GxSvehPgacZoQ/pKAZGNBhJK9qNBBtuj3e+lMHYYr3d7u/eczRKWFOIJtgMV/GMCMVdIgTufrGJlARsqQloqrkwZPoVCVKydr9EjoeL0zXIj4H+C6zrASTVNH+GQbp5rX2B7MlWUwZt56fKua/cJv12soNjQyv8c9Etc+sXhpZkc0ocTA== X-YMail-OSG: GgHGVHsVM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0tkwL.JVvFAxj8nf3Ep8VmEF3xNhOrn6RcOrQQv2INYnmwtLe GLfQgi_cIGBLv.l6olIlDqCTkK1d8o8nd3nzVDjSVWbzNpjXuSlRcSDo8ixOhQ47QInNRVs3N1H0 mn2Q0cJrcJmKzbG97.sBJgY2CuoYvYMZNj5CHK7p4iy7A1hF4wFxCRV3MEJZrJBI1Gjg6WNE- X-Sonic-MF: X-Sonic-ID: fa017355-6ef2-460f-a50d-35f54d9307d6 Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.gq1.yahoo.com with HTTP; Sat, 19 Jul 2025 23:03:18 +0000 Received: by hermes--production-ir2-858bd4ff7b-q7k6m (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 320ab1abfa6527764d3740cb14f93fe5; Sat, 19 Jul 2025 22:53:10 +0000 (UTC) From: Ruben Wauters To: Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy Cc: Ruben Wauters , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] powerpc/xmon: replace sizeof calculations with ARRAY_SIZE macro Date: Sat, 19 Jul 2025 23:43:10 +0100 Message-ID: <20250719225225.2132-2-rubenru09@aol.com> X-Mailer: git-send-email 2.49.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable References: <20250719225225.2132-2-rubenru09.ref@aol.com> Content-Type: text/plain; charset="utf-8" The calculations for operand/opcode/macro numbers are done in an identical manner to the already existing ARRAY_SIZE macro in linux/array_size.h This patch replaces the sizeof calculations with the macro to make the code cleaner and more immediately obvious what it is doing. Signed-off-by: Ruben Wauters Reviewed-by: Christophe Leroy --- arch/powerpc/xmon/ppc-opc.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c index 0774d711453e..de9b4236728c 100644 --- a/arch/powerpc/xmon/ppc-opc.c +++ b/arch/powerpc/xmon/ppc-opc.c @@ -954,8 +954,7 @@ const struct powerpc_operand powerpc_operands[] =3D { 0xff, 11, NULL, NULL, PPC_OPERAND_SIGNOPT }, }; =20 -const unsigned int num_powerpc_operands =3D (sizeof (powerpc_operands) - / sizeof (powerpc_operands[0])); +const unsigned int num_powerpc_operands =3D ARRAY_SIZE(powerpc_operands); =20 /* The functions used to insert and extract complicated operands. */ =20 @@ -6968,9 +6967,8 @@ const struct powerpc_opcode powerpc_opcodes[] =3D { {"fcfidu.", XRC(63,974,1), XRA_MASK, POWER7|PPCA2, PPCVLE, {FRT, FRB}}, }; =20 -const int powerpc_num_opcodes =3D - sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]); -=0C +const int powerpc_num_opcodes =3D ARRAY_SIZE(powerpc_opcodes); + /* The VLE opcode table. =20 The format of this opcode table is the same as the main opcode table. = */ @@ -7207,9 +7205,8 @@ const struct powerpc_opcode vle_opcodes[] =3D { {"se_bl", BD8(58,0,1), BD8_MASK, PPCVLE, 0, {B8}}, }; =20 -const int vle_num_opcodes =3D - sizeof (vle_opcodes) / sizeof (vle_opcodes[0]); -=0C +const int vle_num_opcodes =3D ARRAY_SIZE(vle_opcodes); + /* The macro table. This is only used by the assembler. */ =20 /* The expressions of the form (-x ! 31) & (x | 31) have the value 0 @@ -7276,5 +7273,4 @@ const struct powerpc_macro powerpc_macros[] =3D { {"e_clrlslwi",4, PPCVLE, "e_rlwinm %0,%1,%3,(%2)-(%3),31-(%3)"}, }; =20 -const int powerpc_num_macros =3D - sizeof (powerpc_macros) / sizeof (powerpc_macros[0]); +const int powerpc_num_macros =3D ARRAY_SIZE(powerpc_macros); --=20 2.49.1