From nobody Fri May 9 21:06:02 2025 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1675419265; cv=none; d=zohomail.com; s=zohoarc; b=izK2ZSjtXYEHlh8G2WVotySVtQ22DcSCtbqli23onP2nnrhSDD83MLuePsNZK4DRmHmsE0vaBwQMk2trVbCPT9X2m2jucPrpJkNsPvHta+UPc7I2y5f94GU4ZEKId2+47ag3kRwiHGQFUGVx/itoYHpdHRTW5aYmmvONb1QYPug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675419265; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tYOm6U1mrpjpeze33/MXi3JiNC/zlctq5Oro7JtmJks=; b=kNOEzubpSIYSinsSY/unDB5Ps25QW2TjJCKRAR21/mRjiS+e4DSCN0WMogVAo458fxP/THZD4DJ83klL+rrjnxVA+rmhx85dCqE9+cCJXoCX+cAfRGjpSTA74a9L3eNCHf86tMwu5Zyr5mroT3QXCBC/w3xpNQsnbxP/xz6RigE= 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+importer2=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 1675419265160298.74146596201365; Fri, 3 Feb 2023 02:14:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNt44-0008QU-5R; Fri, 03 Feb 2023 05:13:04 -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 1pNt3p-0008N2-RE for qemu-devel@nongnu.org; Fri, 03 Feb 2023 05:12:50 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNt3o-0002I0-BW for qemu-devel@nongnu.org; Fri, 03 Feb 2023 05:12:49 -0500 Received: by mail-wr1-x42b.google.com with SMTP id q5so4218244wrv.0 for ; Fri, 03 Feb 2023 02:12:47 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id m2-20020a056000008200b002bfb7c2430bsm1634964wrx.19.2023.02.03.02.12.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 02:12:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tYOm6U1mrpjpeze33/MXi3JiNC/zlctq5Oro7JtmJks=; b=yBju/Ft8sFCHC+DJwCACGjj0Or9yAr/a5cn+g6lRhQM7ORDKhIegCbqjxj+zQOvYSe HLnc64zgZNM/c7CgI99RtIiLOcWTIX1TdvAX3n0Ck4YDd9gXazqkFB/b6NmBlG7CoMcN CPvYFj6Kc/3rNjgWJ38JSfrbSQA1tewpldAm6bqGNOO2OusqTsO4aq3dilClwYMlhctD qwpMRhHUaYAAEHDlNiT4v1PTryOZ+91ayPmpOSUjoTR0zfcBH3Usp9OujPwOaXjhp4Ua ShTu4cSiJW4CaTe/J9RmgmL7ybSLxW2JkP+MOazcH2b76c6DJRriYbi16LxsPzhEOpSJ 0WlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tYOm6U1mrpjpeze33/MXi3JiNC/zlctq5Oro7JtmJks=; b=Pxf8+XbPJkiW3R6fYOcUgzPMMC/Z/1oFTQw2vv1uumrHI3+FqB2sTloTJR7rZBBjzw cxYvQ3v9cM2ZJnFt4abRvomlDpPI6WyI2hWIwYip0lkgTatson47vrr1KkqDCpnKN9sL kmYV1Z2fDlAhiyPGMk3hGMrasfyqV98VBDo1NVJM68nsY3Gxnvcz4Zv80VHlQxVK2gHs HfAUHgu8Y1QRP3ZQpAIouFBU1/mx0hL73TCTPenKeyBqiX3g5LwE1WFY0lV1QuGSsKYb lRV4UkTdnw0aZGq/eNalQSlDM4a7Le51+yH3dscXjYhqnBsFTQGRcjyCNydICkF8sn7b VsFQ== X-Gm-Message-State: AO0yUKWhTWS9F81rhzjVVWRxyEnkZTmA0STvIsZTVI3q+72rr5tfOK5H Vjx3w27iVPDUrVCxZ1M79El1hr7TlJBr9A8Y X-Google-Smtp-Source: AK7set9HP2Rn2kSZdil907vjUWWofCvii/39NKh7sRQR+lLfAqYJ+aJU9viqbaZESELF8egPLHXegA== X-Received: by 2002:a5d:6d46:0:b0:2bf:bac7:30d4 with SMTP id k6-20020a5d6d46000000b002bfbac730d4mr8440644wri.53.1675419166611; Fri, 03 Feb 2023 02:12:46 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , qemu-trivial@nongnu.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 4/4] hw/qdev-properties: Constify DeviceClass::props_ field Date: Fri, 3 Feb 2023 11:12:24 +0100 Message-Id: <20230203101224.25796-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203101224.25796-1-philmd@linaro.org> References: <20230203101224.25796-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1675419267099100003 The pointed Property structure is accessed read-only. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/qdev-properties.c | 10 +++++----- include/hw/qdev-core.h | 2 +- softmmu/qdev-monitor.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index baf9a91b29..9789a2f5de 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -640,7 +640,7 @@ const PropertyInfo qdev_prop_arraylen =3D { =20 /* --- public helpers --- */ =20 -static Property *qdev_prop_walk(Property *props, const char *name) +static const Property *qdev_prop_walk(const Property *props, const char *n= ame) { if (!props) { return NULL; @@ -654,10 +654,10 @@ static Property *qdev_prop_walk(Property *props, cons= t char *name) return NULL; } =20 -static Property *qdev_prop_find(DeviceState *dev, const char *name) +static const Property *qdev_prop_find(DeviceState *dev, const char *name) { ObjectClass *class; - Property *prop; + const Property *prop; =20 /* device properties */ class =3D object_get_class(OBJECT(dev)); @@ -731,7 +731,7 @@ void qdev_prop_set_string(DeviceState *dev, const char = *name, const char *value) =20 void qdev_prop_set_enum(DeviceState *dev, const char *name, int value) { - Property *prop; + const Property *prop; =20 prop =3D qdev_prop_find(dev, name); object_property_set_str(OBJECT(dev), name, @@ -959,7 +959,7 @@ void device_class_set_props(DeviceClass *dc, Property *= props) void qdev_alias_all_properties(DeviceState *target, Object *source) { ObjectClass *class; - Property *prop; + const Property *prop; =20 class =3D object_get_class(OBJECT(target)); do { diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 35fddb19a6..fd11e9a82f 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -108,7 +108,7 @@ struct DeviceClass { * The underscore at the end ensures a compile-time error if someone * assigns to dc->props instead of using device_class_set_props. */ - Property *props_; + const Property *props_; =20 /* * Can this device be instantiated with -device / device_add? diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 4b0ef65780..f47de51f95 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -741,8 +741,8 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **er= rp) #define qdev_printf(fmt, ...) monitor_printf(mon, "%*s" fmt, indent, "", #= # __VA_ARGS__) static void qbus_print(Monitor *mon, BusState *bus, int indent); =20 -static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *pro= ps, - int indent) +static void qdev_print_props(Monitor *mon, DeviceState *dev, + const Property *props, int indent) { if (!props) return; --=20 2.38.1