From nobody Mon Feb 9 20:39:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627211224370525.830665519691; Sun, 25 Jul 2021 04:07:04 -0700 (PDT) Received: from localhost ([::1]:46214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7byI-0008OG-JY for importer@patchew.org; Sun, 25 Jul 2021 07:07:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7bxf-0007iE-L1 for qemu-devel@nongnu.org; Sun, 25 Jul 2021 07:06:23 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:43688 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7bxc-0003Eb-3K for qemu-devel@nongnu.org; Sun, 25 Jul 2021 07:06:23 -0400 Received: from host86-145-86-143.range86-145.btcentralplus.com ([86.145.86.143] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7bxO-0005Bq-36; Sun, 25 Jul 2021 12:06:10 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, peter.maydell@linaro.org, richard.henderson@linaro.org, f4bug@amsat.org, laurent@vivier.eu Date: Sun, 25 Jul 2021 12:05:57 +0100 Message-Id: <20210725110557.3007-1-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.145.86.143 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH for-6.1?] bitops.h: revert db1ffc32dd ("qemu/bitops.h: add bitrev8 implementation") X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1627211227067100001 Content-Type: text/plain; charset="utf-8" Commit db1ffc32dd ("qemu/bitops.h: add bitrev8 implementation") introduced a bitrev8() function to reverse the bit ordering required for storing the MAC address in the q800 PROM. This function is not required since QEMU implements its own revbit8() funct= ion which does exactly the same thing. Remove the extraneous bitrev8() function= and switch its only caller in hw/m68k/q800.c to use revbit8() instead. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/m68k/q800.c | 2 +- include/qemu/bitops.h | 22 ---------------------- 2 files changed, 1 insertion(+), 23 deletions(-) --- I picked this up reading the loongarch thread where I realised that QEMU already has a revbit8() function - I was searching for bitrev8() before deciding that this needed to be added since this was the name of the equiva= lent function in Linux. I think this is a good candidate for 6.1 still because a) it only has 1 cal= ler which is easy for me to test and b) it prevents anyone else coming along and accidentally using it later. MCA.=20 diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 6817c8b5d1..ac0a13060b 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -334,7 +334,7 @@ static void q800_init(MachineState *machine) prom =3D memory_region_get_ram_ptr(dp8393x_prom); checksum =3D 0; for (i =3D 0; i < 6; i++) { - prom[i] =3D bitrev8(nd_table[0].macaddr.a[i]); + prom[i] =3D revbit8(nd_table[0].macaddr.a[i]); checksum ^=3D prom[i]; } prom[7] =3D 0xff - checksum; diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index 110c56e099..03213ce952 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -618,26 +618,4 @@ static inline uint64_t half_unshuffle64(uint64_t x) return x; } =20 -/** - * bitrev8: - * @x: 8-bit value to be reversed - * - * Given an input value with bits:: - * - * ABCDEFGH - * - * return the value with its bits reversed from left to right:: - * - * HGFEDCBA - * - * Returns: the bit-reversed value. - */ -static inline uint8_t bitrev8(uint8_t x) -{ - x =3D ((x >> 1) & 0x55) | ((x << 1) & 0xaa); - x =3D ((x >> 2) & 0x33) | ((x << 2) & 0xcc); - x =3D (x >> 4) | (x << 4) ; - return x; -} - #endif --=20 2.20.1