From patchwork Wed Feb 12 21:32:45 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: 864491 Delivered-To: patch@linaro.org Received: by 2002:a5d:47a6:0:b0:38f:210b:807b with SMTP id 6csp138119wrb; Wed, 12 Feb 2025 13:35:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVyIuL0/LLboEnczDPTOsHNF6MjijsKxVLef1btVy/y2OvKQ9o76zI5rRIrtfw5S4Q/WOdY4A==@linaro.org X-Google-Smtp-Source: AGHT+IHn7Ctk/h9c8Wgb2E+ym0Jkmr1CoiUcSBzDiC1jOWMhRAMFi8gYxsBMpS46SqntNXasNE6V X-Received: by 2002:a05:620a:3c92:b0:7c0:7a75:4fc8 with SMTP id af79cd13be357-7c07a75526cmr81933585a.24.1739396139927; Wed, 12 Feb 2025 13:35:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739396139; cv=none; d=google.com; s=arc-20240605; b=EoLkgRCdq1exBTElXzSmb7JmrC4zsbb4JCiHgHnzqGtu30ShSvDMR6+yuyKRYDUFQw i3fq/27DJ46+A1mDjqvADy491N1vRE6EKeg2t/tQSpGhVsPkm8cDe/iuL2Uu6CL9bFW3 u0AT3m1ZJdjHQerX55Iw8hH8bZcpnzF3FLJb0UptTMsaqw7NaQDGrDYrUHEjkdao909+ mZnRnwnaH/psxihBbzIp9O4+atD+wQhLBO4Uh32KQldLuuZuZA4hvyJWozZM2MO2A++l QDk2pI+9G2iwid+ep/7kiy6VLb+gBGAuQbxqMviZw5A2Y8eUcD3FybQHw6d4GucJU8Th nfbQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HwHmoUxqvyoHDNzHHszg1KhqHnkiNXqZBs1FtjR02c8=; fh=fz3DJMUXEzejNv0JWYQ+xa02BmrDN+/I7HIv5ot61VY=; b=GVgRq9UBFtwFwl/EXKYJRCCyDzXjrV9wJfOEnUIx7WAtqPc46veNQAvtmZEOvD+d3n sKrWwQfODH+lkivdOCUiGpc/XukaGqOR3N87bFL6rfcTzT/DouIMWh3LKhujUfcPAkiB CXWzl39SZy0/288HEMLeiWXGc+UWS8Io87Q+gRnaSUPFhTNEUfsNOQOh0Vzx3wtExJk0 qpm/F+L/X+BKSUaESKv8mlUodGfpLxJN/KM5gqup7tkczfk+C2M6XqhraLahL9TEDyXz v+QRp+cGC9f0ao54mwCHz4vpYWDoIAweyCxKb75UUBROVX2kiIly5KZWetaW6yQy761J fTJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aTSccO4P; 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 af79cd13be357-7c07a0b2a4asi58894585a.469.2025.02.12.13.35.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Feb 2025 13:35:39 -0800 (PST) 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=aTSccO4P; 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 1tiKNA-0004ZJ-9d; Wed, 12 Feb 2025 16:34:20 -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 1tiKN4-000408-2l for qemu-devel@nongnu.org; Wed, 12 Feb 2025 16:34:14 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tiKN1-0000Yj-U8 for qemu-devel@nongnu.org; Wed, 12 Feb 2025 16:34:13 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-38a8b17d7a7so74831f8f.2 for ; Wed, 12 Feb 2025 13:34:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1739396050; x=1740000850; darn=nongnu.org; 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=HwHmoUxqvyoHDNzHHszg1KhqHnkiNXqZBs1FtjR02c8=; b=aTSccO4POZTmRx+LI2CmRyReR0hXojkvJPaIGETRxZARI9Mc2OaxfGpnfSxqLVwzyZ 4fGPce24IAcM7w2Mfe03BVRzwsdnbZU68aZMT29xM21cxerFBhYd3whubC5qdkA22E08 cDCjVCJU5aNJE6CGdkdSah1rHga4GhR5eM9LjQAX9JgdBlOeZDunbCaIk843FvcNFx3u hKSnW0DgF0PZGzXro1RgV7WrHmOHyzUg7C50HlgvpjE+5rXD7bZ1ZLPTUeCS/7P6L4Hm b0INrLqEEtdc3fmOcuqDkulTzmpMWzxAbW02dcPR4Gj2hqDU8q6HkDegEvAwzZiUw24s FldA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739396050; x=1740000850; 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=HwHmoUxqvyoHDNzHHszg1KhqHnkiNXqZBs1FtjR02c8=; b=UzbiiQKmflJPCxC5zHvQNqdWYBA0ZHWo6l6e/yoweGusHBJ6KyBu16g1on7ULGJxEX /MhsNqMhfuK/G28SGjiP2p4KVGlJWt8uKNZSzMvPGefBKgSQu+QoiQ5NQjiWX9nefl09 x3V6FTLh0u3D4nU1ILFhMGJ11rpzbqeusm4LFCztHUfzEn3SkmJEQC6DsqwL2gXqoaji 2Wvlj9sDb13zPPGwzGBDoqK80cS7fVLUOWfbkgcYdj73/aNn/GmxM4AGlvg3f+f7KXkS LZksvegyflK4HWPcho7Dhow8o69nP1LYgO7eo5QRjnzqw8NJqe2LMJ3dvUPpc7P5ATSZ bZIQ== X-Gm-Message-State: AOJu0YwPH9y05T/kRsya5NK/GSiIAMCjbPrVqe44nDpWEqpqerv/nZJV PSiE4uWXPnlc2E5CARRye5xZqQ65MfSX2s1w56tvp+7zf4crFFcemu3QiUlwZoo6n9+fqgEK8eo NEKQ= X-Gm-Gg: ASbGncutLw+jzuOEfOWynrrEQVxCEThmL2uJKSI+ijwj5UwwFcuiyTgNha41NRwfTJl M1oEzNULxofTRPNsLnCsi2HIyqBHFSIU6moyVxZX+vbCagaDg5uYsVHiI468HWnPc3KetS2WyIu mqm4F0fJEdatgv1PovKoSgyVy1qyZBre4IttQRyR86TNPA51/sv70mZfXd0HSmdOvtm9/Zw30XH TfbJITWTMlhVcL1B7qLxJIYZVR0zIyOMk9JPvCsOUJamYB3wsbuLk+PZmLECC55JMEm1nd44YS6 s3bgJ42A/z6KB1doJGqTXgTt4Mspg2eJrZ2TB4JyaTI5ppoBpH5/4GFJy1FPaGwdVQ== X-Received: by 2002:adf:e60e:0:b0:38b:f4dc:4483 with SMTP id ffacd0b85a97d-38dea28c1e0mr3422437f8f.29.1739396049853; Wed, 12 Feb 2025 13:34:09 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258b4491sm49523f8f.7.2025.02.12.13.34.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Feb 2025 13:34:09 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH v3 15/19] hw/virtio/virtio-pci: Constify base_type_info Date: Wed, 12 Feb 2025 22:32:45 +0100 Message-ID: <20250212213249.45574-16-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250212213249.45574-1-philmd@linaro.org> References: <20250212213249.45574-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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 Signed-off-by: Philippe Mathieu-Daudé --- hw/virtio/virtio-pci.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 9512590c936..a33d1b2cbcf 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -2475,13 +2475,16 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t) g_autofree char *base_name = single_generic_device ? g_strconcat(t->generic_name, "-base-type", NULL) : NULL; - TypeInfo base_type_info = { + const TypeInfo base_type_info = { .name = t->base_name ?: base_name, .parent = t->parent ? t->parent : TYPE_VIRTIO_PCI, .instance_size = t->instance_size, .instance_init = t->instance_init, .instance_finalize = t->instance_finalize, .class_size = t->class_size, + .class_init = t->base_name ? virtio_pci_base_class_init + : virtio_pci_generic_class_init, + .class_data = t->base_name ? t : NULL, .abstract = true, .interfaces = t->interfaces, }; @@ -2499,18 +2502,14 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t) assert(t->base_name || !t->non_transitional_name); assert(t->base_name || !t->transitional_name); - if (!t->base_name) { - base_type_info.class_init = virtio_pci_generic_class_init; + type_register_static(&base_type_info); + if (!t->base_name) { generic_type_info.parent = base_name; generic_type_info.class_init = virtio_pci_base_class_init; generic_type_info.class_data = t; - } else { - base_type_info.class_init = virtio_pci_base_class_init; - base_type_info.class_data = t; } - type_register_static(&base_type_info); if (generic_type_info.name) { type_register_static(&generic_type_info); }