From patchwork Wed Apr 23 12:09:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 883600 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2885758wrs; Wed, 23 Apr 2025 05:11:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU+mw9x8Gv4QKdTJXwNt6gvIT2pQcrIX+63XpKkhP0rrmaaOsB9qPViWhBKxMCFr4mzI+CbDQ==@linaro.org X-Google-Smtp-Source: AGHT+IH5UIrzQaVni7HT8H8A8QvZx51iYCWTJIP46uPpU94TjzXXewswyvMVkWRW43kuRBDmeh8c X-Received: by 2002:ad4:5be1:0:b0:6d4:1bad:740c with SMTP id 6a1803df08f44-6f2c45156b1mr296772176d6.4.1745410281954; Wed, 23 Apr 2025 05:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745410281; cv=none; d=google.com; s=arc-20240605; b=GAxn/MS/0AgypLScrP0GW9kK++ClwSikkVaOg1oJICEVDPtlPmBDKklmlRB/b3FF5t Gl4i99elg0u0X0AdC9cXI6AJSjHOb7a/fBM8tTJtYJjPLqk5IY/JIVYDUOk5CysFgesa yuKZb+wYJRu+h0JAISmrZ0qK+3shs61ozZ88yPaLVXEjCnwWVcRA1ne2vNe+NTYOI8tU T5FbiO0y39EQBiYatddNWc7AGI0j+MYEnDff4smfEPDJQ5hHU4DA4DXKN8Hb6DKQRg2y 5BCTfodJWkBSbBLX9Vu4GIFo1kD80JXyuP7WQ4ICpnsVTj8E/xtGHkYLZswoSjHu4Zmh xH4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=FZgMkeN579lrvloaKRasUpMTcORD0XAWHQyNz1vd4U8=; fh=DKQFoSm5rvXVk6AUqpSavFv+IR+qPwKdgcCOIx8jJm4=; b=cOQw/cmjUkroa8Vsso1ehQEoA4qkT6WdNnbiius6Zb5I7QpEhTZTmBsj8EyfmKmJ/j 19s32DVUkQ1MPl8Prbs7+czp7/csQEA+mCTvfrzwhEd9Be5NO6iM2yjyMSckItWj23wp YhpME3ECj5GX207HAR7wfSRMjzcE2qWjgiND6G649wLqqhWiEBwoFAd8FJlnMzyjKbRJ 05FhIV4HujPT2PD31Qw7D9PiT/6mwNUIg56eLtxUm3sm+yr2XtYHTtCzmo9ZpAqEfwsI AbxOz1ZeumZMHrZHQDvB0FSVAuf2NUJ4xbGdx6v1hq7ukZHN4ANXH+7wfYt083A9Gx0e W5Sg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VWq1UPzf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6f2c2be98ecsi133210696d6.248.2025.04.23.05.11.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Apr 2025 05:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VWq1UPzf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7Yvv-000247-Ab; Wed, 23 Apr 2025 08:10:31 -0400 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 1u7Yv9-0000v7-G0 for qemu-devel@nongnu.org; Wed, 23 Apr 2025 08:09:44 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u7Yv7-0000no-9f for qemu-devel@nongnu.org; Wed, 23 Apr 2025 08:09:42 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43cf034d4abso58305545e9.3 for ; Wed, 23 Apr 2025 05:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745410179; x=1746014979; 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=FZgMkeN579lrvloaKRasUpMTcORD0XAWHQyNz1vd4U8=; b=VWq1UPzfkVbNIgJNmUDW1hjrXevLVlahFVjoir0qzKulBseEUT7nPLANnDiR8h1Su3 UUi7/ALRT3fGNXLgV+EKENBuRZ2wxbpTiVI6X9exJqW0dEl8sCpdednsdpfwB9j329JF UJmLmoDXesR6jplOlAo4Se0oZZnoBBK6v066Mk7t1oD9cMFr1JEd9Lyse78SDrNu+zrp AmcL6U+eAabAmLjChSRsQTtKminWh+ohVeXOsd+c8l7+ijakpkaj+pslvRFnWkL0TwGi mZTxz8JUZTBv4SKMglbQj6cdzv2ltn/tTnfbB0iCC6y+PoGGgV3Nj1eKQ/v7dpmdnhVz ZVrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745410179; x=1746014979; 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=FZgMkeN579lrvloaKRasUpMTcORD0XAWHQyNz1vd4U8=; b=uhW9wqBcjW8WSJlYUNYudPj6O1aGQITal6B6j7HarmekDAqt+aM1GUDNUc1kgxoU+J ZZDgY0C5PTiSNVOaT0eZi/Q3DarMYMPMwuFTdYqHNowxeGXM3PzsA7+/IZXkOokJ2YMt zcn6Nftl3IUFk9/aA+bOd6MPUuPWkUe8lRjDpGHYtx0GuTD1WSxTCTXxclSKEWlS5NXg xvVhLmtFD3pqr3abGh/Xs+BTebEh5YoO0lzOkmhf+rRj7ESSn9j+oUFFgZSueaenFKXy Cg1RenCTbxo4LfyRsBhVRLoeAg5cEC+Nl/Ty7vo7Hga/NoftOZ/vLPZWCvo9l0zEY+YC fA8Q== X-Gm-Message-State: AOJu0YwN37GEo5nUDreWozu1/ESdcISz5Kils91sfKOmM5pNULDPMvmv d0tUO7zF0Tr4/GgFYBv15+9SgojHOetuXuM5n72jNBeSrpqmIztJSRSKWuZNXvbtvorhDvGHA2t U X-Gm-Gg: ASbGncvdVG+JQzaDTLI2qV9or8MFfHqPigbNmcNTycEhhcKlORY/boKYKsvgcSMcrcg cZHX0FIJYZfJEUf6xjrtwA1NoxH3H4olRawPp0im68BjEDBGYge78YSPrdh3isYwQdeOSS+z9dm KDUrbyGqVerbK0hn6pUpq4ZGlva3N5f8MALQ5nQAGXibltZbZOXzPCjmfJUYyPycU2cWYVESLS6 20sPFPSm5R0Hx/XPefnQ91WBs7QHNFbnUSkGHA6MQ6MP/6ZHFqJxbZ3B1PpD8OxM9DX3Af/baLe CcKWy3I7yNzk3b03K0QgiCLazM24ok5rlFTBSHgWExufEh6JowpHGB7Et/iTZ6/qNufOc8H7lVf WN4gBa8nOT/uuLlA= X-Received: by 2002:a05:600c:3583:b0:43c:ed61:2c26 with SMTP id 5b1f17b1804b1-4406abb2407mr163305915e9.17.1745410179144; Wed, 23 Apr 2025 05:09:39 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-44092d2d558sm24277415e9.17.2025.04.23.05.09.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Apr 2025 05:09:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH] hw/gpio/pl061: Declare pullups/pulldowns as 8-bit types Date: Wed, 23 Apr 2025 14:09:37 +0200 Message-ID: <20250423120937.21490-1-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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=ham 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org uint8_t is good enough to hold a property "between 0 and 0xff". Define pullups/pulldowns properties using DEFINE_PROP_UINT8() macro, remove unnecessary range checks in pl061_realize(). Signed-off-by: Philippe Mathieu-Daudé --- hw/gpio/pl061.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c index 60ce4a7f628..25b7ae3eccc 100644 --- a/hw/gpio/pl061.c +++ b/hw/gpio/pl061.c @@ -79,8 +79,8 @@ struct PL061State { qemu_irq out[N_GPIOS]; const unsigned char *id; /* Properties, for non-Luminary PL061 */ - uint32_t pullups; - uint32_t pulldowns; + uint8_t pullups; + uint8_t pulldowns; }; static const VMStateDescription vmstate_pl061 = { @@ -548,14 +548,6 @@ static void pl061_realize(DeviceState *dev, Error **errp) { PL061State *s = PL061(dev); - if (s->pullups > 0xff) { - error_setg(errp, "pullups property must be between 0 and 0xff"); - return; - } - if (s->pulldowns > 0xff) { - error_setg(errp, "pulldowns property must be between 0 and 0xff"); - return; - } if (s->pullups & s->pulldowns) { error_setg(errp, "no bit may be set both in pullups and pulldowns"); return; @@ -563,8 +555,8 @@ static void pl061_realize(DeviceState *dev, Error **errp) } static const Property pl061_props[] = { - DEFINE_PROP_UINT32("pullups", PL061State, pullups, 0xff), - DEFINE_PROP_UINT32("pulldowns", PL061State, pulldowns, 0x0), + DEFINE_PROP_UINT8("pullups", PL061State, pullups, 0xff), + DEFINE_PROP_UINT8("pulldowns", PL061State, pulldowns, 0x0), }; static void pl061_class_init(ObjectClass *klass, void *data)