From patchwork Mon Feb 13 18:43:26 2023 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: 653210 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2581018wrr; Mon, 13 Feb 2023 10:45:33 -0800 (PST) X-Google-Smtp-Source: AK7set/RPs7L28b36U8mEgs+SVNoDLdqvwFi4zfmWgtsOorXm3Btf2UDhtEzEAQul6jVWXIlE0D/ X-Received: by 2002:a05:6214:628:b0:56e:b96c:2e03 with SMTP id a8-20020a056214062800b0056eb96c2e03mr4481645qvx.25.1676313933261; Mon, 13 Feb 2023 10:45:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313933; cv=none; d=google.com; s=arc-20160816; b=WODIraDD9pRw/JL9S+a/YYzK8eb0oujrGbqMPWdJPtK09iXVecqH3JRFNu1HVsTfmf 0m5Ew49qXqNnAGjgJHDZ3gcB3U887RriNYmtbzoXjUG+hXRwURqSbg0PFBvB7MJokTV5 pKPLKSccU5ewtrV7YzGiQ7BZlhdcHM6HVx0rblWMu9XHT3pLrfQ267diKq6qL2nG5ih6 BNQW4yGfhZkEABpySjpBTtm9/LGuZDf8bEVORgwrIi6JK36FCO3DQZDKmHlxZk/SVffT +HSkOtXik2/8PQV76cNUfEZWEM3/bmjFlPX6Vl80ed9W0N0jI1yaAHWu8dQsXjwXNbsf Gcpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=ulscqISeuXFVKhRvIQFcVCrQtq+6Qiugdy4IK8EnRpwFOLjNwTV4+Q/AH0ZwEaErDH UZR57olMRFqy/5E/cy7OanFV13PHIqo4AvIo4inMmzhOfh/hRwY03joxM1ZMLHVfyJiM lr/0q/V21wr0wHVTh1YbxsHrf0yufgDaRi5jM8WGZy3Xjm2UX0VWOeTx5rRJKLfx5d5M EzW8DEwgFqLUxK2o3LoaCmuFzTP50tU7IJJWLXN4sUdj/KFXtRfGQOwHiOzj6uPz5Tf/ Arv2EiDFLke/jiDSWrv3Wh/sCX8hTMYrw8vahLGldOf8OfLmBwprLwrYJNo9M4r3QICC 7eHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hxWM/Hal"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b20-20020a0cc994000000b0056eb58eedb6si2015493qvk.499.2023.02.13.10.45.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:45:33 -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="hxWM/Hal"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdo8-0000xo-NW; Mon, 13 Feb 2023 13:44:08 -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 1pRdnv-0000sJ-2R for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:43:56 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdnt-0008OX-9t for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:43:54 -0500 Received: by mail-wm1-x331.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso11991136wms.0 for ; Mon, 13 Feb 2023 10:43:52 -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=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=hxWM/HalDBWkWTKXW8PAyZ7JCyWlypLHbOkZE+hvCtdPG3AH3ab/kBkDGMzf3r5GIB EUJMistvc/Fd7tiDDmng0a2+iab8eed8zx7PvJNIchVZbcj40U246C+ypoY+8dR6TKdP Vc3rvmvfvvqtNJk/2yAbdEOjYss4cSOhg0bpvb0dBrUfW3hT3WpunMxoqICJc+P7x1+B 2AGnXITbPFx4UD1fQ/w770OGmRYY/7QWwYDQqaOIk2vOY4Rb08hZzc43+pNftyJ4zd17 ZMLmVI12hfYgwWZCvRUoHGlAl1d0lMB5TU+bNA2QS39bxPLMI2aVr86Bx0hptSo8m1Xe ihZw== 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=iJ+QRHFZYIqXqYbl7DIdWxHc+GN5ZGRCj3hAlbpC3f0=; b=lno/aEKqjIzwuw82sqFgT+zs+HPiC3EJrXRgMhh9gQKC8Y1dKn03WddAhLM6hKULR7 m0QM0lweJ6TEcDY1Q7QdUhxn/ZuGvG5TYAnGvYnnRp6CPgyaeCqqpOVRqz4haLYU0htH N/VKwoKSY3mKQ81qE/MOa01IvEOimnEepmXw53xlDumAcmjTjCEbgosNZA4XJkSCSAq0 d3A6Y7etzWIy2o1iQa1xJvb+ZjJ+0O6wkakRoOrZOuWZpkYX/zdW8Ufv942u6NMkPB/6 jOddXy0WxXUAMzGlVsiMtB6m+r2BGHi8JBGKNHHfPAT4OwuM/frakRhuHFJBoyLXfNtP 4J3A== X-Gm-Message-State: AO0yUKWcPx/Q1tOXA8Uv0cz0zZcA7rpz5DSH35tBlyhmFsoRG7asPZhB OB3m+ZG7DE93T47vRAyGtaVMD6VLpkr2qjIE X-Received: by 2002:a05:600c:4b1c:b0:3df:eb5d:c583 with SMTP id i28-20020a05600c4b1c00b003dfeb5dc583mr19498820wmp.17.1676313831607; Mon, 13 Feb 2023 10:43:51 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id k21-20020a05600c1c9500b003e01493b136sm18406084wms.43.2023.02.13.10.43.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:43:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 02/14] hw/char/serial-pci-multi: Batch register types using DEFINE_TYPES macro Date: Mon, 13 Feb 2023 19:43:26 +0100 Message-Id: <20230213184338.46712-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org See rationale in commit 38b5d79b2e ("qom: add helper macro DEFINE_TYPES()"). Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci-multi.c | 52 +++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index f18b8dcce5..54768d3d53 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -189,34 +189,28 @@ static void multi_serial_init(Object *o) } } -static const TypeInfo multi_2x_serial_pci_info = { - .name = "pci-serial-2x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_2x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, +static const TypeInfo multi_serial_pci_types[] = { + { + .name = "pci-serial-2x", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .class_init = multi_2x_serial_pci_class_initfn, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, + }, { + .name = "pci-serial-4x", + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .class_init = multi_4x_serial_pci_class_initfn, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, + } }; -static const TypeInfo multi_4x_serial_pci_info = { - .name = "pci-serial-4x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_4x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, -}; - -static void multi_serial_pci_register_types(void) -{ - type_register_static(&multi_2x_serial_pci_info); - type_register_static(&multi_4x_serial_pci_info); -} - -type_init(multi_serial_pci_register_types) +DEFINE_TYPES(multi_serial_pci_types)