From patchwork Sun Feb 12 22:51:27 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: 652833 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2124232wrr; Sun, 12 Feb 2023 14:52:26 -0800 (PST) X-Google-Smtp-Source: AK7set8UUsaXCfjt9yqSZPF87zkoZEymo/dha6mnhqdG4gVYwmiZCha3xo4zhU7/HW0fGfILPIAm X-Received: by 2002:a05:622a:13c7:b0:3b9:bf83:d5de with SMTP id p7-20020a05622a13c700b003b9bf83d5demr38611527qtk.26.1676242346480; Sun, 12 Feb 2023 14:52:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676242346; cv=none; d=google.com; s=arc-20160816; b=Vv8dqlqJe8yT78AJVlRnBHDJMVkbx0CNUqXN7qWXQOr3ju91jSSXrKoN/rRaJ55ogX UrAW+JaeEAVD3fag1H/VR8viqh3vgzrOCJmZjy6UzHBPUcaToEZC4Y3d38Gtob4j/r4Y 0NWZUrnKPGB58icm41ou0nVYvWQF83ov52wgIKJw9bV4C0+eTUflS5/wCgQOwX+11kqu tdsxNcplqKWCVZHdpsggmLcpQg8DXOuTYQwW37V5Ctj72Kli2oYg8WVgqPzmh60OJ5Zf hlrscPcrf2ssCJMs/DhYM3Sbx5wEi1kmpqpgMfhzMUpfMGFtAt3KDZX9S3E9+tJs5it8 AIpQ== 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=bCKsG+zAhxcHVZqRjxu5bX66tFE5AAPeqF+8xmSD/dgn0fnTTlWlb/Cc81RL3n0wuj RDLiwDr081reeV+ctkVSBge3DBeYKqSKT1W3dIVXUvJtakiWOB3WeDiosDy1tp6G3jzo XsnW35PCDMLGSVluq76oX7wSmh/O9PSrduacFieKPIOhJ8wiaw5mnRACdc57gbsv4BYy EWn9VgDPoiqt6jOL0R4ZPvG3uM0XSXMzHdprAMketzw1xbLZKXDgj7oVDyHr0KYHWdVZ hx768R0d/8048fXIjlTZfa0rlYla5Yqb3eW1qb/Mp/kccMZo9VtK8S4G06yLFlZisRAt x3cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BlBwTqLx; 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 h6-20020ac85e06000000b003b86032fd35si7759952qtx.729.2023.02.12.14.52.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 14:52:26 -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=BlBwTqLx; 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 1pRLCV-0005Ex-Pj; Sun, 12 Feb 2023 17:52:03 -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 1pRLCU-0005Cb-01 for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:02 -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 1pRLCS-0003zc-7V for qemu-devel@nongnu.org; Sun, 12 Feb 2023 17:52:01 -0500 Received: by mail-wm1-x32d.google.com with SMTP id n33so1533050wms.0 for ; Sun, 12 Feb 2023 14:51:59 -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=BlBwTqLx9F4kMNcRo/5xW0t5FTChw/vNb1Xn1+VeP2/EDIkMbxpndLDQw+znGM1/Jx A1fCjgjvlUm/caIA9/ZiuxCdgzea5HgPbcmbFCI3dyEO/BwSLaA3GzByzcVaa9yHzPCs H32gCrbrCi+6yhggpfnHNNj41J3TafwTp5b8yf9Z5Z2CjUMkvN93ArYx6oN62OIhccr6 QzoTHDesj/Sdm9lZZvKxSNX0xpOz52m44NHh4m3X8LESCu8zbrkD91K9KtWmJ+H30NXi 5hYIzPQKPQZbiQ7rI4ae/bS90QT1b7ugNRY+8muEzrthZm/OIjTOjXkV0MjNyEx40IRy R/Ew== 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=Fu1WHgo/3x1Zc5NGL3en7/JMxNSs0un2ewoJHFvGxoAYk8ROzu8hwCyXQFFkQNdenf zrI1124NDzutlt809TPGEZA21pGGAEW6QrO4xHWBeg+2f5e6+PwlAP5d22zgA91GASag iBsHlvM42tAGQH5d5MVOUhk41D2R/OOZlsqFdqf56GWi6OZrcExkvu7k0nn3Ey1tGxDj /8FJfFNY+Dnt41hIGFbjxd8SFQvqD/VzJTl0omdcLfTvd/xMVyUAJ3Sp4QKVp6LZ/U5I HXiahZcPbUhQFqQaaA44dJCNeOPDW5DyOQwPBU8IiYPDag2yI33JnedvqEsfpRMkymxD jOxQ== X-Gm-Message-State: AO0yUKXlXoG950pzGIhVSbbdVZZPbt9ErFaRfmhoMwZpgTAEMO+5odDF SM3czPXR3v0NPFbwnGP3yvusMQ== X-Received: by 2002:a05:600c:180f:b0:3dc:557f:6126 with SMTP id n15-20020a05600c180f00b003dc557f6126mr21436610wmp.4.1676242319052; Sun, 12 Feb 2023 14:51:59 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id p6-20020a05600c468600b003dc36981727sm16613013wmo.14.2023.02.12.14.51.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 14:51:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Richard Henderson , xiaoqiang zhao , Hu Tao , Thomas Huth , qemu-block@nongnu.org, qemu-s390x@nongnu.org, Gonglei Arei , Cao jin , Li Qiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH 02/19] hw/char/serial-pci-multi: Batch register types using DEFINE_TYPES macro Date: Sun, 12 Feb 2023 23:51:27 +0100 Message-Id: <20230212225144.58660-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230212225144.58660-1-philmd@linaro.org> References: <20230212225144.58660-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@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=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 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)