From nobody Sat Nov 23 20:08:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731074223; cv=none; d=zohomail.com; s=zohoarc; b=A9DHmHdzoL9hW1l1iwHJ9rryNI0IzdfrLsRowzN012Y31+a2WDdi31Y89v2nQ5ToiO5AFG137NfhKODHc7JZuD5IsaBjbh5ygtmGf2exZYKHhwC8unzz5zjVE9b5VWeR92YYFLrZKv6cL6xohcq6hS9Nv2EbfvqXAdEl0kX4Zv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731074223; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ex0BO5YRCNbi8d1FC06nwvlcIyISeLFk+giHOrmeeb0=; b=M8WLPxxOLIhmg4GhcMgjM/rTg4kESVq/P+eBU6Kx+KL5fL07cIvZItlOY2TS6BrVZdiriKr+0Sms6+SYvIlW8QhyyjmqRLverkv6f8tdkPHqsbEEC1KQ3I006TDvYzUVywRazFz0VzxQMkfpVPVh7ddXdJley41Sacf7OX6Y3po= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731074223143118.48752406400786; Fri, 8 Nov 2024 05:57:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9PTn-0001A1-QC; Fri, 08 Nov 2024 08:56:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9PTl-000160-ES for qemu-devel@nongnu.org; Fri, 08 Nov 2024 08:56:49 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t9PTj-0005kO-RB for qemu-devel@nongnu.org; Fri, 08 Nov 2024 08:56:49 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4314f38d274so25511675e9.1 for ; Fri, 08 Nov 2024 05:56:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed970713sm4993529f8f.3.2024.11.08.05.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 05:56:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731074206; x=1731679006; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ex0BO5YRCNbi8d1FC06nwvlcIyISeLFk+giHOrmeeb0=; b=XOOWz7jp2PzHKmP5d+1blJRgB7N+8HluqVOEv7WL6476ugDkUI48C2tXOLz1oJn/QD HbHboxKByvCQ/M7SKZTJgjpsPM76mD0hiZvva1vwxZ5s/Y131zfK0wFb3/u2OBmsJ1QO p8tkWlaoosBGGLxSF98rrF/tpygjKUCB06A+LNtPVTiylLIUrAOsU7EkHb3WVutOrnfO /0Ck9Rv3P1rSQBXqe3yfOmsmcn5I9r9XS2w3/bCGU3oM4IXLRRpY6DFN5uJUD2nnfAvx VEPm1SWfhU8wCazUhkjOsZoiO7vM8c2jXJS9r7oQSOlT8XF4KtXNiVgTwzsEpOdKAhuD KGOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731074206; x=1731679006; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ex0BO5YRCNbi8d1FC06nwvlcIyISeLFk+giHOrmeeb0=; b=mqqbCQ8JA3nJeis/FTO7022d1NwabcoQdtcUZSzwcCR0sOFhO/568gxG7NTBsOf0Cd xPywg5KyYJwNVggYxAOoraDHcJNFTM50KSZaayjoFmc5Ml3K0mWnDns4tFKs8w/iNYyP BkzGjDnhbZSk4kXC9re76N6+ewojlZmUDVloYcw0moaG+99f0rbX7tGOKzo5rtB3ZSVV MgP33GKYP3CsDMGEOlVTkrBWHRBA8iCKv1+Ws8oOMCLio9FuwhHxxtLcuJ434Jwj7Oow Ez0n43Qgxv0vw2EDJNlxY07LjMx/BDSxqmmfDwVuqkjnijIq6mORQN2//SEu1l49q/4p u3EQ== X-Forwarded-Encrypted: i=1; AJvYcCUT1Pc1ycwEaI+mhqEFlXVQG3PAv+Ipt42rtgbGwyvbLWygVhcGb4L60rSBYWWF8pR8gfcs4fT5t/9/@nongnu.org X-Gm-Message-State: AOJu0YyE1nzO9eZsQgUPUSZBxEr8lZLGb2UXiuIWGTNKXrAdHR4PaIED L7vwk2JYNDRO0mAqbIx4mGX2oEuC4bD1vZoq34Bb4veS9KnYtUUdjL7gcnQUwNVz4sLzA6dbiTo a X-Google-Smtp-Source: AGHT+IGRrKTxQGqP26BPYVXIZbAEW6lWjKHx2j/kNF4jiWsBegBptjdqNb7bhiwfK93jUX4gQZx4nw== X-Received: by 2002:a05:6000:79e:b0:381:d88b:2bb9 with SMTP id ffacd0b85a97d-381f1889e6cmr2915377f8f.51.1731074205802; Fri, 08 Nov 2024 05:56:45 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Joel Stanley Subject: [PATCH] hw/misc/nrf51_rng: Don't use BIT_MASK() when we mean BIT() Date: Fri, 8 Nov 2024 13:56:44 +0000 Message-Id: <20241108135644.4007151-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731074225137116600 Content-Type: text/plain; charset="utf-8" The BIT_MASK() macro from bitops.h provides the mask of a bit within a particular word of a multi-word bit array; it is intended to be used with its counterpart BIT_WORD() that gives the index of the word in the array. In nrf51_rng we are using it for cases where we have a bit number that we know is the index of a bit within a single word (in fact, it happens that all the bit numbers we pass to it are zero). This happens to give the right answer, but the macro that actually does the job we want here is BIT(). Use BIT() instead of BIT_MASK(). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/misc/nrf51_rng.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/misc/nrf51_rng.c b/hw/misc/nrf51_rng.c index bf1eb0cf4a1..2d67f3f766e 100644 --- a/hw/misc/nrf51_rng.c +++ b/hw/misc/nrf51_rng.c @@ -107,25 +107,25 @@ static void rng_write(void *opaque, hwaddr offset, break; case NRF51_RNG_REG_SHORTS: s->shortcut_stop_on_valrdy =3D - (value & BIT_MASK(NRF51_RNG_REG_SHORTS_VALRDY_STOP)) ? 1 := 0; + (value & BIT(NRF51_RNG_REG_SHORTS_VALRDY_STOP)) ? 1 : 0; break; case NRF51_RNG_REG_INTEN: s->interrupt_enabled =3D - (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) ? 1 : 0; + (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) ? 1 : 0; break; case NRF51_RNG_REG_INTENSET: - if (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) { + if (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) { s->interrupt_enabled =3D 1; } break; case NRF51_RNG_REG_INTENCLR: - if (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) { + if (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) { s->interrupt_enabled =3D 0; } break; case NRF51_RNG_REG_CONFIG: s->filter_enabled =3D - (value & BIT_MASK(NRF51_RNG_REG_CONFIG_DECEN)) ? 1 := 0; + (value & BIT(NRF51_RNG_REG_CONFIG_DECEN)) ? 1 : 0; break; =20 default: --=20 2.34.1