From patchwork Thu Aug 13 22:25:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84158C433DF for ; Thu, 13 Aug 2020 22:28:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D3BC20774 for ; Thu, 13 Aug 2020 22:28:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ehwlnEDn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D3BC20774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LhZ-0006gp-GJ for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:28:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgE-0004v6-TK for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:38 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33907 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgD-0002oz-9L for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c5qYDEuoNuf0oxYLBQG02SsZD1TRyWbDkkMKMfuQkGM=; b=ehwlnEDn4GE5PzfmB+QQtqzliJOMSMSp/hnStaSaH49Q4pT7miZ4rieva4I7zn1Enc0Z/I GzYyJJ2kuIVuxbdfweebcyUsn8PftjgoOH7dBJWLWrQxnoeYGaEwkY9Pj7ggVu/8aqbGPz gzOfLUPhumy784wEdrJMCbDdc64jP8o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-549-nuJyvq7dPkCScIMIpN5HgQ-1; Thu, 13 Aug 2020 18:26:34 -0400 X-MC-Unique: nuJyvq7dPkCScIMIpN5HgQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC2B5801AC3 for ; Thu, 13 Aug 2020 22:26:33 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8348E70920; Thu, 13 Aug 2020 22:26:33 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 05/41] aspeed_timer: Fix ASPEED_TIMER macro definition Date: Thu, 13 Aug 2020 18:25:49 -0400 Message-Id: <20200813222625.243136-6-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The macro definition had an extra semicolon. This was never noticed because the macro was only being used where it didn't make a difference. Signed-off-by: Eduardo Habkost --- include/hw/timer/aspeed_timer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/timer/aspeed_timer.h b/include/hw/timer/aspeed_timer.h index 948329893c..d7c7d8ad28 100644 --- a/include/hw/timer/aspeed_timer.h +++ b/include/hw/timer/aspeed_timer.h @@ -26,7 +26,7 @@ #include "hw/misc/aspeed_scu.h" #define ASPEED_TIMER(obj) \ - OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER); + OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER) #define TYPE_ASPEED_TIMER "aspeed.timer" #define TYPE_ASPEED_2400_TIMER TYPE_ASPEED_TIMER "-ast2400" #define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500" From patchwork Thu Aug 13 22:25:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07B1FC433DF for ; Thu, 13 Aug 2020 22:32:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6C76207DA for ; Thu, 13 Aug 2020 22:32:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Lmcs/YX2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6C76207DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Lli-0005Lt-Tw for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:32:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgK-00053t-Dy for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:44 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:32377 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgH-0002qY-4O for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kiwWN8mOvmiBiIEiDOUofxiW+e4f0M4TCf5kWQUuNnk=; b=Lmcs/YX2fLd1quAyVj0zWxtwV93vZlL1gaX4bazV3nM+MctBBOPf4k+kJ3k+7RVBsPf53T vTGv7sMdsmdc7WDYzYWAZ8F/Y6RoNUO4xPE98lWZx9vdA+hDujSyGwY152tp3QUlSI9UQW 6uPNAibvO5tlSaezYhnzTZo1znShIFw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-ElB6peieNoSeykuaxS8Bww-1; Thu, 13 Aug 2020 18:26:36 -0400 X-MC-Unique: ElB6peieNoSeykuaxS8Bww-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AF8E1019627 for ; Thu, 13 Aug 2020 22:26:36 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95BD15D9D2; Thu, 13 Aug 2020 22:26:35 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 07/41] aspeed_soc: Rename memmap/irqmap enum constants Date: Thu, 13 Aug 2020 18:25:51 -0400 Message-Id: <20200813222625.243136-8-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Some of the enum constant names conflict with the QOM type check macros. This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE(). Rename all the constants to ASPEED_DEV_*, to avoid conflicts. Signed-off-by: Eduardo Habkost --- include/hw/arm/aspeed_soc.h | 92 +++++++-------- hw/arm/aspeed.c | 4 +- hw/arm/aspeed_ast2600.c | 208 ++++++++++++++++---------------- hw/arm/aspeed_soc.c | 228 ++++++++++++++++++------------------ 4 files changed, 266 insertions(+), 266 deletions(-) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 914115f3ef..d46f197cbe 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -87,52 +87,52 @@ typedef struct AspeedSoCClass { OBJECT_GET_CLASS(AspeedSoCClass, (obj), TYPE_ASPEED_SOC) enum { - ASPEED_IOMEM, - ASPEED_UART1, - ASPEED_UART2, - ASPEED_UART3, - ASPEED_UART4, - ASPEED_UART5, - ASPEED_VUART, - ASPEED_FMC, - ASPEED_SPI1, - ASPEED_SPI2, - ASPEED_EHCI1, - ASPEED_EHCI2, - ASPEED_VIC, - ASPEED_SDMC, - ASPEED_SCU, - ASPEED_ADC, - ASPEED_VIDEO, - ASPEED_SRAM, - ASPEED_SDHCI, - ASPEED_GPIO, - ASPEED_GPIO_1_8V, - ASPEED_RTC, - ASPEED_TIMER1, - ASPEED_TIMER2, - ASPEED_TIMER3, - ASPEED_TIMER4, - ASPEED_TIMER5, - ASPEED_TIMER6, - ASPEED_TIMER7, - ASPEED_TIMER8, - ASPEED_WDT, - ASPEED_PWM, - ASPEED_LPC, - ASPEED_IBT, - ASPEED_I2C, - ASPEED_ETH1, - ASPEED_ETH2, - ASPEED_ETH3, - ASPEED_ETH4, - ASPEED_MII1, - ASPEED_MII2, - ASPEED_MII3, - ASPEED_MII4, - ASPEED_SDRAM, - ASPEED_XDMA, - ASPEED_EMMC, + ASPEED_DEV_IOMEM, + ASPEED_DEV_UART1, + ASPEED_DEV_UART2, + ASPEED_DEV_UART3, + ASPEED_DEV_UART4, + ASPEED_DEV_UART5, + ASPEED_DEV_VUART, + ASPEED_DEV_FMC, + ASPEED_DEV_SPI1, + ASPEED_DEV_SPI2, + ASPEED_DEV_EHCI1, + ASPEED_DEV_EHCI2, + ASPEED_DEV_VIC, + ASPEED_DEV_SDMC, + ASPEED_DEV_SCU, + ASPEED_DEV_ADC, + ASPEED_DEV_VIDEO, + ASPEED_DEV_SRAM, + ASPEED_DEV_SDHCI, + ASPEED_DEV_GPIO, + ASPEED_DEV_GPIO_1_8V, + ASPEED_DEV_RTC, + ASPEED_DEV_TIMER1, + ASPEED_DEV_TIMER2, + ASPEED_DEV_TIMER3, + ASPEED_DEV_TIMER4, + ASPEED_DEV_TIMER5, + ASPEED_DEV_TIMER6, + ASPEED_DEV_TIMER7, + ASPEED_DEV_TIMER8, + ASPEED_DEV_WDT, + ASPEED_DEV_PWM, + ASPEED_DEV_LPC, + ASPEED_DEV_IBT, + ASPEED_DEV_I2C, + ASPEED_DEV_ETH1, + ASPEED_DEV_ETH2, + ASPEED_DEV_ETH3, + ASPEED_DEV_ETH4, + ASPEED_DEV_MII1, + ASPEED_DEV_MII2, + ASPEED_DEV_MII3, + ASPEED_DEV_MII4, + ASPEED_DEV_SDRAM, + ASPEED_DEV_XDMA, + ASPEED_DEV_EMMC, }; #endif /* ASPEED_SOC_H */ diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index fcb1a7cd87..8109cc6d2d 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -309,7 +309,7 @@ static void aspeed_machine_init(MachineState *machine) qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort); memory_region_add_subregion(get_system_memory(), - sc->memmap[ASPEED_SDRAM], + sc->memmap[ASPEED_DEV_SDRAM], &bmc->ram_container); max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), "max-ram-size", @@ -360,7 +360,7 @@ static void aspeed_machine_init(MachineState *machine) } aspeed_board_binfo.ram_size = ram_size; - aspeed_board_binfo.loader_start = sc->memmap[ASPEED_SDRAM]; + aspeed_board_binfo.loader_start = sc->memmap[ASPEED_DEV_SDRAM]; aspeed_board_binfo.nb_cpus = sc->num_cpus; if (amc->i2c_init) { diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index 3767f7d8d0..9d95e42143 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -24,43 +24,43 @@ #define ASPEED_SOC_IOMEM_SIZE 0x00200000 static const hwaddr aspeed_soc_ast2600_memmap[] = { - [ASPEED_SRAM] = 0x10000000, + [ASPEED_DEV_SRAM] = 0x10000000, /* 0x16000000 0x17FFFFFF : AHB BUS do LPC Bus bridge */ - [ASPEED_IOMEM] = 0x1E600000, - [ASPEED_PWM] = 0x1E610000, - [ASPEED_FMC] = 0x1E620000, - [ASPEED_SPI1] = 0x1E630000, - [ASPEED_SPI2] = 0x1E641000, - [ASPEED_EHCI1] = 0x1E6A1000, - [ASPEED_EHCI2] = 0x1E6A3000, - [ASPEED_MII1] = 0x1E650000, - [ASPEED_MII2] = 0x1E650008, - [ASPEED_MII3] = 0x1E650010, - [ASPEED_MII4] = 0x1E650018, - [ASPEED_ETH1] = 0x1E660000, - [ASPEED_ETH3] = 0x1E670000, - [ASPEED_ETH2] = 0x1E680000, - [ASPEED_ETH4] = 0x1E690000, - [ASPEED_VIC] = 0x1E6C0000, - [ASPEED_SDMC] = 0x1E6E0000, - [ASPEED_SCU] = 0x1E6E2000, - [ASPEED_XDMA] = 0x1E6E7000, - [ASPEED_ADC] = 0x1E6E9000, - [ASPEED_VIDEO] = 0x1E700000, - [ASPEED_SDHCI] = 0x1E740000, - [ASPEED_EMMC] = 0x1E750000, - [ASPEED_GPIO] = 0x1E780000, - [ASPEED_GPIO_1_8V] = 0x1E780800, - [ASPEED_RTC] = 0x1E781000, - [ASPEED_TIMER1] = 0x1E782000, - [ASPEED_WDT] = 0x1E785000, - [ASPEED_LPC] = 0x1E789000, - [ASPEED_IBT] = 0x1E789140, - [ASPEED_I2C] = 0x1E78A000, - [ASPEED_UART1] = 0x1E783000, - [ASPEED_UART5] = 0x1E784000, - [ASPEED_VUART] = 0x1E787000, - [ASPEED_SDRAM] = 0x80000000, + [ASPEED_DEV_IOMEM] = 0x1E600000, + [ASPEED_DEV_PWM] = 0x1E610000, + [ASPEED_DEV_FMC] = 0x1E620000, + [ASPEED_DEV_SPI1] = 0x1E630000, + [ASPEED_DEV_SPI2] = 0x1E641000, + [ASPEED_DEV_EHCI1] = 0x1E6A1000, + [ASPEED_DEV_EHCI2] = 0x1E6A3000, + [ASPEED_DEV_MII1] = 0x1E650000, + [ASPEED_DEV_MII2] = 0x1E650008, + [ASPEED_DEV_MII3] = 0x1E650010, + [ASPEED_DEV_MII4] = 0x1E650018, + [ASPEED_DEV_ETH1] = 0x1E660000, + [ASPEED_DEV_ETH3] = 0x1E670000, + [ASPEED_DEV_ETH2] = 0x1E680000, + [ASPEED_DEV_ETH4] = 0x1E690000, + [ASPEED_DEV_VIC] = 0x1E6C0000, + [ASPEED_DEV_SDMC] = 0x1E6E0000, + [ASPEED_DEV_SCU] = 0x1E6E2000, + [ASPEED_DEV_XDMA] = 0x1E6E7000, + [ASPEED_DEV_ADC] = 0x1E6E9000, + [ASPEED_DEV_VIDEO] = 0x1E700000, + [ASPEED_DEV_SDHCI] = 0x1E740000, + [ASPEED_DEV_EMMC] = 0x1E750000, + [ASPEED_DEV_GPIO] = 0x1E780000, + [ASPEED_DEV_GPIO_1_8V] = 0x1E780800, + [ASPEED_DEV_RTC] = 0x1E781000, + [ASPEED_DEV_TIMER1] = 0x1E782000, + [ASPEED_DEV_WDT] = 0x1E785000, + [ASPEED_DEV_LPC] = 0x1E789000, + [ASPEED_DEV_IBT] = 0x1E789140, + [ASPEED_DEV_I2C] = 0x1E78A000, + [ASPEED_DEV_UART1] = 0x1E783000, + [ASPEED_DEV_UART5] = 0x1E784000, + [ASPEED_DEV_VUART] = 0x1E787000, + [ASPEED_DEV_SDRAM] = 0x80000000, }; #define ASPEED_A7MPCORE_ADDR 0x40460000 @@ -69,41 +69,41 @@ static const hwaddr aspeed_soc_ast2600_memmap[] = { /* Shared Peripheral Interrupt values below are offset by -32 from datasheet */ static const int aspeed_soc_ast2600_irqmap[] = { - [ASPEED_UART1] = 47, - [ASPEED_UART2] = 48, - [ASPEED_UART3] = 49, - [ASPEED_UART4] = 50, - [ASPEED_UART5] = 8, - [ASPEED_VUART] = 8, - [ASPEED_FMC] = 39, - [ASPEED_SDMC] = 0, - [ASPEED_SCU] = 12, - [ASPEED_ADC] = 78, - [ASPEED_XDMA] = 6, - [ASPEED_SDHCI] = 43, - [ASPEED_EHCI1] = 5, - [ASPEED_EHCI2] = 9, - [ASPEED_EMMC] = 15, - [ASPEED_GPIO] = 40, - [ASPEED_GPIO_1_8V] = 11, - [ASPEED_RTC] = 13, - [ASPEED_TIMER1] = 16, - [ASPEED_TIMER2] = 17, - [ASPEED_TIMER3] = 18, - [ASPEED_TIMER4] = 19, - [ASPEED_TIMER5] = 20, - [ASPEED_TIMER6] = 21, - [ASPEED_TIMER7] = 22, - [ASPEED_TIMER8] = 23, - [ASPEED_WDT] = 24, - [ASPEED_PWM] = 44, - [ASPEED_LPC] = 35, - [ASPEED_IBT] = 35, /* LPC */ - [ASPEED_I2C] = 110, /* 110 -> 125 */ - [ASPEED_ETH1] = 2, - [ASPEED_ETH2] = 3, - [ASPEED_ETH3] = 32, - [ASPEED_ETH4] = 33, + [ASPEED_DEV_UART1] = 47, + [ASPEED_DEV_UART2] = 48, + [ASPEED_DEV_UART3] = 49, + [ASPEED_DEV_UART4] = 50, + [ASPEED_DEV_UART5] = 8, + [ASPEED_DEV_VUART] = 8, + [ASPEED_DEV_FMC] = 39, + [ASPEED_DEV_SDMC] = 0, + [ASPEED_DEV_SCU] = 12, + [ASPEED_DEV_ADC] = 78, + [ASPEED_DEV_XDMA] = 6, + [ASPEED_DEV_SDHCI] = 43, + [ASPEED_DEV_EHCI1] = 5, + [ASPEED_DEV_EHCI2] = 9, + [ASPEED_DEV_EMMC] = 15, + [ASPEED_DEV_GPIO] = 40, + [ASPEED_DEV_GPIO_1_8V] = 11, + [ASPEED_DEV_RTC] = 13, + [ASPEED_DEV_TIMER1] = 16, + [ASPEED_DEV_TIMER2] = 17, + [ASPEED_DEV_TIMER3] = 18, + [ASPEED_DEV_TIMER4] = 19, + [ASPEED_DEV_TIMER5] = 20, + [ASPEED_DEV_TIMER6] = 21, + [ASPEED_DEV_TIMER7] = 22, + [ASPEED_DEV_TIMER8] = 23, + [ASPEED_DEV_WDT] = 24, + [ASPEED_DEV_PWM] = 44, + [ASPEED_DEV_LPC] = 35, + [ASPEED_DEV_IBT] = 35, /* LPC */ + [ASPEED_DEV_I2C] = 110, /* 110 -> 125 */ + [ASPEED_DEV_ETH1] = 2, + [ASPEED_DEV_ETH2] = 3, + [ASPEED_DEV_ETH3] = 32, + [ASPEED_DEV_ETH4] = 33, }; @@ -232,11 +232,11 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) qemu_irq irq; /* IO space */ - create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_IOMEM], + create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOMEM], ASPEED_SOC_IOMEM_SIZE); /* Video engine stub */ - create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_VIDEO], + create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDEO], 0x1000); /* CPU */ @@ -295,21 +295,21 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) return; } memory_region_add_subregion(get_system_memory(), - sc->memmap[ASPEED_SRAM], &s->sram); + sc->memmap[ASPEED_DEV_SRAM], &s->sram); /* SCU */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_SCU]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]); /* RTC */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->rtc), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->memmap[ASPEED_RTC]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->memmap[ASPEED_DEV_RTC]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, - aspeed_soc_get_irq(s, ASPEED_RTC)); + aspeed_soc_get_irq(s, ASPEED_DEV_RTC)); /* Timer */ object_property_set_link(OBJECT(&s->timerctrl), "scu", OBJECT(&s->scu), @@ -318,16 +318,16 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->timerctrl), 0, - sc->memmap[ASPEED_TIMER1]); + sc->memmap[ASPEED_DEV_TIMER1]); for (i = 0; i < ASPEED_TIMER_NR_TIMERS; i++) { - qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_TIMER1 + i); + qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_DEV_TIMER1 + i); sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq); } /* UART - attach an 8250 to the IO space as our UART5 */ if (serial_hd(0)) { - qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_UART5); - serial_mm_init(get_system_memory(), sc->memmap[ASPEED_UART5], 2, + qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_DEV_UART5); + serial_mm_init(get_system_memory(), sc->memmap[ASPEED_DEV_UART5], 2, uart5, 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN); } @@ -337,10 +337,10 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) if (!sysbus_realize(SYS_BUS_DEVICE(&s->i2c), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_I2C]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_DEV_I2C]); for (i = 0; i < ASPEED_I2C_GET_CLASS(&s->i2c)->num_busses; i++) { qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), - sc->irqmap[ASPEED_I2C] + i); + sc->irqmap[ASPEED_DEV_I2C] + i); /* * The AST2600 SoC has one IRQ per I2C bus. Skip the common * IRQ (AST2400 and AST2500) and connect all bussses. @@ -352,17 +352,17 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) object_property_set_link(OBJECT(&s->fmc), "dram", OBJECT(s->dram_mr), &error_abort); if (!object_property_set_int(OBJECT(&s->fmc), "sdram-base", - sc->memmap[ASPEED_SDRAM], errp)) { + sc->memmap[ASPEED_DEV_SDRAM], errp)) { return; } if (!sysbus_realize(SYS_BUS_DEVICE(&s->fmc), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_FMC]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_DEV_FMC]); sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 1, s->fmc.ctrl->flash_window_base); sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0, - aspeed_soc_get_irq(s, ASPEED_FMC)); + aspeed_soc_get_irq(s, ASPEED_DEV_FMC)); /* SPI */ for (i = 0; i < sc->spis_num; i++) { @@ -373,7 +373,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, - sc->memmap[ASPEED_SPI1 + i]); + sc->memmap[ASPEED_DEV_SPI1 + i]); sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 1, s->spi[i].ctrl->flash_window_base); } @@ -384,16 +384,16 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0, - sc->memmap[ASPEED_EHCI1 + i]); + sc->memmap[ASPEED_DEV_EHCI1 + i]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0, - aspeed_soc_get_irq(s, ASPEED_EHCI1 + i)); + aspeed_soc_get_irq(s, ASPEED_DEV_EHCI1 + i)); } /* SDMC - SDRAM Memory Controller */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdmc), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_SDMC]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_DEV_SDMC]); /* Watch dog */ for (i = 0; i < sc->wdts_num; i++) { @@ -405,7 +405,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, - sc->memmap[ASPEED_WDT] + i * awc->offset); + sc->memmap[ASPEED_DEV_WDT] + i * awc->offset); } /* Net */ @@ -416,9 +416,9 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0, - sc->memmap[ASPEED_ETH1 + i]); + sc->memmap[ASPEED_DEV_ETH1 + i]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0, - aspeed_soc_get_irq(s, ASPEED_ETH1 + i)); + aspeed_soc_get_irq(s, ASPEED_DEV_ETH1 + i)); object_property_set_link(OBJECT(&s->mii[i]), "nic", OBJECT(&s->ftgmac100[i]), &error_abort); @@ -427,7 +427,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) } sysbus_mmio_map(SYS_BUS_DEVICE(&s->mii[i]), 0, - sc->memmap[ASPEED_MII1 + i]); + sc->memmap[ASPEED_DEV_MII1 + i]); } /* XDMA */ @@ -435,42 +435,42 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->xdma), 0, - sc->memmap[ASPEED_XDMA]); + sc->memmap[ASPEED_DEV_XDMA]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->xdma), 0, - aspeed_soc_get_irq(s, ASPEED_XDMA)); + aspeed_soc_get_irq(s, ASPEED_DEV_XDMA)); /* GPIO */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->memmap[ASPEED_GPIO]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->memmap[ASPEED_DEV_GPIO]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0, - aspeed_soc_get_irq(s, ASPEED_GPIO)); + aspeed_soc_get_irq(s, ASPEED_DEV_GPIO)); if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio_1_8v), errp)) { return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio_1_8v), 0, - sc->memmap[ASPEED_GPIO_1_8V]); + sc->memmap[ASPEED_DEV_GPIO_1_8V]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio_1_8v), 0, - aspeed_soc_get_irq(s, ASPEED_GPIO_1_8V)); + aspeed_soc_get_irq(s, ASPEED_DEV_GPIO_1_8V)); /* SDHCI */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdhci), errp)) { return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdhci), 0, - sc->memmap[ASPEED_SDHCI]); + sc->memmap[ASPEED_DEV_SDHCI]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci), 0, - aspeed_soc_get_irq(s, ASPEED_SDHCI)); + aspeed_soc_get_irq(s, ASPEED_DEV_SDHCI)); /* eMMC */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->emmc), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->emmc), 0, sc->memmap[ASPEED_EMMC]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->emmc), 0, sc->memmap[ASPEED_DEV_EMMC]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->emmc), 0, - aspeed_soc_get_irq(s, ASPEED_EMMC)); + aspeed_soc_get_irq(s, ASPEED_DEV_EMMC)); } static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data) diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index a1a8684216..35be126db6 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -27,97 +27,97 @@ #define ASPEED_SOC_IOMEM_SIZE 0x00200000 static const hwaddr aspeed_soc_ast2400_memmap[] = { - [ASPEED_IOMEM] = 0x1E600000, - [ASPEED_FMC] = 0x1E620000, - [ASPEED_SPI1] = 0x1E630000, - [ASPEED_EHCI1] = 0x1E6A1000, - [ASPEED_VIC] = 0x1E6C0000, - [ASPEED_SDMC] = 0x1E6E0000, - [ASPEED_SCU] = 0x1E6E2000, - [ASPEED_XDMA] = 0x1E6E7000, - [ASPEED_VIDEO] = 0x1E700000, - [ASPEED_ADC] = 0x1E6E9000, - [ASPEED_SRAM] = 0x1E720000, - [ASPEED_SDHCI] = 0x1E740000, - [ASPEED_GPIO] = 0x1E780000, - [ASPEED_RTC] = 0x1E781000, - [ASPEED_TIMER1] = 0x1E782000, - [ASPEED_WDT] = 0x1E785000, - [ASPEED_PWM] = 0x1E786000, - [ASPEED_LPC] = 0x1E789000, - [ASPEED_IBT] = 0x1E789140, - [ASPEED_I2C] = 0x1E78A000, - [ASPEED_ETH1] = 0x1E660000, - [ASPEED_ETH2] = 0x1E680000, - [ASPEED_UART1] = 0x1E783000, - [ASPEED_UART5] = 0x1E784000, - [ASPEED_VUART] = 0x1E787000, - [ASPEED_SDRAM] = 0x40000000, + [ASPEED_DEV_IOMEM] = 0x1E600000, + [ASPEED_DEV_FMC] = 0x1E620000, + [ASPEED_DEV_SPI1] = 0x1E630000, + [ASPEED_DEV_EHCI1] = 0x1E6A1000, + [ASPEED_DEV_VIC] = 0x1E6C0000, + [ASPEED_DEV_SDMC] = 0x1E6E0000, + [ASPEED_DEV_SCU] = 0x1E6E2000, + [ASPEED_DEV_XDMA] = 0x1E6E7000, + [ASPEED_DEV_VIDEO] = 0x1E700000, + [ASPEED_DEV_ADC] = 0x1E6E9000, + [ASPEED_DEV_SRAM] = 0x1E720000, + [ASPEED_DEV_SDHCI] = 0x1E740000, + [ASPEED_DEV_GPIO] = 0x1E780000, + [ASPEED_DEV_RTC] = 0x1E781000, + [ASPEED_DEV_TIMER1] = 0x1E782000, + [ASPEED_DEV_WDT] = 0x1E785000, + [ASPEED_DEV_PWM] = 0x1E786000, + [ASPEED_DEV_LPC] = 0x1E789000, + [ASPEED_DEV_IBT] = 0x1E789140, + [ASPEED_DEV_I2C] = 0x1E78A000, + [ASPEED_DEV_ETH1] = 0x1E660000, + [ASPEED_DEV_ETH2] = 0x1E680000, + [ASPEED_DEV_UART1] = 0x1E783000, + [ASPEED_DEV_UART5] = 0x1E784000, + [ASPEED_DEV_VUART] = 0x1E787000, + [ASPEED_DEV_SDRAM] = 0x40000000, }; static const hwaddr aspeed_soc_ast2500_memmap[] = { - [ASPEED_IOMEM] = 0x1E600000, - [ASPEED_FMC] = 0x1E620000, - [ASPEED_SPI1] = 0x1E630000, - [ASPEED_SPI2] = 0x1E631000, - [ASPEED_EHCI1] = 0x1E6A1000, - [ASPEED_EHCI2] = 0x1E6A3000, - [ASPEED_VIC] = 0x1E6C0000, - [ASPEED_SDMC] = 0x1E6E0000, - [ASPEED_SCU] = 0x1E6E2000, - [ASPEED_XDMA] = 0x1E6E7000, - [ASPEED_ADC] = 0x1E6E9000, - [ASPEED_VIDEO] = 0x1E700000, - [ASPEED_SRAM] = 0x1E720000, - [ASPEED_SDHCI] = 0x1E740000, - [ASPEED_GPIO] = 0x1E780000, - [ASPEED_RTC] = 0x1E781000, - [ASPEED_TIMER1] = 0x1E782000, - [ASPEED_WDT] = 0x1E785000, - [ASPEED_PWM] = 0x1E786000, - [ASPEED_LPC] = 0x1E789000, - [ASPEED_IBT] = 0x1E789140, - [ASPEED_I2C] = 0x1E78A000, - [ASPEED_ETH1] = 0x1E660000, - [ASPEED_ETH2] = 0x1E680000, - [ASPEED_UART1] = 0x1E783000, - [ASPEED_UART5] = 0x1E784000, - [ASPEED_VUART] = 0x1E787000, - [ASPEED_SDRAM] = 0x80000000, + [ASPEED_DEV_IOMEM] = 0x1E600000, + [ASPEED_DEV_FMC] = 0x1E620000, + [ASPEED_DEV_SPI1] = 0x1E630000, + [ASPEED_DEV_SPI2] = 0x1E631000, + [ASPEED_DEV_EHCI1] = 0x1E6A1000, + [ASPEED_DEV_EHCI2] = 0x1E6A3000, + [ASPEED_DEV_VIC] = 0x1E6C0000, + [ASPEED_DEV_SDMC] = 0x1E6E0000, + [ASPEED_DEV_SCU] = 0x1E6E2000, + [ASPEED_DEV_XDMA] = 0x1E6E7000, + [ASPEED_DEV_ADC] = 0x1E6E9000, + [ASPEED_DEV_VIDEO] = 0x1E700000, + [ASPEED_DEV_SRAM] = 0x1E720000, + [ASPEED_DEV_SDHCI] = 0x1E740000, + [ASPEED_DEV_GPIO] = 0x1E780000, + [ASPEED_DEV_RTC] = 0x1E781000, + [ASPEED_DEV_TIMER1] = 0x1E782000, + [ASPEED_DEV_WDT] = 0x1E785000, + [ASPEED_DEV_PWM] = 0x1E786000, + [ASPEED_DEV_LPC] = 0x1E789000, + [ASPEED_DEV_IBT] = 0x1E789140, + [ASPEED_DEV_I2C] = 0x1E78A000, + [ASPEED_DEV_ETH1] = 0x1E660000, + [ASPEED_DEV_ETH2] = 0x1E680000, + [ASPEED_DEV_UART1] = 0x1E783000, + [ASPEED_DEV_UART5] = 0x1E784000, + [ASPEED_DEV_VUART] = 0x1E787000, + [ASPEED_DEV_SDRAM] = 0x80000000, }; static const int aspeed_soc_ast2400_irqmap[] = { - [ASPEED_UART1] = 9, - [ASPEED_UART2] = 32, - [ASPEED_UART3] = 33, - [ASPEED_UART4] = 34, - [ASPEED_UART5] = 10, - [ASPEED_VUART] = 8, - [ASPEED_FMC] = 19, - [ASPEED_EHCI1] = 5, - [ASPEED_EHCI2] = 13, - [ASPEED_SDMC] = 0, - [ASPEED_SCU] = 21, - [ASPEED_ADC] = 31, - [ASPEED_GPIO] = 20, - [ASPEED_RTC] = 22, - [ASPEED_TIMER1] = 16, - [ASPEED_TIMER2] = 17, - [ASPEED_TIMER3] = 18, - [ASPEED_TIMER4] = 35, - [ASPEED_TIMER5] = 36, - [ASPEED_TIMER6] = 37, - [ASPEED_TIMER7] = 38, - [ASPEED_TIMER8] = 39, - [ASPEED_WDT] = 27, - [ASPEED_PWM] = 28, - [ASPEED_LPC] = 8, - [ASPEED_IBT] = 8, /* LPC */ - [ASPEED_I2C] = 12, - [ASPEED_ETH1] = 2, - [ASPEED_ETH2] = 3, - [ASPEED_XDMA] = 6, - [ASPEED_SDHCI] = 26, + [ASPEED_DEV_UART1] = 9, + [ASPEED_DEV_UART2] = 32, + [ASPEED_DEV_UART3] = 33, + [ASPEED_DEV_UART4] = 34, + [ASPEED_DEV_UART5] = 10, + [ASPEED_DEV_VUART] = 8, + [ASPEED_DEV_FMC] = 19, + [ASPEED_DEV_EHCI1] = 5, + [ASPEED_DEV_EHCI2] = 13, + [ASPEED_DEV_SDMC] = 0, + [ASPEED_DEV_SCU] = 21, + [ASPEED_DEV_ADC] = 31, + [ASPEED_DEV_GPIO] = 20, + [ASPEED_DEV_RTC] = 22, + [ASPEED_DEV_TIMER1] = 16, + [ASPEED_DEV_TIMER2] = 17, + [ASPEED_DEV_TIMER3] = 18, + [ASPEED_DEV_TIMER4] = 35, + [ASPEED_DEV_TIMER5] = 36, + [ASPEED_DEV_TIMER6] = 37, + [ASPEED_DEV_TIMER7] = 38, + [ASPEED_DEV_TIMER8] = 39, + [ASPEED_DEV_WDT] = 27, + [ASPEED_DEV_PWM] = 28, + [ASPEED_DEV_LPC] = 8, + [ASPEED_DEV_IBT] = 8, /* LPC */ + [ASPEED_DEV_I2C] = 12, + [ASPEED_DEV_ETH1] = 2, + [ASPEED_DEV_ETH2] = 3, + [ASPEED_DEV_XDMA] = 6, + [ASPEED_DEV_SDHCI] = 26, }; #define aspeed_soc_ast2500_irqmap aspeed_soc_ast2400_irqmap @@ -221,11 +221,11 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) Error *err = NULL; /* IO space */ - create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_IOMEM], + create_unimplemented_device("aspeed_soc.io", sc->memmap[ASPEED_DEV_IOMEM], ASPEED_SOC_IOMEM_SIZE); /* Video engine stub */ - create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_VIDEO], + create_unimplemented_device("aspeed.video", sc->memmap[ASPEED_DEV_VIDEO], 0x1000); /* CPU */ @@ -243,19 +243,19 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) return; } memory_region_add_subregion(get_system_memory(), - sc->memmap[ASPEED_SRAM], &s->sram); + sc->memmap[ASPEED_DEV_SRAM], &s->sram); /* SCU */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_SCU]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]); /* VIC */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->vic), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->vic), 0, sc->memmap[ASPEED_VIC]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->vic), 0, sc->memmap[ASPEED_DEV_VIC]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 0, qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ)); sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 1, @@ -265,9 +265,9 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) if (!sysbus_realize(SYS_BUS_DEVICE(&s->rtc), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->memmap[ASPEED_RTC]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->memmap[ASPEED_DEV_RTC]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, - aspeed_soc_get_irq(s, ASPEED_RTC)); + aspeed_soc_get_irq(s, ASPEED_DEV_RTC)); /* Timer */ object_property_set_link(OBJECT(&s->timerctrl), "scu", OBJECT(&s->scu), @@ -276,16 +276,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->timerctrl), 0, - sc->memmap[ASPEED_TIMER1]); + sc->memmap[ASPEED_DEV_TIMER1]); for (i = 0; i < ASPEED_TIMER_NR_TIMERS; i++) { - qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_TIMER1 + i); + qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_DEV_TIMER1 + i); sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq); } /* UART - attach an 8250 to the IO space as our UART5 */ if (serial_hd(0)) { - qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_UART5); - serial_mm_init(get_system_memory(), sc->memmap[ASPEED_UART5], 2, + qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_DEV_UART5); + serial_mm_init(get_system_memory(), sc->memmap[ASPEED_DEV_UART5], 2, uart5, 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN); } @@ -295,25 +295,25 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) if (!sysbus_realize(SYS_BUS_DEVICE(&s->i2c), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_I2C]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_DEV_I2C]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c), 0, - aspeed_soc_get_irq(s, ASPEED_I2C)); + aspeed_soc_get_irq(s, ASPEED_DEV_I2C)); /* FMC, The number of CS is set at the board level */ object_property_set_link(OBJECT(&s->fmc), "dram", OBJECT(s->dram_mr), &error_abort); if (!object_property_set_int(OBJECT(&s->fmc), "sdram-base", - sc->memmap[ASPEED_SDRAM], errp)) { + sc->memmap[ASPEED_DEV_SDRAM], errp)) { return; } if (!sysbus_realize(SYS_BUS_DEVICE(&s->fmc), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_FMC]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_DEV_FMC]); sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 1, s->fmc.ctrl->flash_window_base); sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0, - aspeed_soc_get_irq(s, ASPEED_FMC)); + aspeed_soc_get_irq(s, ASPEED_DEV_FMC)); /* SPI */ for (i = 0; i < sc->spis_num; i++) { @@ -322,7 +322,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, - sc->memmap[ASPEED_SPI1 + i]); + sc->memmap[ASPEED_DEV_SPI1 + i]); sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 1, s->spi[i].ctrl->flash_window_base); } @@ -333,16 +333,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0, - sc->memmap[ASPEED_EHCI1 + i]); + sc->memmap[ASPEED_DEV_EHCI1 + i]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0, - aspeed_soc_get_irq(s, ASPEED_EHCI1 + i)); + aspeed_soc_get_irq(s, ASPEED_DEV_EHCI1 + i)); } /* SDMC - SDRAM Memory Controller */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdmc), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_SDMC]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->memmap[ASPEED_DEV_SDMC]); /* Watch dog */ for (i = 0; i < sc->wdts_num; i++) { @@ -354,7 +354,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, - sc->memmap[ASPEED_WDT] + i * awc->offset); + sc->memmap[ASPEED_DEV_WDT] + i * awc->offset); } /* Net */ @@ -365,9 +365,9 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0, - sc->memmap[ASPEED_ETH1 + i]); + sc->memmap[ASPEED_DEV_ETH1 + i]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0, - aspeed_soc_get_irq(s, ASPEED_ETH1 + i)); + aspeed_soc_get_irq(s, ASPEED_DEV_ETH1 + i)); } /* XDMA */ @@ -375,26 +375,26 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->xdma), 0, - sc->memmap[ASPEED_XDMA]); + sc->memmap[ASPEED_DEV_XDMA]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->xdma), 0, - aspeed_soc_get_irq(s, ASPEED_XDMA)); + aspeed_soc_get_irq(s, ASPEED_DEV_XDMA)); /* GPIO */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->memmap[ASPEED_GPIO]); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, sc->memmap[ASPEED_DEV_GPIO]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0, - aspeed_soc_get_irq(s, ASPEED_GPIO)); + aspeed_soc_get_irq(s, ASPEED_DEV_GPIO)); /* SDHCI */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdhci), errp)) { return; } sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdhci), 0, - sc->memmap[ASPEED_SDHCI]); + sc->memmap[ASPEED_DEV_SDHCI]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci), 0, - aspeed_soc_get_irq(s, ASPEED_SDHCI)); + aspeed_soc_get_irq(s, ASPEED_DEV_SDHCI)); } static Property aspeed_soc_properties[] = { DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION, From patchwork Thu Aug 13 22:25:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F23FDC433DF for ; Thu, 13 Aug 2020 22:30:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B906D20774 for ; Thu, 13 Aug 2020 22:30:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QsBlCEjI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B906D20774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LjT-0001io-Px for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgJ-00051l-Bg for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:43 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:51186 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgH-0002qo-7i for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pVD7+kGLthr8W/hX8sm8asqnL2c9WGxhll07LQUausE=; b=QsBlCEjIjZBhopmVkotu+eYv0jfYe5vmo04DUxUIvrbJHrZWfCVuTDUpZK7hhran0WfmXx QFM/vVRiun4+EUvJl0KAtp3EgmXc2Eac0hBWq0etxnLjZznCxOoWYdmiTxYYQjBuCvYtG5 rOGfUb6/jA9CdvyEdoFP+tQ44qc9AT0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-59-3hnE6lp5Mt-NdWkFxXO28Q-1; Thu, 13 Aug 2020 18:26:38 -0400 X-MC-Unique: 3hnE6lp5Mt-NdWkFxXO28Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07FF557083 for ; Thu, 13 Aug 2020 22:26:38 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6DAD10021AA; Thu, 13 Aug 2020 22:26:37 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 09/41] sifive_e: Rename memmap enum constants Date: Thu, 13 Aug 2020 18:25:53 -0400 Message-Id: <20200813222625.243136-10-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Some of the enum constant names conflict with the QOM type check macros. This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE(). Rename all the constants to SIFIVE_E_DEV_*, to avoid conflicts. Signed-off-by: Eduardo Habkost --- include/hw/riscv/sifive_e.h | 38 ++++++++--------- hw/riscv/sifive_e.c | 82 ++++++++++++++++++------------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h index 637414130b..7c2eb70189 100644 --- a/include/hw/riscv/sifive_e.h +++ b/include/hw/riscv/sifive_e.h @@ -53,25 +53,25 @@ typedef struct SiFiveEState { OBJECT_CHECK(SiFiveEState, (obj), TYPE_RISCV_E_MACHINE) enum { - SIFIVE_E_DEBUG, - SIFIVE_E_MROM, - SIFIVE_E_OTP, - SIFIVE_E_CLINT, - SIFIVE_E_PLIC, - SIFIVE_E_AON, - SIFIVE_E_PRCI, - SIFIVE_E_OTP_CTRL, - SIFIVE_E_GPIO0, - SIFIVE_E_UART0, - SIFIVE_E_QSPI0, - SIFIVE_E_PWM0, - SIFIVE_E_UART1, - SIFIVE_E_QSPI1, - SIFIVE_E_PWM1, - SIFIVE_E_QSPI2, - SIFIVE_E_PWM2, - SIFIVE_E_XIP, - SIFIVE_E_DTIM + SIFIVE_E_DEV_DEBUG, + SIFIVE_E_DEV_MROM, + SIFIVE_E_DEV_OTP, + SIFIVE_E_DEV_CLINT, + SIFIVE_E_DEV_PLIC, + SIFIVE_E_DEV_AON, + SIFIVE_E_DEV_PRCI, + SIFIVE_E_DEV_OTP_CTRL, + SIFIVE_E_DEV_GPIO0, + SIFIVE_E_DEV_UART0, + SIFIVE_E_DEV_QSPI0, + SIFIVE_E_DEV_PWM0, + SIFIVE_E_DEV_UART1, + SIFIVE_E_DEV_QSPI1, + SIFIVE_E_DEV_PWM1, + SIFIVE_E_DEV_QSPI2, + SIFIVE_E_DEV_PWM2, + SIFIVE_E_DEV_XIP, + SIFIVE_E_DEV_DTIM }; enum { diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index c8b060486a..88b4524117 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -54,25 +54,25 @@ static const struct MemmapEntry { hwaddr base; hwaddr size; } sifive_e_memmap[] = { - [SIFIVE_E_DEBUG] = { 0x0, 0x1000 }, - [SIFIVE_E_MROM] = { 0x1000, 0x2000 }, - [SIFIVE_E_OTP] = { 0x20000, 0x2000 }, - [SIFIVE_E_CLINT] = { 0x2000000, 0x10000 }, - [SIFIVE_E_PLIC] = { 0xc000000, 0x4000000 }, - [SIFIVE_E_AON] = { 0x10000000, 0x8000 }, - [SIFIVE_E_PRCI] = { 0x10008000, 0x8000 }, - [SIFIVE_E_OTP_CTRL] = { 0x10010000, 0x1000 }, - [SIFIVE_E_GPIO0] = { 0x10012000, 0x1000 }, - [SIFIVE_E_UART0] = { 0x10013000, 0x1000 }, - [SIFIVE_E_QSPI0] = { 0x10014000, 0x1000 }, - [SIFIVE_E_PWM0] = { 0x10015000, 0x1000 }, - [SIFIVE_E_UART1] = { 0x10023000, 0x1000 }, - [SIFIVE_E_QSPI1] = { 0x10024000, 0x1000 }, - [SIFIVE_E_PWM1] = { 0x10025000, 0x1000 }, - [SIFIVE_E_QSPI2] = { 0x10034000, 0x1000 }, - [SIFIVE_E_PWM2] = { 0x10035000, 0x1000 }, - [SIFIVE_E_XIP] = { 0x20000000, 0x20000000 }, - [SIFIVE_E_DTIM] = { 0x80000000, 0x4000 } + [SIFIVE_E_DEV_DEBUG] = { 0x0, 0x1000 }, + [SIFIVE_E_DEV_MROM] = { 0x1000, 0x2000 }, + [SIFIVE_E_DEV_OTP] = { 0x20000, 0x2000 }, + [SIFIVE_E_DEV_CLINT] = { 0x2000000, 0x10000 }, + [SIFIVE_E_DEV_PLIC] = { 0xc000000, 0x4000000 }, + [SIFIVE_E_DEV_AON] = { 0x10000000, 0x8000 }, + [SIFIVE_E_DEV_PRCI] = { 0x10008000, 0x8000 }, + [SIFIVE_E_DEV_OTP_CTRL] = { 0x10010000, 0x1000 }, + [SIFIVE_E_DEV_GPIO0] = { 0x10012000, 0x1000 }, + [SIFIVE_E_DEV_UART0] = { 0x10013000, 0x1000 }, + [SIFIVE_E_DEV_QSPI0] = { 0x10014000, 0x1000 }, + [SIFIVE_E_DEV_PWM0] = { 0x10015000, 0x1000 }, + [SIFIVE_E_DEV_UART1] = { 0x10023000, 0x1000 }, + [SIFIVE_E_DEV_QSPI1] = { 0x10024000, 0x1000 }, + [SIFIVE_E_DEV_PWM1] = { 0x10025000, 0x1000 }, + [SIFIVE_E_DEV_QSPI2] = { 0x10034000, 0x1000 }, + [SIFIVE_E_DEV_PWM2] = { 0x10035000, 0x1000 }, + [SIFIVE_E_DEV_XIP] = { 0x20000000, 0x20000000 }, + [SIFIVE_E_DEV_DTIM] = { 0x80000000, 0x4000 } }; static void sifive_e_machine_init(MachineState *machine) @@ -90,9 +90,9 @@ static void sifive_e_machine_init(MachineState *machine) /* Data Tightly Integrated Memory */ memory_region_init_ram(main_mem, NULL, "riscv.sifive.e.ram", - memmap[SIFIVE_E_DTIM].size, &error_fatal); + memmap[SIFIVE_E_DEV_DTIM].size, &error_fatal); memory_region_add_subregion(sys_mem, - memmap[SIFIVE_E_DTIM].base, main_mem); + memmap[SIFIVE_E_DEV_DTIM].base, main_mem); /* Mask ROM reset vector */ uint32_t reset_vec[4]; @@ -111,7 +111,7 @@ static void sifive_e_machine_init(MachineState *machine) reset_vec[i] = cpu_to_le32(reset_vec[i]); } rom_add_blob_fixed_as("mrom.reset", reset_vec, sizeof(reset_vec), - memmap[SIFIVE_E_MROM].base, &address_space_memory); + memmap[SIFIVE_E_DEV_MROM].base, &address_space_memory); if (machine->kernel_filename) { riscv_load_kernel(machine->kernel_filename, NULL); @@ -194,12 +194,12 @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp) /* Mask ROM */ memory_region_init_rom(&s->mask_rom, OBJECT(dev), "riscv.sifive.e.mrom", - memmap[SIFIVE_E_MROM].size, &error_fatal); + memmap[SIFIVE_E_DEV_MROM].size, &error_fatal); memory_region_add_subregion(sys_mem, - memmap[SIFIVE_E_MROM].base, &s->mask_rom); + memmap[SIFIVE_E_DEV_MROM].base, &s->mask_rom); /* MMIO */ - s->plic = sifive_plic_create(memmap[SIFIVE_E_PLIC].base, + s->plic = sifive_plic_create(memmap[SIFIVE_E_DEV_PLIC].base, (char *)SIFIVE_E_PLIC_HART_CONFIG, SIFIVE_E_PLIC_NUM_SOURCES, SIFIVE_E_PLIC_NUM_PRIORITIES, @@ -209,13 +209,13 @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp) SIFIVE_E_PLIC_ENABLE_STRIDE, SIFIVE_E_PLIC_CONTEXT_BASE, SIFIVE_E_PLIC_CONTEXT_STRIDE, - memmap[SIFIVE_E_PLIC].size); - sifive_clint_create(memmap[SIFIVE_E_CLINT].base, - memmap[SIFIVE_E_CLINT].size, ms->smp.cpus, + memmap[SIFIVE_E_DEV_PLIC].size); + sifive_clint_create(memmap[SIFIVE_E_DEV_CLINT].base, + memmap[SIFIVE_E_DEV_CLINT].size, ms->smp.cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, false); create_unimplemented_device("riscv.sifive.e.aon", - memmap[SIFIVE_E_AON].base, memmap[SIFIVE_E_AON].size); - sifive_e_prci_create(memmap[SIFIVE_E_PRCI].base); + memmap[SIFIVE_E_DEV_AON].base, memmap[SIFIVE_E_DEV_AON].size); + sifive_e_prci_create(memmap[SIFIVE_E_DEV_PRCI].base); /* GPIO */ @@ -224,7 +224,7 @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp) } /* Map GPIO registers */ - sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_E_GPIO0].base); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_E_DEV_GPIO0].base); /* Pass all GPIOs to the SOC layer so they are available to the board */ qdev_pass_gpios(DEVICE(&s->gpio), dev, NULL); @@ -236,27 +236,27 @@ static void sifive_e_soc_realize(DeviceState *dev, Error **errp) SIFIVE_E_GPIO0_IRQ0 + i)); } - sifive_uart_create(sys_mem, memmap[SIFIVE_E_UART0].base, + sifive_uart_create(sys_mem, memmap[SIFIVE_E_DEV_UART0].base, serial_hd(0), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_E_UART0_IRQ)); create_unimplemented_device("riscv.sifive.e.qspi0", - memmap[SIFIVE_E_QSPI0].base, memmap[SIFIVE_E_QSPI0].size); + memmap[SIFIVE_E_DEV_QSPI0].base, memmap[SIFIVE_E_DEV_QSPI0].size); create_unimplemented_device("riscv.sifive.e.pwm0", - memmap[SIFIVE_E_PWM0].base, memmap[SIFIVE_E_PWM0].size); - sifive_uart_create(sys_mem, memmap[SIFIVE_E_UART1].base, + memmap[SIFIVE_E_DEV_PWM0].base, memmap[SIFIVE_E_DEV_PWM0].size); + sifive_uart_create(sys_mem, memmap[SIFIVE_E_DEV_UART1].base, serial_hd(1), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_E_UART1_IRQ)); create_unimplemented_device("riscv.sifive.e.qspi1", - memmap[SIFIVE_E_QSPI1].base, memmap[SIFIVE_E_QSPI1].size); + memmap[SIFIVE_E_DEV_QSPI1].base, memmap[SIFIVE_E_DEV_QSPI1].size); create_unimplemented_device("riscv.sifive.e.pwm1", - memmap[SIFIVE_E_PWM1].base, memmap[SIFIVE_E_PWM1].size); + memmap[SIFIVE_E_DEV_PWM1].base, memmap[SIFIVE_E_DEV_PWM1].size); create_unimplemented_device("riscv.sifive.e.qspi2", - memmap[SIFIVE_E_QSPI2].base, memmap[SIFIVE_E_QSPI2].size); + memmap[SIFIVE_E_DEV_QSPI2].base, memmap[SIFIVE_E_DEV_QSPI2].size); create_unimplemented_device("riscv.sifive.e.pwm2", - memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size); + memmap[SIFIVE_E_DEV_PWM2].base, memmap[SIFIVE_E_DEV_PWM2].size); /* Flash memory */ memory_region_init_rom(&s->xip_mem, OBJECT(dev), "riscv.sifive.e.xip", - memmap[SIFIVE_E_XIP].size, &error_fatal); - memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_XIP].base, + memmap[SIFIVE_E_DEV_XIP].size, &error_fatal); + memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_DEV_XIP].base, &s->xip_mem); } From patchwork Thu Aug 13 22:25:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21286C433DF for ; Thu, 13 Aug 2020 22:38:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D085A204EC for ; Thu, 13 Aug 2020 22:38:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="STa9O94E" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D085A204EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Lrh-0006QQ-3o for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:38:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgL-00056Y-O0 for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:45 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31798 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgI-0002rA-I3 for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mPq0O2sLLzL65pWx37K//sAxTs3PBV5avSSzKjOKMO4=; b=STa9O94E0pZD8TrapmGEtYLy2oDD9Fx0DgAaEViShbMiWFWStYtPfP/84XOKfwhtLtcLsX HV6ItlYbXYhoTeTcFK2BC3dMjDXXlhnUuLS6u7w+mCZrRf8H+cCUj/FNQw+uNoe6HvcCEU mpsm58853RB7SREzOlmPj8ew+sJaEAM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-E-CjR0VUNay5ivt9X-v-eA-1; Thu, 13 Aug 2020 18:26:39 -0400 X-MC-Unique: E-CjR0VUNay5ivt9X-v-eA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0523F100CA88 for ; Thu, 13 Aug 2020 22:26:39 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE4E01992D; Thu, 13 Aug 2020 22:26:38 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 10/41] sifive_u: Rename memmap enum constants Date: Thu, 13 Aug 2020 18:25:54 -0400 Message-Id: <20200813222625.243136-11-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Some of the enum constant names conflict with the QOM type check macros. This needs to be addressed to allow us to transform the QOM type check macros into functions generated by OBJECT_DECLARE_TYPE(). Rename all the constants to SIFIVE_U_DEV_*, to avoid conflicts. Signed-off-by: Eduardo Habkost --- include/hw/riscv/sifive_u.h | 30 ++++---- hw/riscv/sifive_u.c | 136 ++++++++++++++++++------------------ 2 files changed, 83 insertions(+), 83 deletions(-) diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index aba4d0181f..0dab922f3a 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -68,21 +68,21 @@ typedef struct SiFiveUState { } SiFiveUState; enum { - SIFIVE_U_DEBUG, - SIFIVE_U_MROM, - SIFIVE_U_CLINT, - SIFIVE_U_L2LIM, - SIFIVE_U_PLIC, - SIFIVE_U_PRCI, - SIFIVE_U_UART0, - SIFIVE_U_UART1, - SIFIVE_U_GPIO, - SIFIVE_U_OTP, - SIFIVE_U_DMC, - SIFIVE_U_FLASH0, - SIFIVE_U_DRAM, - SIFIVE_U_GEM, - SIFIVE_U_GEM_MGMT + SIFIVE_U_DEV_DEBUG, + SIFIVE_U_DEV_MROM, + SIFIVE_U_DEV_CLINT, + SIFIVE_U_DEV_L2LIM, + SIFIVE_U_DEV_PLIC, + SIFIVE_U_DEV_PRCI, + SIFIVE_U_DEV_UART0, + SIFIVE_U_DEV_UART1, + SIFIVE_U_DEV_GPIO, + SIFIVE_U_DEV_OTP, + SIFIVE_U_DEV_DMC, + SIFIVE_U_DEV_FLASH0, + SIFIVE_U_DEV_DRAM, + SIFIVE_U_DEV_GEM, + SIFIVE_U_DEV_GEM_MGMT }; enum { diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index e5682c38a9..0dfbcb5160 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -69,21 +69,21 @@ static const struct MemmapEntry { hwaddr base; hwaddr size; } sifive_u_memmap[] = { - [SIFIVE_U_DEBUG] = { 0x0, 0x100 }, - [SIFIVE_U_MROM] = { 0x1000, 0xf000 }, - [SIFIVE_U_CLINT] = { 0x2000000, 0x10000 }, - [SIFIVE_U_L2LIM] = { 0x8000000, 0x2000000 }, - [SIFIVE_U_PLIC] = { 0xc000000, 0x4000000 }, - [SIFIVE_U_PRCI] = { 0x10000000, 0x1000 }, - [SIFIVE_U_UART0] = { 0x10010000, 0x1000 }, - [SIFIVE_U_UART1] = { 0x10011000, 0x1000 }, - [SIFIVE_U_GPIO] = { 0x10060000, 0x1000 }, - [SIFIVE_U_OTP] = { 0x10070000, 0x1000 }, - [SIFIVE_U_GEM] = { 0x10090000, 0x2000 }, - [SIFIVE_U_GEM_MGMT] = { 0x100a0000, 0x1000 }, - [SIFIVE_U_DMC] = { 0x100b0000, 0x10000 }, - [SIFIVE_U_FLASH0] = { 0x20000000, 0x10000000 }, - [SIFIVE_U_DRAM] = { 0x80000000, 0x0 }, + [SIFIVE_U_DEV_DEBUG] = { 0x0, 0x100 }, + [SIFIVE_U_DEV_MROM] = { 0x1000, 0xf000 }, + [SIFIVE_U_DEV_CLINT] = { 0x2000000, 0x10000 }, + [SIFIVE_U_DEV_L2LIM] = { 0x8000000, 0x2000000 }, + [SIFIVE_U_DEV_PLIC] = { 0xc000000, 0x4000000 }, + [SIFIVE_U_DEV_PRCI] = { 0x10000000, 0x1000 }, + [SIFIVE_U_DEV_UART0] = { 0x10010000, 0x1000 }, + [SIFIVE_U_DEV_UART1] = { 0x10011000, 0x1000 }, + [SIFIVE_U_DEV_GPIO] = { 0x10060000, 0x1000 }, + [SIFIVE_U_DEV_OTP] = { 0x10070000, 0x1000 }, + [SIFIVE_U_DEV_GEM] = { 0x10090000, 0x2000 }, + [SIFIVE_U_DEV_GEM_MGMT] = { 0x100a0000, 0x1000 }, + [SIFIVE_U_DEV_DMC] = { 0x100b0000, 0x10000 }, + [SIFIVE_U_DEV_FLASH0] = { 0x20000000, 0x10000000 }, + [SIFIVE_U_DEV_DRAM] = { 0x80000000, 0x0 }, }; #define OTP_SERIAL 1 @@ -142,10 +142,10 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, g_free(nodename); nodename = g_strdup_printf("/memory@%lx", - (long)memmap[SIFIVE_U_DRAM].base); + (long)memmap[SIFIVE_U_DEV_DRAM].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_cells(fdt, nodename, "reg", - memmap[SIFIVE_U_DRAM].base >> 32, memmap[SIFIVE_U_DRAM].base, + memmap[SIFIVE_U_DEV_DRAM].base >> 32, memmap[SIFIVE_U_DEV_DRAM].base, mem_size >> 32, mem_size); qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory"); g_free(nodename); @@ -200,39 +200,39 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, g_free(nodename); } nodename = g_strdup_printf("/soc/clint@%lx", - (long)memmap[SIFIVE_U_CLINT].base); + (long)memmap[SIFIVE_U_DEV_CLINT].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_string(fdt, nodename, "compatible", "riscv,clint0"); qemu_fdt_setprop_cells(fdt, nodename, "reg", - 0x0, memmap[SIFIVE_U_CLINT].base, - 0x0, memmap[SIFIVE_U_CLINT].size); + 0x0, memmap[SIFIVE_U_DEV_CLINT].base, + 0x0, memmap[SIFIVE_U_DEV_CLINT].size); qemu_fdt_setprop(fdt, nodename, "interrupts-extended", cells, ms->smp.cpus * sizeof(uint32_t) * 4); g_free(cells); g_free(nodename); nodename = g_strdup_printf("/soc/otp@%lx", - (long)memmap[SIFIVE_U_OTP].base); + (long)memmap[SIFIVE_U_DEV_OTP].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_cell(fdt, nodename, "fuse-count", SIFIVE_U_OTP_REG_SIZE); qemu_fdt_setprop_cells(fdt, nodename, "reg", - 0x0, memmap[SIFIVE_U_OTP].base, - 0x0, memmap[SIFIVE_U_OTP].size); + 0x0, memmap[SIFIVE_U_DEV_OTP].base, + 0x0, memmap[SIFIVE_U_DEV_OTP].size); qemu_fdt_setprop_string(fdt, nodename, "compatible", "sifive,fu540-c000-otp"); g_free(nodename); prci_phandle = phandle++; nodename = g_strdup_printf("/soc/clock-controller@%lx", - (long)memmap[SIFIVE_U_PRCI].base); + (long)memmap[SIFIVE_U_DEV_PRCI].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_cell(fdt, nodename, "phandle", prci_phandle); qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x1); qemu_fdt_setprop_cells(fdt, nodename, "clocks", hfclk_phandle, rtcclk_phandle); qemu_fdt_setprop_cells(fdt, nodename, "reg", - 0x0, memmap[SIFIVE_U_PRCI].base, - 0x0, memmap[SIFIVE_U_PRCI].size); + 0x0, memmap[SIFIVE_U_DEV_PRCI].base, + 0x0, memmap[SIFIVE_U_DEV_PRCI].size); qemu_fdt_setprop_string(fdt, nodename, "compatible", "sifive,fu540-c000-prci"); g_free(nodename); @@ -256,7 +256,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, g_free(nodename); } nodename = g_strdup_printf("/soc/interrupt-controller@%lx", - (long)memmap[SIFIVE_U_PLIC].base); + (long)memmap[SIFIVE_U_DEV_PLIC].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_cell(fdt, nodename, "#interrupt-cells", 1); qemu_fdt_setprop_string(fdt, nodename, "compatible", "riscv,plic0"); @@ -264,8 +264,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop(fdt, nodename, "interrupts-extended", cells, (ms->smp.cpus * 4 - 2) * sizeof(uint32_t)); qemu_fdt_setprop_cells(fdt, nodename, "reg", - 0x0, memmap[SIFIVE_U_PLIC].base, - 0x0, memmap[SIFIVE_U_PLIC].size); + 0x0, memmap[SIFIVE_U_DEV_PLIC].base, + 0x0, memmap[SIFIVE_U_DEV_PLIC].size); qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev", 0x35); qemu_fdt_setprop_cell(fdt, nodename, "phandle", plic_phandle); plic_phandle = qemu_fdt_get_phandle(fdt, nodename); @@ -274,7 +274,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, gpio_phandle = phandle++; nodename = g_strdup_printf("/soc/gpio@%lx", - (long)memmap[SIFIVE_U_GPIO].base); + (long)memmap[SIFIVE_U_DEV_GPIO].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_cell(fdt, nodename, "phandle", gpio_phandle); qemu_fdt_setprop_cells(fdt, nodename, "clocks", @@ -284,8 +284,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "#gpio-cells", 2); qemu_fdt_setprop(fdt, nodename, "gpio-controller", NULL, 0); qemu_fdt_setprop_cells(fdt, nodename, "reg", - 0x0, memmap[SIFIVE_U_GPIO].base, - 0x0, memmap[SIFIVE_U_GPIO].size); + 0x0, memmap[SIFIVE_U_DEV_GPIO].base, + 0x0, memmap[SIFIVE_U_DEV_GPIO].size); qemu_fdt_setprop_cells(fdt, nodename, "interrupts", SIFIVE_U_GPIO_IRQ0, SIFIVE_U_GPIO_IRQ1, SIFIVE_U_GPIO_IRQ2, SIFIVE_U_GPIO_IRQ3, SIFIVE_U_GPIO_IRQ4, SIFIVE_U_GPIO_IRQ5, SIFIVE_U_GPIO_IRQ6, @@ -304,15 +304,15 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, phy_phandle = phandle++; nodename = g_strdup_printf("/soc/ethernet@%lx", - (long)memmap[SIFIVE_U_GEM].base); + (long)memmap[SIFIVE_U_DEV_GEM].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_string(fdt, nodename, "compatible", "sifive,fu540-c000-gem"); qemu_fdt_setprop_cells(fdt, nodename, "reg", - 0x0, memmap[SIFIVE_U_GEM].base, - 0x0, memmap[SIFIVE_U_GEM].size, - 0x0, memmap[SIFIVE_U_GEM_MGMT].base, - 0x0, memmap[SIFIVE_U_GEM_MGMT].size); + 0x0, memmap[SIFIVE_U_DEV_GEM].base, + 0x0, memmap[SIFIVE_U_DEV_GEM].size, + 0x0, memmap[SIFIVE_U_DEV_GEM_MGMT].base, + 0x0, memmap[SIFIVE_U_DEV_GEM_MGMT].size); qemu_fdt_setprop_string(fdt, nodename, "reg-names", "control"); qemu_fdt_setprop_string(fdt, nodename, "phy-mode", "gmii"); qemu_fdt_setprop_cell(fdt, nodename, "phy-handle", phy_phandle); @@ -333,19 +333,19 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, g_free(nodename); nodename = g_strdup_printf("/soc/ethernet@%lx/ethernet-phy@0", - (long)memmap[SIFIVE_U_GEM].base); + (long)memmap[SIFIVE_U_DEV_GEM].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_cell(fdt, nodename, "phandle", phy_phandle); qemu_fdt_setprop_cell(fdt, nodename, "reg", 0x0); g_free(nodename); nodename = g_strdup_printf("/soc/serial@%lx", - (long)memmap[SIFIVE_U_UART0].base); + (long)memmap[SIFIVE_U_DEV_UART0].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_string(fdt, nodename, "compatible", "sifive,uart0"); qemu_fdt_setprop_cells(fdt, nodename, "reg", - 0x0, memmap[SIFIVE_U_UART0].base, - 0x0, memmap[SIFIVE_U_UART0].size); + 0x0, memmap[SIFIVE_U_DEV_UART0].base, + 0x0, memmap[SIFIVE_U_DEV_UART0].size); qemu_fdt_setprop_cells(fdt, nodename, "clocks", prci_phandle, PRCI_CLK_TLCLK); qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); @@ -377,7 +377,7 @@ static void sifive_u_machine_init(MachineState *machine) MemoryRegion *system_memory = get_system_memory(); MemoryRegion *main_mem = g_new(MemoryRegion, 1); MemoryRegion *flash0 = g_new(MemoryRegion, 1); - target_ulong start_addr = memmap[SIFIVE_U_DRAM].base; + target_ulong start_addr = memmap[SIFIVE_U_DEV_DRAM].base; uint32_t start_addr_hi32 = 0x00000000; int i; uint32_t fdt_load_addr; @@ -392,13 +392,13 @@ static void sifive_u_machine_init(MachineState *machine) /* register RAM */ memory_region_init_ram(main_mem, NULL, "riscv.sifive.u.ram", machine->ram_size, &error_fatal); - memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DRAM].base, + memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DEV_DRAM].base, main_mem); /* register QSPI0 Flash */ memory_region_init_ram(flash0, NULL, "riscv.sifive.u.flash0", - memmap[SIFIVE_U_FLASH0].size, &error_fatal); - memory_region_add_subregion(system_memory, memmap[SIFIVE_U_FLASH0].base, + memmap[SIFIVE_U_DEV_FLASH0].size, &error_fatal); + memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DEV_FLASH0].base, flash0); /* register gpio-restart */ @@ -424,14 +424,14 @@ static void sifive_u_machine_init(MachineState *machine) switch (s->msel) { case MSEL_MEMMAP_QSPI0_FLASH: - start_addr = memmap[SIFIVE_U_FLASH0].base; + start_addr = memmap[SIFIVE_U_DEV_FLASH0].base; break; case MSEL_L2LIM_QSPI0_FLASH: case MSEL_L2LIM_QSPI2_SD: - start_addr = memmap[SIFIVE_U_L2LIM].base; + start_addr = memmap[SIFIVE_U_DEV_L2LIM].base; break; default: - start_addr = memmap[SIFIVE_U_DRAM].base; + start_addr = memmap[SIFIVE_U_DEV_DRAM].base; break; } @@ -459,7 +459,7 @@ static void sifive_u_machine_init(MachineState *machine) } /* Compute the fdt load address in dram */ - fdt_load_addr = riscv_load_fdt(memmap[SIFIVE_U_DRAM].base, + fdt_load_addr = riscv_load_fdt(memmap[SIFIVE_U_DEV_DRAM].base, machine->ram_size, s->fdt); #if defined(TARGET_RISCV64) start_addr_hi32 = start_addr >> 32; @@ -491,10 +491,10 @@ static void sifive_u_machine_init(MachineState *machine) reset_vec[i] = cpu_to_le32(reset_vec[i]); } rom_add_blob_fixed_as("mrom.reset", reset_vec, sizeof(reset_vec), - memmap[SIFIVE_U_MROM].base, &address_space_memory); + memmap[SIFIVE_U_DEV_MROM].base, &address_space_memory); - riscv_rom_copy_firmware_info(memmap[SIFIVE_U_MROM].base, - memmap[SIFIVE_U_MROM].size, + riscv_rom_copy_firmware_info(memmap[SIFIVE_U_DEV_MROM].base, + memmap[SIFIVE_U_DEV_MROM].size, sizeof(reset_vec), kernel_entry); } @@ -634,8 +634,8 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) /* boot rom */ memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom", - memmap[SIFIVE_U_MROM].size, &error_fatal); - memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base, + memmap[SIFIVE_U_DEV_MROM].size, &error_fatal); + memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DEV_MROM].base, mask_rom); /* @@ -648,8 +648,8 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) * too generous to misbehaving guests. */ memory_region_init_ram(l2lim_mem, NULL, "riscv.sifive.u.l2lim", - memmap[SIFIVE_U_L2LIM].size, &error_fatal); - memory_region_add_subregion(system_memory, memmap[SIFIVE_U_L2LIM].base, + memmap[SIFIVE_U_DEV_L2LIM].size, &error_fatal); + memory_region_add_subregion(system_memory, memmap[SIFIVE_U_DEV_L2LIM].base, l2lim_mem); /* create PLIC hart topology configuration string */ @@ -667,7 +667,7 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) } /* MMIO */ - s->plic = sifive_plic_create(memmap[SIFIVE_U_PLIC].base, + s->plic = sifive_plic_create(memmap[SIFIVE_U_DEV_PLIC].base, plic_hart_config, SIFIVE_U_PLIC_NUM_SOURCES, SIFIVE_U_PLIC_NUM_PRIORITIES, @@ -677,26 +677,26 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) SIFIVE_U_PLIC_ENABLE_STRIDE, SIFIVE_U_PLIC_CONTEXT_BASE, SIFIVE_U_PLIC_CONTEXT_STRIDE, - memmap[SIFIVE_U_PLIC].size); + memmap[SIFIVE_U_DEV_PLIC].size); g_free(plic_hart_config); - sifive_uart_create(system_memory, memmap[SIFIVE_U_UART0].base, + sifive_uart_create(system_memory, memmap[SIFIVE_U_DEV_UART0].base, serial_hd(0), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_UART0_IRQ)); - sifive_uart_create(system_memory, memmap[SIFIVE_U_UART1].base, + sifive_uart_create(system_memory, memmap[SIFIVE_U_DEV_UART1].base, serial_hd(1), qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_UART1_IRQ)); - sifive_clint_create(memmap[SIFIVE_U_CLINT].base, - memmap[SIFIVE_U_CLINT].size, ms->smp.cpus, + sifive_clint_create(memmap[SIFIVE_U_DEV_CLINT].base, + memmap[SIFIVE_U_DEV_CLINT].size, ms->smp.cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE, false); if (!sysbus_realize(SYS_BUS_DEVICE(&s->prci), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_PRCI].base); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_DEV_PRCI].base); qdev_prop_set_uint32(DEVICE(&s->gpio), "ngpio", 16); if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_U_GPIO].base); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio), 0, memmap[SIFIVE_U_DEV_GPIO].base); /* Pass all GPIOs to the SOC layer so they are available to the board */ qdev_pass_gpios(DEVICE(&s->gpio), dev, NULL); @@ -712,7 +712,7 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) if (!sysbus_realize(SYS_BUS_DEVICE(&s->otp), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->otp), 0, memmap[SIFIVE_U_OTP].base); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->otp), 0, memmap[SIFIVE_U_DEV_OTP].base); /* FIXME use qdev NIC properties instead of nd_table[] */ if (nd->used) { @@ -724,15 +724,15 @@ static void sifive_u_soc_realize(DeviceState *dev, Error **errp) if (!sysbus_realize(SYS_BUS_DEVICE(&s->gem), errp)) { return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->gem), 0, memmap[SIFIVE_U_GEM].base); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gem), 0, memmap[SIFIVE_U_DEV_GEM].base); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gem), 0, qdev_get_gpio_in(DEVICE(s->plic), SIFIVE_U_GEM_IRQ)); create_unimplemented_device("riscv.sifive.u.gem-mgmt", - memmap[SIFIVE_U_GEM_MGMT].base, memmap[SIFIVE_U_GEM_MGMT].size); + memmap[SIFIVE_U_DEV_GEM_MGMT].base, memmap[SIFIVE_U_DEV_GEM_MGMT].size); create_unimplemented_device("riscv.sifive.u.dmc", - memmap[SIFIVE_U_DMC].base, memmap[SIFIVE_U_DMC].size); + memmap[SIFIVE_U_DEV_DMC].base, memmap[SIFIVE_U_DEV_DMC].size); } static Property sifive_u_soc_props[] = { From patchwork Thu Aug 13 22:25:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76C7FC433E1 for ; Thu, 13 Aug 2020 22:34:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3DB3320885 for ; Thu, 13 Aug 2020 22:34:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ei4UkeGd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DB3320885 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Lnl-0000SM-El for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:34:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgL-000575-W2 for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:46 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:54465 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgK-0002rd-8u for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yhk8jhWqtS6Q6cIdLwi91t5UwSJOb7Sz2sefHRBGYM4=; b=Ei4UkeGduF1SmC3L7Bnt2OLl39+31YdOhzv8ab/3UbQg1GyIl467bd6qsTLsDv8xVqFlOm Uhp0GYBtPT5jHkSearMY6CEzLFNd0tYSQPOqDq3zy3IGKOXGoAMPglHyCoH+9JFn2UH45g U7APiRO2tacmlyAux/i9MhOa1waDpxA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-102-Y4yY5yraNGWrVZo2EdSEKg-1; Thu, 13 Aug 2020 18:26:42 -0400 X-MC-Unique: Y4yY5yraNGWrVZo2EdSEKg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 33DEF83DC6E for ; Thu, 13 Aug 2020 22:26:41 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id E403460C04; Thu, 13 Aug 2020 22:26:40 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 12/41] virtio-ccw: Fix definition of VIRTIO_CCW_BUS_GET_CLASS Date: Thu, 13 Aug 2020 18:25:56 -0400 Message-Id: <20200813222625.243136-13-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The macro was incorrectly defined using OBJECT_CHECK. Signed-off-by: Eduardo Habkost --- hw/s390x/virtio-ccw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index c0e3355248..b281896f7d 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -65,9 +65,9 @@ typedef struct VirtioBusClass VirtioCcwBusClass; #define TYPE_VIRTIO_CCW_BUS "virtio-ccw-bus" #define VIRTIO_CCW_BUS(obj) \ - OBJECT_CHECK(VirtioCcwBus, (obj), TYPE_VIRTIO_CCW_BUS) + OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS) #define VIRTIO_CCW_BUS_GET_CLASS(obj) \ - OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS) + OBJECT_GET_CLASS(VirtioCcwBusClass, (obj), TYPE_VIRTIO_CCW_BUS) #define VIRTIO_CCW_BUS_CLASS(klass) \ OBJECT_CLASS_CHECK(VirtioCcwBusClass, klass, TYPE_VIRTIO_CCW_BUS) From patchwork Thu Aug 13 22:25:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF04FC433E1 for ; Thu, 13 Aug 2020 22:36:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A783E204EC for ; Thu, 13 Aug 2020 22:36:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IoQ4uceQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A783E204EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LpX-0003kL-Vd for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:36:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgN-0005Ap-LN for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49449) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgL-0002s6-VM for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lwB3uWkWdpW0lz+OBp0pnkgR9kZhF0thu3iq8YFmaNE=; b=IoQ4uceQHdG/lcx5HYrDyrAINTNAlbw6x6wiH6cXoa6sWzXyzUO5r7WMob45sIDmIwwsJJ mfab7xfhJklUgjloh5rPsVLVVa9N1X0C5TedF6q+wUdsO8WOUHyduC8AMQJMcESNMCGvTT YGZRGWT6JwTMcZJRdGTsSf1CDT2EENE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270-vEsXcW6CP0SwTuh71HtYTQ-1; Thu, 13 Aug 2020 18:26:43 -0400 X-MC-Unique: vEsXcW6CP0SwTuh71HtYTQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91F1E18B9EC2 for ; Thu, 13 Aug 2020 22:26:42 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B57371D1F; Thu, 13 Aug 2020 22:26:42 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 13/41] hvf: Add missing include Date: Thu, 13 Aug 2020 18:25:57 -0400 Message-Id: <20200813222625.243136-14-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=63.128.21.124; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The sysemu/accel.h header is needed for the ACCEL_CLASS_NAME macro. This will be necessary to allow us to use OBJECT_DEFINE*() for TYPE_HVF_ACCEL. Signed-off-by: Eduardo Habkost --- include/sysemu/hvf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h index 6d3ee4fdb7..d3bed80ea8 100644 --- a/include/sysemu/hvf.h +++ b/include/sysemu/hvf.h @@ -13,6 +13,8 @@ #ifndef HVF_H #define HVF_H +#include "sysemu/accel.h" + #ifdef CONFIG_HVF uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx, int reg); From patchwork Thu Aug 13 22:25:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276572 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80855C433E3 for ; Thu, 13 Aug 2020 22:28:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4F05920774 for ; Thu, 13 Aug 2020 22:28:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="K+yVP2tl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F05920774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LiO-0008F6-Hu for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:28:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgR-0005Kq-QN for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:51 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29625 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgN-0002se-Fl for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=03X33C2nVksYNqu55ngFeuL1UehMSCG1IZZk458uUcs=; b=K+yVP2tlfGugxgO/3/ux2MzO027cDEfHAECKTq4DrOp7OBDTEZbvuZnISxEfcchfZoS48j mQhZtB3xlkRoUFwqL2Hx+MuV9aYQ2efTiVlcNsMgYn9ju4RQrFyWTbjPZ8nIlwrsSyjPAG 8rZQ5MZ5Q/So2X0WkVfiWtBQK86CdEg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-346-mw5a5klpMgSoyH6GnFU-9w-1; Thu, 13 Aug 2020 18:26:44 -0400 X-MC-Unique: mw5a5klpMgSoyH6GnFU-9w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1880B100CA8E for ; Thu, 13 Aug 2020 22:26:44 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4C6D10021AA; Thu, 13 Aug 2020 22:26:43 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 14/41] hcd-dwc2: Rename USB_*CLASS macros for consistency Date: Thu, 13 Aug 2020 18:25:58 -0400 Message-Id: <20200813222625.243136-15-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Rename the DWC2_CLASS to DWC2_USB_CLASS and DWC2_GET_CLASS to DWC2_USB_GET_CLASS, for consistency with the DWC2_USB macro. Signed-off-by: Eduardo Habkost --- hw/usb/hcd-dwc2.h | 4 ++-- hw/usb/hcd-dwc2.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/usb/hcd-dwc2.h b/hw/usb/hcd-dwc2.h index 4ba809a07b..54111d835e 100644 --- a/hw/usb/hcd-dwc2.h +++ b/hw/usb/hcd-dwc2.h @@ -182,9 +182,9 @@ struct DWC2Class { #define TYPE_DWC2_USB "dwc2-usb" #define DWC2_USB(obj) \ OBJECT_CHECK(DWC2State, (obj), TYPE_DWC2_USB) -#define DWC2_CLASS(klass) \ +#define DWC2_USB_CLASS(klass) \ OBJECT_CLASS_CHECK(DWC2Class, (klass), TYPE_DWC2_USB) -#define DWC2_GET_CLASS(obj) \ +#define DWC2_USB_GET_CLASS(obj) \ OBJECT_GET_CLASS(DWC2Class, (obj), TYPE_DWC2_USB) #endif diff --git a/hw/usb/hcd-dwc2.c b/hw/usb/hcd-dwc2.c index 56f91f6bee..97688d21bf 100644 --- a/hw/usb/hcd-dwc2.c +++ b/hw/usb/hcd-dwc2.c @@ -1155,7 +1155,7 @@ static void dwc2_work_timer(void *opaque) static void dwc2_reset_enter(Object *obj, ResetType type) { - DWC2Class *c = DWC2_GET_CLASS(obj); + DWC2Class *c = DWC2_USB_GET_CLASS(obj); DWC2State *s = DWC2_USB(obj); int i; @@ -1239,7 +1239,7 @@ static void dwc2_reset_enter(Object *obj, ResetType type) static void dwc2_reset_hold(Object *obj) { - DWC2Class *c = DWC2_GET_CLASS(obj); + DWC2Class *c = DWC2_USB_GET_CLASS(obj); DWC2State *s = DWC2_USB(obj); trace_usb_dwc2_reset_hold(); @@ -1253,7 +1253,7 @@ static void dwc2_reset_hold(Object *obj) static void dwc2_reset_exit(Object *obj) { - DWC2Class *c = DWC2_GET_CLASS(obj); + DWC2Class *c = DWC2_USB_GET_CLASS(obj); DWC2State *s = DWC2_USB(obj); trace_usb_dwc2_reset_exit(); @@ -1382,7 +1382,7 @@ static Property dwc2_usb_properties[] = { static void dwc2_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - DWC2Class *c = DWC2_CLASS(klass); + DWC2Class *c = DWC2_USB_CLASS(klass); ResettableClass *rc = RESETTABLE_CLASS(klass); dc->realize = dwc2_realize; From patchwork Thu Aug 13 22:26:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A043C433DF for ; Thu, 13 Aug 2020 22:39:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 046D7204EC for ; Thu, 13 Aug 2020 22:39:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="daHv6cNR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 046D7204EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Lsf-0008PJ-6x for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:39:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgS-0005NW-Vf for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:53 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:55376 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgR-0002tB-7W for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NA5YBIhBgCLus4frdJSyA0MQ2ir1g/iduIzPMqjp97s=; b=daHv6cNRhNRvYq7kLvau284plauQQt9T7Fwn/jYU5sbiZaRzOxGw+bg1agC4jNYMUypmKo yRXhtUpNjbLETyzqwnhCxrfGQox5v4OxEiEajhihB/E1u3+LF7Cvbi/gcerPNkTOZDNao4 Ubu6bWg7RzZOkab2dbIJJwH0YaXK1UA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-324-oboEsUC1NZ6r2y6b8AEwxg-1; Thu, 13 Aug 2020 18:26:48 -0400 X-MC-Unique: oboEsUC1NZ6r2y6b8AEwxg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7EE9E57084 for ; Thu, 13 Aug 2020 22:26:47 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 447AE1002382; Thu, 13 Aug 2020 22:26:47 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 17/41] pci: Move PCIBusClass typedef to pci.h Date: Thu, 13 Aug 2020 18:26:01 -0400 Message-Id: <20200813222625.243136-18-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future. Signed-off-by: Eduardo Habkost --- include/hw/pci/pci.h | 1 + include/hw/pci/pci_bus.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index c1bf7d5356..4ca7258b5b 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -396,6 +396,7 @@ typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num); typedef PCIINTxRoute (*pci_route_irq_fn)(void *opaque, int pin); #define TYPE_PCI_BUS "PCI" +typedef struct PCIBusClass PCIBusClass; #define PCI_BUS(obj) OBJECT_CHECK(PCIBus, (obj), TYPE_PCI_BUS) #define PCI_BUS_CLASS(klass) OBJECT_CLASS_CHECK(PCIBusClass, (klass), TYPE_PCI_BUS) #define PCI_BUS_GET_CLASS(obj) OBJECT_GET_CLASS(PCIBusClass, (obj), TYPE_PCI_BUS) diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h index 0714f578af..347440d42c 100644 --- a/include/hw/pci/pci_bus.h +++ b/include/hw/pci/pci_bus.h @@ -10,14 +10,14 @@ * use accessor functions in pci.h */ -typedef struct PCIBusClass { +struct PCIBusClass { /*< private >*/ BusClass parent_class; /*< public >*/ int (*bus_num)(PCIBus *bus); uint16_t (*numa_node)(PCIBus *bus); -} PCIBusClass; +}; enum PCIBusFlags { /* This bus is the root of a PCI domain */ From patchwork Thu Aug 13 22:26:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276570 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07822C433E1 for ; Thu, 13 Aug 2020 22:30:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5DB3204EC for ; Thu, 13 Aug 2020 22:30:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="O2N6V791" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5DB3204EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LkP-0003Ku-02 for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:30:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgU-0005Rh-RG for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:54 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29236 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgS-0002tV-Ky for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aHebisfYP2Xnve1zNJBUVFNPl0SGO/BJ+CSkhQk+3bw=; b=O2N6V791rqft0ccI4P40k3FcD3cy3LQGvwU6UufAd3RJ0QqaITTXKhlRf4EhIeYzmMycj5 LH1qjtKs/pLRl6900C4QZlm0mHMQssJ7FUek6jtM9G+iLlYhFqwPbFQFTkcpKmMDgQzgsn UUqFNuwE5exu6cH4qV6q0zS/Bi+o3h4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-MuwJnB5gNG6DGpVNJm5Whw-1; Thu, 13 Aug 2020 18:26:50 -0400 X-MC-Unique: MuwJnB5gNG6DGpVNJm5Whw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7657618B9EC0 for ; Thu, 13 Aug 2020 22:26:49 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C8761992D; Thu, 13 Aug 2020 22:26:49 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 19/41] hvf: Move HVFState typedef to hvf.h Date: Thu, 13 Aug 2020 18:26:03 -0400 Message-Id: <20200813222625.243136-20-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future. Signed-off-by: Eduardo Habkost --- include/sysemu/hvf.h | 1 + target/i386/hvf/hvf-i386.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h index d3bed80ea8..760d6c79a2 100644 --- a/include/sysemu/hvf.h +++ b/include/sysemu/hvf.h @@ -35,6 +35,7 @@ void hvf_vcpu_destroy(CPUState *); #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf") +typedef struct HVFState HVFState; #define HVF_STATE(obj) \ OBJECT_CHECK(HVFState, (obj), TYPE_HVF_ACCEL) diff --git a/target/i386/hvf/hvf-i386.h b/target/i386/hvf/hvf-i386.h index ef20c73eca..e0edffd077 100644 --- a/target/i386/hvf/hvf-i386.h +++ b/target/i386/hvf/hvf-i386.h @@ -57,13 +57,13 @@ typedef struct hvf_vcpu_caps { uint64_t vmx_cap_preemption_timer; } hvf_vcpu_caps; -typedef struct HVFState { +struct HVFState { AccelState parent; hvf_slot slots[32]; int num_slots; hvf_vcpu_caps *hvf_caps; -} HVFState; +}; extern HVFState *hvf_state; void hvf_set_phys_mem(MemoryRegionSection *, bool); From patchwork Thu Aug 13 22:26:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276562 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2DCCC433DF for ; Thu, 13 Aug 2020 22:40:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACCAA204EC for ; Thu, 13 Aug 2020 22:40:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CFrhJxhs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACCAA204EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LtJ-0001CD-VM for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:40:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgW-0005UB-CT for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:57 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:26637 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgU-0002u0-Qz for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0AFt/jdIoJsJKvAKm30CyMtnXeXVjCgOWUctd7+Y3eo=; b=CFrhJxhs+6/LOgwgjz99KcSk5ZIYEmo5DekeuJebOLl7EXItADRajJLVzNMRL2sYCpEZEp J28q+taOCPQm9oDcK436NGnsyTjauujQ+/ZuVHd8nZv1W6nmTghrY7Ycccryva0d93dIKC iSmkqZ5Y1KXoUGSzWryjBGbQt+NOZFA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-QtRmwO4-OCC4Fz5eUSi-Pg-1; Thu, 13 Aug 2020 18:26:52 -0400 X-MC-Unique: QtRmwO4-OCC4Fz5eUSi-Pg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7567B801AC2 for ; Thu, 13 Aug 2020 22:26:51 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 401A41992D; Thu, 13 Aug 2020 22:26:51 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 21/41] s390_flic: Move KVMS390FLICState typedef to header Date: Thu, 13 Aug 2020 18:26:05 -0400 Message-Id: <20200813222625.243136-22-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move typedef closer to the type check macros, to make it easier to convert the code to OBJECT_DEFINE_TYPE() in the future. Signed-off-by: Eduardo Habkost --- include/hw/s390x/s390_flic.h | 1 + hw/intc/s390_flic_kvm.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index 4687ecfe83..df11de9b20 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -75,6 +75,7 @@ typedef struct S390FLICStateClass { } S390FLICStateClass; #define TYPE_KVM_S390_FLIC "s390-flic-kvm" +typedef struct KVMS390FLICState KVMS390FLICState; #define KVM_S390_FLIC(obj) \ OBJECT_CHECK(KVMS390FLICState, (obj), TYPE_KVM_S390_FLIC) diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index a306b26faa..dbd4e682ce 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -29,12 +29,12 @@ #define FLIC_FAILED (-1UL) #define FLIC_SAVEVM_VERSION 1 -typedef struct KVMS390FLICState { +struct KVMS390FLICState{ S390FLICState parent_obj; uint32_t fd; bool clear_io_supported; -} KVMS390FLICState; +}; static KVMS390FLICState *s390_get_kvm_flic(S390FLICState *fs) { From patchwork Thu Aug 13 22:26:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A302C433DF for ; Thu, 13 Aug 2020 22:41:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 235EE2078B for ; Thu, 13 Aug 2020 22:41:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E1SCXr3Q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 235EE2078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Lul-0003ou-Dt for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:41:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgY-0005V9-2W for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:59 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:52039 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgW-0002uH-KA for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FZa//sBbsx7ndQ/95VNArS/PjMT6DXNlc24TqOuAbrM=; b=E1SCXr3QjclFw3S25cKL5gcSU5xKx8X1hKkokbTgi1j5hismxMgDCSUtOTeMriT4ceC/XI OjvEsEdYldpKlmVG/PLyVhxUqEI3eS9KsbFMtm79ygOJ9eEQoA2xjqG3sfb24lywxxMWPS qbe+sL4JFjHo/pXWrEza48v8997YnqY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-523-4bUmyazLMh20xiGFPNzaEg-1; Thu, 13 Aug 2020 18:26:54 -0400 X-MC-Unique: 4bUmyazLMh20xiGFPNzaEg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7C466801AC2 for ; Thu, 13 Aug 2020 22:26:53 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4708510021AA; Thu, 13 Aug 2020 22:26:53 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 23/41] nubus: Delete unused NUBUS_BRIDGE macro Date: Thu, 13 Aug 2020 18:26:07 -0400 Message-Id: <20200813222625.243136-24-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The macro never worked because the NubusBridge typedef doesn't exist. Delete it. Signed-off-by: Eduardo Habkost --- include/hw/nubus/nubus.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index a8634e54c5..c350948262 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -29,7 +29,6 @@ #define NUBUS_BUS(obj) OBJECT_CHECK(NubusBus, (obj), TYPE_NUBUS_BUS) #define TYPE_NUBUS_BRIDGE "nubus-bridge" -#define NUBUS_BRIDGE(obj) OBJECT_CHECK(NubusBridge, (obj), TYPE_NUBUS_BRIDGE) typedef struct NubusBus { BusState qbus; From patchwork Thu Aug 13 22:26:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276568 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA44DC433DF for ; Thu, 13 Aug 2020 22:33:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93450204EC for ; Thu, 13 Aug 2020 22:33:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Jf0JD/BH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93450204EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Lmg-0006om-Mv for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:33:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6LgZ-0005WV-LW for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:00 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33178 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6LgY-0002uS-4i for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:26:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6e/y6GnUNzmSq9ZLIZo77u5F9W4vloSle6sKKrVfSwo=; b=Jf0JD/BH7+iiW6Qcr8x0R/323fkGHxy7hsp+Wi2EvqvwW6GnSVvUkuNuxLoyYP6Qrr64QB UUn3FQfDvn3lHY0bw7XiZsJF5J1DJexhqNwZ3ImEVMY1Y9cABDhxpFg0IFNw4FVjwu8DmQ 1LsiBYu9v9RVlvUROcNSIIrMWRRXSCc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-HRSIz7ouPgmtuj2covqXHg-1; Thu, 13 Aug 2020 18:26:55 -0400 X-MC-Unique: HRSIz7ouPgmtuj2covqXHg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0783801AC4 for ; Thu, 13 Aug 2020 22:26:54 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67C785D759; Thu, 13 Aug 2020 22:26:54 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 24/41] platform-bus: Delete macros for non-existing typedef Date: Thu, 13 Aug 2020 18:26:08 -0400 Message-Id: <20200813222625.243136-25-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" PlatformBusDeviceClass doesn't exist. This will break when we automatically convert the code to use OBJECT_DEFINE_TYPE(). Delete the macros that reference the non-existing typedef. Signed-off-by: Eduardo Habkost --- include/hw/platform-bus.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/hw/platform-bus.h b/include/hw/platform-bus.h index 19e20c57ce..33745a418e 100644 --- a/include/hw/platform-bus.h +++ b/include/hw/platform-bus.h @@ -29,10 +29,6 @@ typedef struct PlatformBusDevice PlatformBusDevice; #define TYPE_PLATFORM_BUS_DEVICE "platform-bus-device" #define PLATFORM_BUS_DEVICE(obj) \ OBJECT_CHECK(PlatformBusDevice, (obj), TYPE_PLATFORM_BUS_DEVICE) -#define PLATFORM_BUS_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PlatformBusDeviceClass, (klass), TYPE_PLATFORM_BUS_DEVICE) -#define PLATFORM_BUS_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PlatformBusDeviceClass, (obj), TYPE_PLATFORM_BUS_DEVICE) struct PlatformBusDevice { /*< private >*/ From patchwork Thu Aug 13 22:26:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276560 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7444FC433E1 for ; Thu, 13 Aug 2020 22:43:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2CF5E2078B for ; Thu, 13 Aug 2020 22:43:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TnidFyfT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CF5E2078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LwG-00079x-G8 for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:43:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgh-0005gy-BO for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:07 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59144 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6Lge-0002v4-KG for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fP0EnqRxS9PceTMNy7oy52s8wly0SWDN8EYvjLo1d0E=; b=TnidFyfToEVRCcJEN6DzU8JOeIj/4QPqNsEi+NglSokMOdgGOaePa3gS4E+ZvYbcLdXgcv MCSRrnb6QMI29qZ9q2abvBPCdpO71/9oSLmNsjngDbLcRo9f5hE8783pLva4ZFpt9C4uqB 1zRxSTQSlSX6xUFzT/BnXQt0xeWaHBY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-172-WJQrGMp6Ml6nNX3L0y6UAg-1; Thu, 13 Aug 2020 18:26:59 -0400 X-MC-Unique: WJQrGMp6Ml6nNX3L0y6UAg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86DCA1005504 for ; Thu, 13 Aug 2020 22:26:58 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0C4D19646; Thu, 13 Aug 2020 22:26:57 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 26/41] qom: provide convenient macros for declaring and defining types Date: Thu, 13 Aug 2020 18:26:10 -0400 Message-Id: <20200813222625.243136-27-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Daniel P. BerrangĂ© When creating new QOM types, there is a lot of boilerplate code that must be repeated using a standard pattern. This is tedious to write and liable to suffer from subtle inconsistencies. Thus it would benefit from some simple automation. QOM was loosely inspired by GLib's GObject, and indeed GObject suffers from the same burden of boilerplate code, but has long provided a set of macros to eliminate this burden in the source implementation. More recently it has also provided a set of macros to eliminate this burden in the header declaration. In GLib there are the G_DECLARE_* and G_DEFINE_* family of macros for the header declaration and source implementation respectively: https://developer.gnome.org/gobject/stable/chapter-gobject.html https://developer.gnome.org/gobject/stable/howto-gobject.html This patch takes inspiration from GObject to provide the equivalent functionality for QOM. In the header file, instead of: typedef struct MyDevice MyDevice; typedef struct MyDeviceClass MyDeviceClass; G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref) #define MY_DEVICE_GET_CLASS(void *obj) \ OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE) #define MY_DEVICE_CLASS(void *klass) \ OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE) #define MY_DEVICE(void *obj) OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE) struct MyDeviceClass { DeviceClass parent_class; }; We now have OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) In cases where the class needs some virtual methods, it can be left to be implemented manually using OBJECT_DECLARE_TYPE(MyDevice, my_device, MY_DEVICE) Note that these macros are including support for g_autoptr() for the object types, which is something previously only supported for variables declared as the base Object * type. Meanwhile in the source file, instead of: static void my_device_finalize(Object *obj); static void my_device_class_init(ObjectClass *oc, void *data); static void my_device_init(Object *obj); static const TypeInfo my_device_info = { .parent = TYPE_DEVICE, .name = TYPE_MY_DEVICE, .instance_size = sizeof(MyDevice), .instance_init = my_device_init, .instance_finalize = my_device_finalize, .class_size = sizeof(MyDeviceClass), .class_init = my_device_class_init, }; static void my_device_register_types(void) { type_register_static(&my_device_info); } type_init(my_device_register_types); We now have OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) Or, if a class needs to implement interfaces: OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device, MY_DEVICE, DEVICE, { TYPE_USER_CREATABLE }, { NULL }) Or, if a class needs to be abstract OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) IOW, in both cases the maintainer now only has to think about the interesting part of the code which implements useful functionality and avoids much of the boilerplate. Signed-off-by: Daniel P. BerrangĂ© Message-Id: <20200723181410.3145233-3-berrange@redhat.com> --- include/qom/object.h | 277 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 277 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 1f8aa2d48e..be64421089 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -304,6 +304,119 @@ typedef struct InterfaceInfo InterfaceInfo; * * The first example of such a QOM method was #CPUClass.reset, * another example is #DeviceClass.realize. + * + * # Standard type declaration and definition macros # + * + * A lot of the code outlined above follows a standard pattern and naming + * convention. To reduce the amount of boilerplate code that needs to be + * written for a new type there are two sets of macros to generate the + * common parts in a standard format. + * + * A type is declared using the OBJECT_DECLARE macro family. In types + * which do not require any virtual functions in the class, the + * OBJECT_DECLARE_SIMPLE_TYPE macro is suitable, and is commonly placed + * in the header file: + * + * + * Declaring a simple type + * + * OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + * + * + * + * This is equivalent to the following: + * + * + * Expansion from declaring a simple type + * + * typedef struct MyDevice MyDevice; + * typedef struct MyDeviceClass MyDeviceClass; + * + * G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref) + * + * #define MY_DEVICE_GET_CLASS(void *obj) \ + * OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE) + * #define MY_DEVICE_CLASS(void *klass) \ + * OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE) + * #define MY_DEVICE(void *obj) + * OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE) + * + * struct MyDeviceClass { + * DeviceClass parent_class; + * }; + * + * + * + * The 'struct MyDevice' needs to be declared separately. + * If the type requires virtual functions to be declared in the class + * struct, then the alternative OBJECT_DECLARE_TYPE() macro can be + * used. This does the same as OBJECT_DECLARE_SIMPLE_TYPE(), but without + * the 'struct MyDeviceClass' definition. + * + * To implement the type, the OBJECT_DEFINE macro family is available. + * In the simple case the OBJECT_DEFINE_TYPE macro is suitable: + * + * + * Defining a simple type + * + * OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + * + * + * + * This is equivalent to the following: + * + * + * Expansion from defining a simple type + * + * static void my_device_finalize(Object *obj); + * static void my_device_class_init(ObjectClass *oc, void *data); + * static void my_device_init(Object *obj); + * + * static const TypeInfo my_device_info = { + * .parent = TYPE_DEVICE, + * .name = TYPE_MY_DEVICE, + * .instance_size = sizeof(MyDevice), + * .instance_init = my_device_init, + * .instance_finalize = my_device_finalize, + * .class_size = sizeof(MyDeviceClass), + * .class_init = my_device_class_init, + * }; + * + * static void + * my_device_register_types(void) + * { + * type_register_static(&my_device_info); + * } + * type_init(my_device_register_types); + * + * + * + * This is sufficient to get the type registered with the type + * system, and the three standard methods now need to be implemented + * along with any other logic required for the type. + * + * If the type needs to implement one or more interfaces, then the + * OBJECT_DEFINE_TYPE_WITH_INTERFACES() macro can be used instead. + * This accepts an array of interface type names. + * + * + * Defining a simple type implementing interfaces + * + * OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device, + * MY_DEVICE, DEVICE, + * { TYPE_USER_CREATABLE }, { NULL }) + * + * + * + * If the type is not intended to be instantiated, then then + * the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead: + * + * + * Defining a simple type + * + * OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE) + * + * */ @@ -440,6 +553,170 @@ struct Object Object *parent; }; +/** + * OBJECT_DECLARE_TYPE: + * @ModuleObjName: the object name with initial capitalization + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * + * This macro is typically used in a header file, and will: + * + * - create the typedefs for the object and class structs + * - register the type for use with g_autoptr + * - provide three standard type cast functions + * + * The object struct and class struct need to be declared manually. + */ +#define OBJECT_DECLARE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME) \ + typedef struct ModuleObjName ModuleObjName; \ + typedef struct ModuleObjName##Class ModuleObjName##Class; \ + \ + G_DEFINE_AUTOPTR_CLEANUP_FUNC(ModuleObjName##Class, object_unref) \ + \ + static inline G_GNUC_UNUSED ModuleObjName##Class * \ + MODULE_OBJ_NAME##_GET_CLASS(void *obj) \ + { return OBJECT_GET_CLASS(ModuleObjName##Class, obj, \ + TYPE_##MODULE_OBJ_NAME); } \ + \ + static inline G_GNUC_UNUSED ModuleObjName##Class * \ + MODULE_OBJ_NAME##_CLASS(void *klass) \ + { return OBJECT_CLASS_CHECK(ModuleObjName##Class, klass, \ + TYPE_##MODULE_OBJ_NAME); } \ + \ + static inline G_GNUC_UNUSED ModuleObjName * \ + MODULE_OBJ_NAME(void *obj) \ + { return OBJECT_CHECK(ModuleObjName, obj, \ + TYPE_##MODULE_OBJ_NAME); } + +/** + * OBJECT_DECLARE_SIMPLE_TYPE: + * @ModuleObjName: the object name with initial caps + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * @ParentModuleObjName: the parent object name with initial caps + * + * This does the same as OBJECT_DECLARE_TYPE(), but also declares + * the class struct, thus only the object struct needs to be declare + * manually. + * + * This macro should be used unless the class struct needs to have + * virtual methods declared. + */ +#define OBJECT_DECLARE_SIMPLE_TYPE(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, ParentModuleObjName) \ + OBJECT_DECLARE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME) \ + struct ModuleObjName##Class { ParentModuleObjName##Class parent_class; }; + + +/** + * OBJECT_DEFINE_TYPE_EXTENDED: + * @ModuleObjName: the object name with initial caps + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore + * separators + * @ABSTRACT: boolean flag to indicate whether the object can be instantiated + * @...: list of initializers for "InterfaceInfo" to declare implemented interfaces + * + * This macro is typically used in a source file, and will: + * + * - declare prototypes for _finalize, _class_init and _init methods + * - declare the TypeInfo struct instance + * - provide the constructor to register the type + * + * After using this macro, implementations of the _finalize, _class_init, + * and _init methods need to be written. Any of these can be zero-line + * no-op impls if no special logic is required for a given type. + * + * This macro should rarely be used, instead one of the more specialized + * macros is usually a better choice. + */ +#define OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \ + ABSTRACT, ...) \ + static void \ + module_obj_name##_finalize(Object *obj); \ + static void \ + module_obj_name##_class_init(ObjectClass *oc, void *data); \ + static void \ + module_obj_name##_init(Object *obj); \ + \ + static const TypeInfo module_obj_name##_info = { \ + .parent = TYPE_##PARENT_MODULE_OBJ_NAME, \ + .name = TYPE_##MODULE_OBJ_NAME, \ + .instance_size = sizeof(ModuleObjName), \ + .instance_init = module_obj_name##_init, \ + .instance_finalize = module_obj_name##_finalize, \ + .class_size = sizeof(ModuleObjName##Class), \ + .class_init = module_obj_name##_class_init, \ + .abstract = ABSTRACT, \ + .interfaces = (InterfaceInfo[]) { __VA_ARGS__ } , \ + }; \ + \ + static void \ + module_obj_name##_register_types(void) \ + { \ + type_register_static(&module_obj_name##_info); \ + } \ + type_init(module_obj_name##_register_types); + +/** + * OBJECT_DEFINE_TYPE: + * @ModuleObjName: the object name with initial caps + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore + * separators + * + * This is a specialization of OBJECT_DEFINE_TYPE_EXTENDED, which is suitable + * for the common case of a non-abstract type, without any interfaces. + */ +#define OBJECT_DEFINE_TYPE(ModuleObjName, module_obj_name, MODULE_OBJ_NAME, \ + PARENT_MODULE_OBJ_NAME) \ + OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \ + false, { NULL }) + +/** + * OBJECT_DEFINE_TYPE_WITH_INTERFACES: + * @ModuleObjName: the object name with initial caps + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore + * separators + * @...: list of initializers for "InterfaceInfo" to declare implemented interfaces + * + * This is a specialization of OBJECT_DEFINE_TYPE_EXTENDED, which is suitable + * for the common case of a non-abstract type, with one or more implemented + * interfaces. + * + * Note when passing the list of interfaces, be sure to include the final + * NULL entry, e.g. { TYPE_USER_CREATABLE }, { NULL } + */ +#define OBJECT_DEFINE_TYPE_WITH_INTERFACES(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, \ + PARENT_MODULE_OBJ_NAME, ...) \ + OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \ + false, __VA_ARGS__) + +/** + * OBJECT_DEFINE_ABSTRACT_TYPE: + * @ModuleObjName: the object name with initial caps + * @module_obj_name: the object name in lowercase with underscore separators + * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators + * @PARENT_MODULE_OBJ_NAME: the parent object name in uppercase with underscore + * separators + * + * This is a specialization of OBJECT_DEFINE_TYPE_EXTENDED, which is suitable + * for defining an abstract type, without any interfaces. + */ +#define OBJECT_DEFINE_ABSTRACT_TYPE(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME) \ + OBJECT_DEFINE_TYPE_EXTENDED(ModuleObjName, module_obj_name, \ + MODULE_OBJ_NAME, PARENT_MODULE_OBJ_NAME, \ + true, { NULL }) + /** * TypeInfo: * @name: The name of the type. From patchwork Thu Aug 13 22:26:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276559 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5BEAC433E1 for ; Thu, 13 Aug 2020 22:44:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D9112078B for ; Thu, 13 Aug 2020 22:44:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="A9HCM9y5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D9112078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Lxb-0000sC-Sq for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:44:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgj-0005kw-3A for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:09 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:57777 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgg-0002vO-Ug for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357626; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z3HxFyQ86E6nKsSmLHn0B7FErqvf0WT8MdOLvLIu8cg=; b=A9HCM9y536dsN39W2Apz/Vspnnld8DRd1VmdRJvnLtlKUI5L6u24LqHFjEQs80olbttxUO Xi6C5p5kf69n4yxaWQNK9aFEhlYSEX6zwW1q88WX1qE/bcXu6n5kb+WtKPqoKVccooOmij +vojKahNvgDmxNjbHCT/Qx/Dose1PYA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-hnHN63L8OHmWX0eU6oMmBg-1; Thu, 13 Aug 2020 18:27:04 -0400 X-MC-Unique: hnHN63L8OHmWX0eU6oMmBg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E286A57244 for ; Thu, 13 Aug 2020 22:27:03 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id A94F470880; Thu, 13 Aug 2020 22:27:03 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 30/41] qom: Make type checker functions accept const pointers Date: Thu, 13 Aug 2020 18:26:14 -0400 Message-Id: <20200813222625.243136-31-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The existing type check macros all unconditionally drop const qualifiers from their arguments. Keep this behavior in the macros generated by DECLARE_*CHECKER* by now. In the future, we might use _Generic to preserve const-ness of the cast function arguments. Signed-off-by: Eduardo Habkost --- include/qom/object.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 4cd84998c2..1d6a520d35 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -567,7 +567,7 @@ struct Object */ #define DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \ static inline G_GNUC_UNUSED InstanceType * \ - OBJ_NAME(void *obj) \ + OBJ_NAME(const void *obj) \ { return OBJECT_CHECK(InstanceType, obj, TYPENAME); } /** @@ -581,14 +581,16 @@ struct Object * * This macro will provide the three standard type cast functions for a * QOM type. + * + *FIXME: Use _Generic to make this const-safe */ #define DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME) \ static inline G_GNUC_UNUSED ClassType * \ - OBJ_NAME##_GET_CLASS(void *obj) \ + OBJ_NAME##_GET_CLASS(const void *obj) \ { return OBJECT_GET_CLASS(ClassType, obj, TYPENAME); } \ \ static inline G_GNUC_UNUSED ClassType * \ - OBJ_NAME##_CLASS(void *klass) \ + OBJ_NAME##_CLASS(const void *klass) \ { return OBJECT_CLASS_CHECK(ClassType, klass, TYPENAME); } /** From patchwork Thu Aug 13 22:26:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276558 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08892C433E1 for ; Thu, 13 Aug 2020 22:46:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C34D420771 for ; Thu, 13 Aug 2020 22:46:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="azcTuwVq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C34D420771 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LzM-00039v-Vk for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:46:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgk-0005pM-TI for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:10 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:20560 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgj-0002vd-4k for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QLkhYwIjKOcsX+gqfx6NBOr7j4QovayhCeZ+HkY7vB8=; b=azcTuwVqTu+hPJgKAfKxXWkocoTpbihLvzlgR/IBO4t7hbOapAaP9g9BtWqEdo/6IqO0TE 1HJSEw+H2AdWdOCTpMijC4shHVK+NMLCQGTtDWVa6kvG3QkCvoiFycdQl552IweQ/Dek0F hgIbYMrV12B2MYzKzSzuSvABaWS6rhQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-9uHj67N1Nk69AlwQAAvHFA-1; Thu, 13 Aug 2020 18:27:06 -0400 X-MC-Unique: 9uHj67N1Nk69AlwQAAvHFA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C280C807324 for ; Thu, 13 Aug 2020 22:27:05 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC878100EBC1; Thu, 13 Aug 2020 22:27:04 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 31/41] qom: TYPE_INFO macro Date: Thu, 13 Aug 2020 18:26:15 -0400 Message-Id: <20200813222625.243136-32-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Provide a TYPE_INFO macro that can be used to register a TypeInfo struct declaratively. This will allow QOM type registration to be 100% declarative. Signed-off-by: Eduardo Habkost --- include/qom/object.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 1d6a520d35..81bea3b4ed 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -655,6 +655,14 @@ struct Object struct InstanceType##Class { ParentClassType parent_class; }; +#define TYPE_INFO(type_info_var) \ + static void \ + register_type_info_##type_info_var(void) \ + { \ + type_register_static(&type_info_var); \ + } \ + type_init(register_type_info_##type_info_var); + /** * OBJECT_DEFINE_TYPE_EXTENDED: * @ModuleObjName: the object name with initial caps @@ -700,12 +708,7 @@ struct Object .interfaces = (InterfaceInfo[]) { __VA_ARGS__ } , \ }; \ \ - static void \ - module_obj_name##_register_types(void) \ - { \ - type_register_static(&module_obj_name##_info); \ - } \ - type_init(module_obj_name##_register_types); + TYPE_INFO(module_obj_name##_info) /** * OBJECT_DEFINE_TYPE: From patchwork Thu Aug 13 22:26:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276556 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E73A5C433DF for ; Thu, 13 Aug 2020 22:49:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9399A207DA for ; Thu, 13 Aug 2020 22:49:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="G9hB000D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9399A207DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6M2R-0007Yp-Th for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:49:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgy-0006HI-GF for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:24 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:49442 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgt-0002wJ-MU for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UHFfOKFsvubLWkZfcqmVlw75qx4LrHz0fuGLDXYkqNk=; b=G9hB000Dd/SrrClSows13FEjSpx5nLxle8Qmcve8iFzfZMH9LUC29HtSrq1pmhTRB0QteM ZojtZ+w5hG1M6+sZ0QGVEhJnyxSWK1tH+cJWdfXwU25JPhD9ubmFK9u7mRZ2JGB+f4csG0 +QMm/yoh6586UGBHyW+KZBKUJM7MjOI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-HNsfB-zgNaWglQzNuhNTUQ-1; Thu, 13 Aug 2020 18:27:09 -0400 X-MC-Unique: HNsfB-zgNaWglQzNuhNTUQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2AA91100CA89 for ; Thu, 13 Aug 2020 22:27:08 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CD1560498; Thu, 13 Aug 2020 22:27:06 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 32/41] codeconverter: script for automating QOM code cleanups Date: Thu, 13 Aug 2020 18:26:16 -0400 Message-Id: <20200813222625.243136-33-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This started as a simple script that scanned for regular expressions, but became more and more complex when exceptions to the rules were found. I don't know if this should be maintained in the QEMU source tree long term (maybe it can be reused for other code transformations that Coccinelle can't handle). In either case, this is included as part of the patch series to document how exactly the automated code transformations in the next patches were done. Signed-off-by: Eduardo Habkost --- .../codeconverter/codeconverter/__init__.py | 0 .../codeconverter/codeconverter/patching.py | 369 +++++++++++ .../codeconverter/codeconverter/qom_macros.py | 614 ++++++++++++++++++ .../codeconverter/qom_type_info.py | 314 +++++++++ .../codeconverter/codeconverter/regexps.py | 89 +++ .../codeconverter/test_patching.py | 98 +++ .../codeconverter/test_regexps.py | 272 ++++++++ scripts/codeconverter/codeconverter/utils.py | 65 ++ scripts/codeconverter/converter.py | 113 ++++ 9 files changed, 1934 insertions(+) create mode 100644 scripts/codeconverter/codeconverter/__init__.py create mode 100644 scripts/codeconverter/codeconverter/patching.py create mode 100644 scripts/codeconverter/codeconverter/qom_macros.py create mode 100644 scripts/codeconverter/codeconverter/qom_type_info.py create mode 100644 scripts/codeconverter/codeconverter/regexps.py create mode 100644 scripts/codeconverter/codeconverter/test_patching.py create mode 100644 scripts/codeconverter/codeconverter/test_regexps.py create mode 100644 scripts/codeconverter/codeconverter/utils.py create mode 100755 scripts/codeconverter/converter.py diff --git a/scripts/codeconverter/codeconverter/__init__.py b/scripts/codeconverter/codeconverter/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/codeconverter/codeconverter/patching.py b/scripts/codeconverter/codeconverter/patching.py new file mode 100644 index 0000000000..1c722786d2 --- /dev/null +++ b/scripts/codeconverter/codeconverter/patching.py @@ -0,0 +1,369 @@ +from typing import IO, Match, NamedTuple, Optional, Literal, Iterable, Type, Dict, List, Any, TypeVar, NewType, Tuple +from itertools import chain +from tempfile import NamedTemporaryFile +import os +import re +import subprocess +from io import StringIO + +import logging +logger = logging.getLogger(__name__) +DBG = logger.debug +INFO = logger.info +WARN = logger.warning +ERROR = logger.error + +from .utils import * + +T = TypeVar('T') + +class Patch(NamedTuple): + # start inside file.original_content + start: int + # end position inside file.original_content + end: int + # replacement string for file.original_content[start:end] + replacement: str + +IdentifierType = Literal['type', 'symbol', 'include', 'constant'] +class RequiredIdentifier(NamedTuple): + type: IdentifierType + name: str + +class FileMatch: + """Base class for regex matches + + Subclasses just need to set the `regexp` class attribute + """ + regexp: Optional[str] = None + + def __init__(self, f: 'FileInfo', m: Match) -> None: + self.file: 'FileInfo' = f + self.match: Match = m + + @property + def name(self) -> str: + if 'name' not in self.match.groupdict(): + return '[no name]' + return self.group('name') + + @classmethod + def compiled_re(klass): + return re.compile(klass.regexp, re.MULTILINE) + + def start(self) -> int: + return self.match.start() + + def end(self) -> int: + return self.match.end() + + def line_col(self) -> LineAndColumn: + return self.file.line_col(self.start()) + + def group(self, *args): + return self.match.group(*args) + + def log(self, level, fmt, *args) -> None: + pos = self.line_col() + logger.log(level, '%s:%d:%d: '+fmt, self.file.filename, pos.line, pos.col, *args) + + def warn(self, fmt, *args) -> None: + self.log(logging.WARNING, fmt, *args) + + def error(self, fmt, *args) -> None: + self.log(logging.ERROR, fmt, *args) + + def sub(self, original: str, replacement: str) -> str: + """Replace content + + XXX: this won't use the match position, but will just + replace all strings that look like the original match. + This should be enough for all the patterns used in this + script. + """ + return original.replace(self.group(0), replacement) + + def sanity_check(self) -> None: + """Sanity check match, and print warnings if necessary""" + pass + + def replacement(self) -> Optional[str]: + """Return replacement text for pattern, to use new code conventions""" + return None + + def make_patch(self, replacement: str) -> 'Patch': + """Make patch replacing the content of this match""" + return Patch(self.start(), self.end(), replacement) + + def make_removal_patch(self) -> 'Patch': + """Make patch removing contents of match completely""" + return self.make_patch('') + + def append(self, s: str) -> 'Patch': + """Make patch appending string after this match""" + return Patch(self.end(), self.end(), s) + + def prepend(self, s: str) -> 'Patch': + """Make patch prepending string before this match""" + return Patch(self.start(), self.start(), s) + + def gen_patches(self) -> Iterable['Patch']: + """Patch source code contents to use new code patterns""" + replacement = self.replacement() + if replacement is not None: + yield self.make_patch(replacement) + + @classmethod + def has_replacement_rule(klass) -> bool: + return (klass.gen_patches is not FileMatch.gen_patches + or klass.replacement is not FileMatch.replacement) + + def contains(self, other: 'FileMatch') -> bool: + return other.start() >= self.start() and other.end() <= self.end() + + def __repr__(self) -> str: + start = self.file.line_col(self.start()) + end = self.file.line_col(self.end() - 1) + return '<%s %s at %d:%d-%d:%d: %r>' % (self.__class__.__name__, + self.name, + start.line, start.col, + end.line, end.col, self.group(0)[:100]) + + def required_identifiers(self) -> Iterable[RequiredIdentifier]: + """Can be implemented by subclasses to keep track of identifier references + + This method will be used by the code that moves declarations around the file, + to make sure we find the right spot for them. + """ + raise NotImplementedError() + + def provided_identifiers(self) -> Iterable[RequiredIdentifier]: + """Can be implemented by subclasses to keep track of identifier references + + This method will be used by the code that moves declarations around the file, + to make sure we find the right spot for them. + """ + raise NotImplementedError() + + @classmethod + def find_matches(klass, content: str) -> Iterable[Match]: + """Generate match objects for class + + Might be reimplemented by subclasses if they + intend to look for matches using a different method. + """ + return klass.compiled_re().finditer(content) + + @property + def allfiles(self) -> 'FileList': + return self.file.allfiles + +def all_subclasses(c: Type[FileMatch]) -> Iterable[Type[FileMatch]]: + for sc in c.__subclasses__(): + yield sc + yield from all_subclasses(sc) + +def match_class_dict() -> Dict[str, Type[FileMatch]]: + d = dict((t.__name__, t) for t in all_subclasses(FileMatch)) + return d + +def names(matches: Iterable[FileMatch]) -> Iterable[str]: + return [m.name for m in matches] + +class PatchingError(Exception): + pass + +class OverLappingPatchesError(PatchingError): + pass + +def apply_patches(s: str, patches: Iterable[Patch]) -> str: + """Apply a sequence of patches to string + + >>> apply_patches('abcdefg', [Patch(2,2,'xxx'), Patch(0, 1, 'yy')]) + 'yybxxxcdefg' + """ + r = StringIO() + last = 0 + for p in sorted(patches): + DBG("Applying patch at position %d (%s) - %d (%s): %r", p.start, line_col(s, p.start), p.end, line_col(s, p.end), p.replacement) + if last > p.start: + raise OverLappingPatchesError("Overlapping patch at position %d (%s), last patch at %d (%s)" % \ + (p.start, line_col(s, p.start), last, line_col(s, last))) + r.write(s[last:p.start]) + r.write(p.replacement) + last = p.end + r.write(s[last:]) + return r.getvalue() + +class RegexpScanner: + def __init__(self) -> None: + self.match_index: Dict[Type[Any], List[FileMatch]] = {} + self.match_name_index: Dict[Tuple[Type[Any], str, str], Optional[FileMatch]] = {} + + def _find_matches(self, klass: Type[Any]) -> Iterable[FileMatch]: + raise NotImplementedError() + + def matches_of_type(self, t: Type[T]) -> Iterable[T]: + if t not in self.match_index: + self.match_index[t] = list(self._find_matches(t)) + return self.match_index[t] # type: ignore + + def find_match(self, t: Type[T], name: str, group: str='name') -> Optional[T]: + indexkey = (t, name, group) + if indexkey in self.match_name_index: + return self.match_name_index[indexkey] # type: ignore + r: Optional[T] = None + for m in self.matches_of_type(t): + assert isinstance(m, FileMatch) + if m.group(group) == name: + r = m # type: ignore + self.match_name_index[indexkey] = r # type: ignore + return r + + def reset_index(self) -> None: + self.match_index.clear() + self.match_name_index.clear() + +class FileInfo(RegexpScanner): + filename: str + original_content: Optional[str] = None + + def __init__(self, files: 'FileList', filename:str, force:bool=False) -> None: + super().__init__() + self.allfiles = files + self.filename = filename + self.patches: List[Patch] = [] + self.force = force + + def __repr__(self) -> str: + return f'' + + def line_col(self, start: int) -> LineAndColumn: + """Return line and column for a match object inside original_content""" + return line_col(self.original_content, start) + + def _find_matches(self, klass: Type[Any]) -> List[FileMatch]: + """Build FileMatch objects for each match of regexp""" + if not hasattr(klass, 'regexp') or klass.regexp is None: + return [] + assert hasattr(klass, 'regexp') + DBG("scanning for %s", klass.__name__) + DBG("regexp: %s", klass.regexp) + matches = [klass(self, m) for m in klass.find_matches(self.original_content)] + DBG('%s: %d matches found for %s: %s', self.filename, len(matches), + klass.__name__,' '.join(names(matches))) + return matches + + def find_match(self, t: Type[T], name: str, group: str='name') -> Optional[T]: + for m in self.matches_of_type(t): + assert isinstance(m, FileMatch) + if m.group(group) == name: + return m # type: ignore + return None + + def reset_content(self, s:str): + self.original_content = s + self.patches.clear() + self.reset_index() + self.allfiles.reset_index() + + def load(self) -> None: + if self.original_content is not None: + return + with open(self.filename, 'rt') as f: + self.reset_content(f.read()) + + @property + def all_matches(self) -> Iterable[FileMatch]: + lists = list(self.match_index.values()) + return (m for l in lists + for m in l) + + def scan_for_matches(self, class_names: Optional[List[str]]=None) -> None: + DBG("class names: %r", class_names) + class_dict = match_class_dict() + if class_names is None: + DBG("default class names") + class_names = list(name for name,klass in class_dict.items() + if klass.has_replacement_rule()) + DBG("class_names: %r", class_names) + for cn in class_names: + matches = self.matches_of_type(class_dict[cn]) + if len(matches) > 0: + INFO('%s: %d matches found for %s: %s', self.filename, + len(matches), cn, ' '.join(names(matches))) + + def gen_patches(self) -> None: + for m in self.all_matches: + for i,p in enumerate(m.gen_patches()): + DBG("patch %d generated by %r:", i, m) + DBG("replace contents at %s-%s with %r", + self.line_col(p.start), self.line_col(p.end), p.replacement) + self.patches.append(p) + + def patch_content(self, max_passes=0, class_names: Optional[List[str]]=None) -> None: + """Multi-pass content patching loop + + We run multiple passes because there are rules that will + delete init functions once they become empty. + """ + passes = 0 + total_patches = 0 + DBG("max_passes: %r", max_passes) + while not max_passes or max_passes <= 0 or passes < max_passes: + passes += 1 + self.scan_for_matches(class_names) + self.gen_patches() + DBG("patch content: pass %d: %d patches generated", passes, len(self.patches)) + total_patches += len(self.patches) + if not self.patches: + break + try: + self.apply_patches() + except PatchingError: + logger.exception("%s: failed to patch file", self.filename) + INFO("%s: %d patches applied total in %d passes", self.filename, total_patches, passes) + + def apply_patches(self) -> None: + """Replace self.original_content after applying patches from self.patches""" + self.reset_content(self.get_patched_content()) + + def get_patched_content(self) -> str: + assert self.original_content is not None + return apply_patches(self.original_content, self.patches) + + def write_to_file(self, f: IO[str]) -> None: + f.write(self.get_patched_content()) + + def write_to_filename(self, filename: str) -> None: + with open(filename, 'wt') as of: + self.write_to_file(of) + + def patch_inplace(self) -> None: + newfile = self.filename+'changed' + self.write_to_filename(newfile) + os.rename(newfile, self.filename) + + def show_diff(self) -> None: + with NamedTemporaryFile('wt') as f: + self.write_to_file(f) + f.flush() + subprocess.call(['diff', '-u', self.filename, f.name]) + + def ref(self): + return TypeInfoReference + +class FileList(RegexpScanner): + def __init__(self): + super().__init__() + self.files: List[FileInfo] = [] + + def extend(self, *args, **kwargs): + self.files.extend(*args, **kwargs) + + def __iter__(self): + return iter(self.files) + + def _find_matches(self, klass: Type[Any]) -> Iterable[FileMatch]: + return chain(*(f._find_matches(klass) for f in self.files)) + diff --git a/scripts/codeconverter/codeconverter/qom_macros.py b/scripts/codeconverter/codeconverter/qom_macros.py new file mode 100644 index 0000000000..67f1a0b2e5 --- /dev/null +++ b/scripts/codeconverter/codeconverter/qom_macros.py @@ -0,0 +1,614 @@ +import re +from itertools import chain +from typing import * + +from .regexps import * +from .patching import * +from .utils import * + +import logging +logger = logging.getLogger(__name__) +DBG = logger.debug +INFO = logger.info +WARN = logger.warning + +# simple expressions: + +RE_CONSTANT = OR(RE_STRING, RE_NUMBER) + +class ConstantDefine(FileMatch): + """Simple #define preprocessor directive for a constant""" + # if the macro contents are very simple, it might be included + # in the match group 'value' + regexp = S(r'^[ \t]*#[ \t]*define', CPP_SPACE, NAMED('name', RE_IDENTIFIER), + CPP_SPACE, NAMED('value', RE_CONSTANT), r'[ \t]*\n') + + def provided_identifiers(self) -> Iterable[RequiredIdentifier]: + yield RequiredIdentifier('constant', self.group('name')) + +class TypeIdentifiers(NamedTuple): + """Type names found in type declarations""" + # TYPE_MYDEVICE + typename: Optional[str] + # MYDEVICE + uppercase: Optional[str] = None + # MyDevice + instancetype: Optional[str] = None + # MyDeviceClass + classtype: Optional[str] = None + # my_device + lowercase: Optional[str] = None + + def allfields(self): + return tuple(getattr(self, f) for f in self._fields) + + def merge(self, other: 'TypeIdentifiers') -> Optional['TypeIdentifiers']: + """Check if identifiers match, return new identifier with complete list""" + if any(not opt_compare(a, b) for a,b in zip(self, other)): + return None + return TypeIdentifiers(*(merge(a, b) for a,b in zip(self, other))) + + def __str__(self) -> str: + values = ((f, getattr(self, f)) for f in self._fields) + s = ', '.join('%s=%s' % (f,v) for f,v in values if v is not None) + return f'{s}' + + def check_consistency(self) -> List[str]: + """Check if identifiers are consistent with each other, + return list of problems (or empty list if everything seems consistent) + """ + r = [] + if self.typename is None: + r.append("typename (TYPE_MYDEVICE) is unavailable") + + if self.uppercase is None: + r.append("uppercase name is unavailable") + + if (self.instancetype is not None + and self.classtype is not None + and self.classtype != f'{self.instancetype}Class'): + r.append("class typedef %s doesn't match instance typedef %s" % + (self.classtype, self.instancetype)) + + if (self.uppercase is not None + and self.typename is not None + and f'TYPE_{self.uppercase}' != self.typename): + r.append("uppercase name (%s) doesn't match type name (%s)" % + (self.uppercase, self.typename)) + + return r + +class TypedefMatch(FileMatch): + """typedef declaration""" + def provided_identifiers(self) -> Iterable[RequiredIdentifier]: + yield RequiredIdentifier('type', self.group('name')) + +class SimpleTypedefMatch(TypedefMatch): + """Simple typedef declaration + (no replacement rules)""" + regexp = S(r'^[ \t]*typedef', SP, + NAMED('typedef_type', RE_TYPE), SP, + NAMED('name', RE_IDENTIFIER), r'\s*;[ \t]*\n') + +RE_MACRO_DEFINE = S(r'^[ \t]*#\s*define\s+', NAMED('name', RE_IDENTIFIER), + r'\s*\(\s*', RE_IDENTIFIER, r'\s*\)', CPP_SPACE) + +RE_STRUCT_ATTRIBUTE = r'QEMU_PACKED' + +# This doesn't parse the struct definitions completely, it just assumes +# the closing brackets are going to be in an unindented line: +RE_FULL_STRUCT = S('struct', SP, M(RE_IDENTIFIER, n='?', name='structname'), SP, + NAMED('body', r'{\n', + # acceptable inside the struct body: + # - lines starting with space or tab + # - empty lines + # - preprocessor directives + # - comments + OR(r'[ \t][^\n]*\n', + r'#[^\n]*\n', + r'\n', + S(r'[ \t]*', RE_COMMENT, r'[ \t]*\n'), + repeat='*?'), + r'}', M(RE_STRUCT_ATTRIBUTE, SP, n='*'))) +RE_STRUCT_TYPEDEF = S(r'^[ \t]*typedef', SP, RE_FULL_STRUCT, SP, + NAMED('name', RE_IDENTIFIER), r'\s*;[ \t]*\n') + +class FullStructTypedefMatch(TypedefMatch): + """typedef struct [SomeStruct] { ...} SomeType + Will be replaced by separate struct declaration + typedef + """ + regexp = RE_STRUCT_TYPEDEF + + def make_structname(self) -> str: + """Make struct name for struct+typedef split""" + name = self.group('structname') + if not name: + name = self.name + return name + + def strip_typedef(self) -> Patch: + """generate patch that will strip typedef from the struct declartion + + The caller is responsible for readding the typedef somewhere else. + """ + name = self.make_structname() + body = self.group('body') + return self.make_patch(f'struct {name} {body};\n') + + def make_simple_typedef(self) -> str: + structname = self.make_structname() + name = self.name + return f'typedef struct {structname} {name};\n' + + def move_typedef(self, position) -> Iterator[Patch]: + """Generate patches to move typedef elsewhere""" + yield self.strip_typedef() + yield Patch(position, position, self.make_simple_typedef()) + + def split_typedef(self) -> Iterator[Patch]: + """Split into struct definition + typedef in-place""" + yield self.strip_typedef() + yield self.append(self.make_simple_typedef()) + +class StructTypedefSplit(FullStructTypedefMatch): + """split struct+typedef declaration""" + def gen_patches(self) -> Iterator[Patch]: + if self.group('structname'): + yield from self.split_typedef() + +class DuplicatedTypedefs(SimpleTypedefMatch): + """Delete ALL duplicate typedefs (unsafe)""" + def gen_patches(self) -> Iterable[Patch]: + other_td = [td for td in chain(self.file.matches_of_type(SimpleTypedefMatch), + self.file.matches_of_type(FullStructTypedefMatch)) + if td.name == self.name] + DBG("other_td: %r", other_td) + if any(td.start() < self.start() for td in other_td): + # patch only if handling the first typedef + return + for td in other_td: + if isinstance(td, SimpleTypedefMatch): + DBG("other td: %r", td.match.groupdict()) + if td.group('typedef_type') != self.group('typedef_type'): + yield td.make_removal_patch() + elif isinstance(td, FullStructTypedefMatch): + DBG("other td: %r", td.match.groupdict()) + if self.group('typedef_type') == 'struct '+td.group('structname'): + yield td.strip_typedef() + +class QOMDuplicatedTypedefs(DuplicatedTypedefs): + """Delete duplicate typedefs if used by QOM type""" + def gen_patches(self) -> Iterable[Patch]: + qom_macros = [TypeCheckMacro, DeclareInstanceChecker, DeclareClassCheckers, DeclareObjCheckers] + qom_matches = chain(*(self.file.matches_of_type(t) for t in qom_macros)) + in_use = any(RequiredIdentifier('type', self.name) in m.required_identifiers() + for m in qom_matches) + if in_use: + yield from DuplicatedTypedefs.gen_patches(self) + +class QOMStructTypedefSplit(FullStructTypedefMatch): + """split struct+typedef declaration if used by QOM type""" + def gen_patches(self) -> Iterator[Patch]: + qom_macros = [TypeCheckMacro, DeclareInstanceChecker, DeclareClassCheckers, DeclareObjCheckers] + qom_matches = chain(*(self.file.matches_of_type(t) for t in qom_macros)) + in_use = any(RequiredIdentifier('type', self.name) in m.required_identifiers() + for m in qom_matches) + if in_use: + yield from self.split_typedef() + +def typedefs(file: FileInfo) -> Iterable[TypedefMatch]: + return (cast(TypedefMatch, m) + for m in chain(file.matches_of_type(SimpleTypedefMatch), + file.matches_of_type(FullStructTypedefMatch))) + +def find_typedef(f: FileInfo, name: Optional[str]) -> Optional[TypedefMatch]: + if not name: + return None + for td in typedefs(f): + if td.name == name: + return td + return None + +CHECKER_MACROS = ['OBJECT_CHECK', 'OBJECT_CLASS_CHECK', 'OBJECT_GET_CLASS'] +CheckerMacroName = Literal['OBJECT_CHECK', 'OBJECT_CLASS_CHECK', 'OBJECT_GET_CLASS'] + +RE_CHECK_MACRO = \ + S(RE_MACRO_DEFINE, + OR(*CHECKER_MACROS, name='checker'), + M(r'\s*\(\s*', OR(NAMED('typedefname', RE_IDENTIFIER), RE_TYPE, name='c_type'), r'\s*,', CPP_SPACE, + OPTIONAL_PARS(RE_IDENTIFIER), r',', CPP_SPACE, + NAMED('qom_typename', RE_IDENTIFIER), r'\s*\)\n', + n='?', name='check_args')) + +EXPECTED_CHECKER_SUFFIXES: List[Tuple[CheckerMacroName, str]] = [ + ('OBJECT_GET_CLASS', '_GET_CLASS'), + ('OBJECT_CLASS_CHECK', '_CLASS'), +] + +class TypeCheckMacro(FileMatch): + """OBJECT_CHECK/OBJECT_CLASS_CHECK/OBJECT_GET_CLASS macro definitions + Will be replaced by DECLARE_*_CHECKERS macro + """ + #TODO: handle and convert INTERFACE_CHECK macros + regexp = RE_CHECK_MACRO + + @property + def checker(self) -> CheckerMacroName: + """Name of checker macro being used""" + return self.group('checker') + + @property + def typedefname(self) -> Optional[str]: + return self.group('typedefname') + + def find_typedef(self) -> Optional[TypedefMatch]: + return find_typedef(self.file, self.typedefname) + + def sanity_check(self) -> None: + DBG("groups: %r", self.match.groups()) + if not self.group('check_args'): + self.warn("type check macro not parsed completely: %s", self.name) + return + DBG("type identifiers: %r", self.type_identifiers) + if self.typedefname and self.find_typedef() is None: + self.warn("typedef used by %s not found", self.name) + + def find_matching_macros(self) -> List['TypeCheckMacro']: + """Find other check macros that generate the same macro names + + The returned list will always be sorted. + """ + my_ids = self.type_identifiers + assert my_ids + return [m for m in self.file.matches_of_type(TypeCheckMacro) + if m.type_identifiers is not None + and my_ids.uppercase is not None + and (my_ids.uppercase == m.type_identifiers.uppercase + or my_ids.typename == m.type_identifiers.typename)] + + def merge_ids(self, matches: List['TypeCheckMacro']) -> Optional[TypeIdentifiers]: + """Try to merge info about type identifiers from all matches in a list""" + if not matches: + return None + r = matches[0].type_identifiers + if r is None: + return None + for m in matches[1:]: + assert m.type_identifiers + new = r.merge(m.type_identifiers) + if new is None: + self.warn("macro %s identifiers (%s) don't match macro %s (%s)", + matches[0].name, r, m.name, m.type_identifiers) + return None + r = new + return r + + def required_identifiers(self) -> Iterable[RequiredIdentifier]: + yield RequiredIdentifier('include', '"qom/object.h"') + if self.type_identifiers is None: + return + # to make sure typedefs will be moved above all related macros, + # return dependencies from all of them, not just this match + for m in self.find_matching_macros(): + yield RequiredIdentifier('type', m.group('c_type')) + yield RequiredIdentifier('constant', m.group('qom_typename')) + + @property + def type_identifiers(self) -> Optional[TypeIdentifiers]: + """Extract type identifier information from match""" + typename = self.group('qom_typename') + c_type = self.group('c_type') + if not typename or not c_type: + return None + typedef = self.group('typedefname') + classtype = None + instancetype = None + uppercase = None + expected_suffix = dict(EXPECTED_CHECKER_SUFFIXES).get(self.checker) + + # here the available data depends on the checker macro being called: + # - we need to remove the suffix from the macro name + # - depending on the macro type, we know the class type name, or + # the instance type name + if self.checker in ('OBJECT_GET_CLASS', 'OBJECT_CLASS_CHECK'): + classtype = c_type + elif self.checker == 'OBJECT_CHECK': + instancetype = c_type + uppercase = self.name + else: + assert False + if expected_suffix and self.name.endswith(expected_suffix): + uppercase = self.name[:-len(expected_suffix)] + return TypeIdentifiers(typename=typename, classtype=classtype, + instancetype=instancetype, uppercase=uppercase) + + def gen_patches(self) -> Iterable[Patch]: + if self.type_identifiers is None: + self.warn("couldn't extract type information from macro %s", self.name) + return + + if self.name == 'INTERFACE_CLASS': + # INTERFACE_CLASS is special and won't be patched + return + + for checker,suffix in EXPECTED_CHECKER_SUFFIXES: + if self.name.endswith(suffix): + if self.checker != checker: + self.warn("macro %s is using macro %s instead of %s", self.name, self.checker, checker) + return + break + + matches = self.find_matching_macros() + DBG("found %d matching macros: %s", len(matches), ' '.join(m.name for m in matches)) + # we will generate patches only when processing the first macro: + if matches[0].start != self.start: + DBG("skipping %s (will patch when handling %s)", self.name, matches[0].name) + return + + + ids = self.merge_ids(matches) + if ids is None: + DBG("type identifier mismatch, won't patch %s", self.name) + return + + if not ids.uppercase: + self.warn("macro %s doesn't follow the expected name pattern", self.name) + return + if not ids.typename: + self.warn("macro %s: couldn't extract type name", self.name) + return + + #issues = ids.check_consistency() + #if issues: + # for i in issues: + # self.warn("inconsistent identifiers: %s", i) + + names = [n for n in (ids.instancetype, ids.classtype, ids.uppercase, ids.typename) + if n is not None] + if len(set(names)) != len(names): + self.warn("duplicate names used by macro: %r", ids) + return + + assert ids.classtype or ids.instancetype + assert ids.typename + assert ids.uppercase + if ids.classtype and ids.instancetype: + new_decl = (f'DECLARE_OBJ_CHECKERS({ids.instancetype}, {ids.classtype},\n' + f' {ids.uppercase}, {ids.typename})\n') + elif ids.classtype: + new_decl = (f'DECLARE_CLASS_CHECKERS({ids.classtype}, {ids.uppercase},\n' + f' {ids.typename})\n') + elif ids.instancetype: + new_decl = (f'DECLARE_INSTANCE_CHECKER({ids.instancetype}, {ids.uppercase},\n' + f' {ids.typename})\n') + else: + assert False + + # we need to ensure the typedefs are already available + ok = True + for t in [ids.instancetype, ids.classtype]: + if not t: + continue + td = find_typedef(self.file, t) + if not td: + self.warn("couldn't find typedef %s", t) + ok = False + elif td.start() > self.start(): + self.warn("typedef %s need to be moved earlier in the file", td.name) + ok = False + + if not ok and not self.file.force: + return + + # delete all matching macros and add new declaration: + for m in matches: + yield m.make_patch('') + yield self.append(new_decl) + +class DeclareInstanceChecker(FileMatch): + """DECLARE_INSTANCE_CHECKER use + Will be replaced with DECLARE_OBJ_CHECKERS if possible + """ + #TODO: replace lonely DECLARE_INSTANCE_CHECKER with DECLARE_OBJ_CHECKERS + # if all types are found. + # This will require looking up the correct class type in the TypeInfo + # structs in another file + regexp = S(r'^[ \t]*DECLARE_INSTANCE_CHECKER\s*\(\s*', + NAMED('instancetype', RE_IDENTIFIER), r'\s*,\s*', + NAMED('uppercase', RE_IDENTIFIER), r'\s*,\s*', + NAMED('typename', RE_IDENTIFIER), SP, + r'\)[ \t]*;?[ \t]*\n') + + def required_identifiers(self) -> Iterable[RequiredIdentifier]: + yield RequiredIdentifier('include', '"qom/object.h"') + yield RequiredIdentifier('constant', self.group('typename')) + yield RequiredIdentifier('type', self.group('instancetype')) + +class DeclareClassCheckers(FileMatch): + """DECLARE_INSTANCE_CHECKER use""" + regexp = S(r'^[ \t]*DECLARE_CLASS_CHECKERS\s*\(\s*', + NAMED('classtype', RE_IDENTIFIER), r'\s*,\s*', + NAMED('uppercase', RE_IDENTIFIER), r'\s*,\s*', + NAMED('typename', RE_IDENTIFIER), SP, + r'\)[ \t]*;?[ \t]*\n') + + def required_identifiers(self) -> Iterable[RequiredIdentifier]: + yield RequiredIdentifier('include', '"qom/object.h"') + yield RequiredIdentifier('constant', self.group('typename')) + yield RequiredIdentifier('type', self.group('classtype')) + +class DeclareObjCheckers(FileMatch): + """DECLARE_OBJ_CHECKERS use + Will be replaced with OBJECT_DECLARE_TYPE if possible + """ + #TODO: detect when OBJECT_DECLARE_SIMPLE_TYPE can be used + regexp = S(r'^[ \t]*DECLARE_OBJ_CHECKERS\s*\(\s*', + NAMED('instancetype', RE_IDENTIFIER), r'\s*,\s*', + NAMED('classtype', RE_IDENTIFIER), r'\s*,\s*', + NAMED('uppercase', RE_IDENTIFIER), r'\s*,\s*', + NAMED('typename', RE_IDENTIFIER), SP, + r'\)[ \t]*;?[ \t]*\n') + + def required_identifiers(self) -> Iterable[RequiredIdentifier]: + yield RequiredIdentifier('include', '"qom/object.h"') + yield RequiredIdentifier('constant', self.group('typename')) + yield RequiredIdentifier('type', self.group('classtype')) + yield RequiredIdentifier('type', self.group('instancetype')) + + def gen_patches(self): + ids = TypeIdentifiers(uppercase=self.group('uppercase'), + typename=self.group('typename'), + classtype=self.group('classtype'), + instancetype=self.group('instancetype')) + issues = ids.check_consistency() + if issues: + for i in issues: + self.warn("inconsistent identifiers: %s", i) + return + + if self.group('typename') != 'TYPE_'+self.group('uppercase'): + self.warn("type %s mismatch with uppercase name %s", ids.typename, ids.uppercase) + return + + typedefs = [(t,self.file.find_match(SimpleTypedefMatch, t)) + for t in (ids.instancetype, ids.classtype)] + for t,td in typedefs: + if td is None: + self.warn("typedef %s not found", t) + break + if td.start() > self.start(): + self.warn("typedef %s needs to be move earlier in the file", t) + break + #HACK: check if typedef is used between its definition and the macro + #TODO: check if the only match is inside the "struct { ... }" declaration + if re.search(r'\b'+t+r'\b', self.file.original_content[td.end():self.start()]): + self.warn("typedef %s can't be moved, it is used before the macro", t) + break + else: + for t,td in typedefs: + yield td.make_removal_patch() + + lowercase = ids.uppercase.lower() + # all is OK, we can replace the macro! + c = (f'OBJECT_DECLARE_TYPE({ids.instancetype}, {ids.classtype},\n' + f' {lowercase}, {ids.uppercase})\n') + yield self.make_patch(c) + +class TrivialClassStruct(FileMatch): + """Trivial class struct""" + regexp = S(r'^[ \t]*struct\s*', NAMED('name', RE_IDENTIFIER), + r'\s*{\s*', NAMED('parent_struct', RE_IDENTIFIER), r'\s*parent(_class)?\s*;\s*};\n') + +class ObjectDeclareType(FileMatch): + """OBJECT_DECLARE_TYPE usage + Will be replaced with OBJECT_DECLARE_SIMPLE_TYPE if possible + """ + regexp = S(r'^[ \t]*OBJECT_DECLARE_TYPE\s*\(', + NAMED('instancetype', RE_IDENTIFIER), r'\s*,\s*', + NAMED('classtype', RE_IDENTIFIER), r'\s*,\s*', + NAMED('lowercase', RE_IDENTIFIER), r'\s*,\s*', + NAMED('uppercase', RE_IDENTIFIER), SP, + r'\)[ \t]*;?[ \t]*\n') + + def gen_patches(self): + DBG("groups: %r", self.match.groupdict()) + trivial_struct = self.file.find_match(TrivialClassStruct, self.group('classtype')) + if trivial_struct: + d = self.match.groupdict().copy() + d['parent_struct'] = trivial_struct.group("parent_struct") + yield trivial_struct.make_removal_patch() + c = ("OBJECT_DECLARE_SIMPLE_TYPE(%(instancetype)s, %(lowercase)s,\n" + " %(uppercase)s, %(parent_struct)s)\n" % d) + yield self.make_patch(c) + +class Include(FileMatch): + """#include directive""" + regexp = RE_INCLUDE + def provided_identifiers(self) -> Iterable[RequiredIdentifier]: + yield RequiredIdentifier('include', self.group('includepath')) + +class InitialIncludes(FileMatch): + """Initial #include block""" + regexp = S(RE_FILE_BEGIN, + M(SP, RE_COMMENTS, + r'^[ \t]*#[ \t]*ifndef[ \t]+', RE_IDENTIFIER, r'[ \t]*\n', + n='?', name='ifndef_block'), + M(SP, RE_COMMENTS, + OR(RE_INCLUDE, RE_SIMPLEDEFINE), + n='*', name='includes')) + +class SymbolUserList(NamedTuple): + definitions: List[FileMatch] + users: List[FileMatch] + +class MoveSymbols(FileMatch): + """Handle missing symbols + - Move typedefs and defines when necessary + - Add missing #include lines when necessary + """ + regexp = RE_FILE_BEGIN + + def gen_patches(self) -> Iterator[Patch]: + index: Dict[RequiredIdentifier, SymbolUserList] = {} + definition_classes = [SimpleTypedefMatch, FullStructTypedefMatch, ConstantDefine, Include] + user_classes = [TypeCheckMacro, DeclareObjCheckers, DeclareInstanceChecker, DeclareClassCheckers] + + # first we scan for all symbol definitions and usage: + for dc in definition_classes: + defs = self.file.matches_of_type(dc) + for d in defs: + DBG("scanning %r", d) + for i in d.provided_identifiers(): + index.setdefault(i, SymbolUserList([], [])).definitions.append(d) + DBG("index: %r", list(index.keys())) + for uc in user_classes: + users = self.file.matches_of_type(uc) + for u in users: + for i in u.required_identifiers(): + index.setdefault(i, SymbolUserList([], [])).users.append(u) + + # validate all symbols: + for i,ul in index.items(): + if not ul.users: + # unused symbol + continue + + # symbol not defined + if len(ul.definitions) == 0: + if i.type == 'include': + includes, = self.file.matches_of_type(InitialIncludes) + yield includes.append(f'#include {i.name}\n') + else: + u.warn("definition of %s %s not found in file", i.type, i.name) + continue + + # symbol defined twice: + if len(ul.definitions) > 1: + ul.definitions[1].warn("%s defined twice", i.name) + ul.definitions[0].warn("previously defined here") + continue + + # symbol defined. check if all users are after its definition: + assert len(ul.definitions) == 1 + definition = ul.definitions[0] + DBG("handling repositioning of %r", definition) + earliest = min(ul.users, key=lambda u: u.start()) + if earliest.start() > definition.start(): + DBG("%r is OK", definition) + continue + + DBG("%r needs to be moved", definition) + if isinstance(definition, SimpleTypedefMatch) \ + or isinstance(definition, ConstantDefine): + # simple typedef or define can be moved directly: + yield definition.make_removal_patch() + yield earliest.prepend(definition.group(0)) + elif isinstance(definition, FullStructTypedefMatch) \ + and definition.group('structname'): + # full struct typedef is more complex: we need to remove + # the typedef + yield from definition.move_typedef(earliest.start()) + else: + definition.warn("definition of %s %s needs to be moved earlier in the file", i.type, i.name) + earliest.warn("definition of %s %s is used here", i.type, i.name) + diff --git a/scripts/codeconverter/codeconverter/qom_type_info.py b/scripts/codeconverter/codeconverter/qom_type_info.py new file mode 100644 index 0000000000..a2afc0d928 --- /dev/null +++ b/scripts/codeconverter/codeconverter/qom_type_info.py @@ -0,0 +1,314 @@ +from .regexps import * +from .patching import * +from .utils import * +from .qom_macros import * + +RE_SIMPLE_VALUE = OR(RE_IDENTIFIER, RE_STRING, RE_NUMBER) + +RE_FUN_CALL = S(RE_IDENTIFIER, r'\s*\(\s*', RE_SIMPLE_VALUE, r'\s*\)') +RE_SIZEOF = S(r'sizeof\s*\(\s*', NAMED('sizeoftype', RE_TYPE), r'\s*\)') + +RE_ADDRESS = S(r'&\s*', RE_IDENTIFIER) + +RE_ARRAY_ITEM = S(r'{\s*', NAMED('arrayitem', M(RE_SIMPLE_VALUE, n='?')), r'\s*}\s*,?') +RE_ARRAY_CAST = S(r'\(\s*', RE_IDENTIFIER, r'\s*\[\s*\]\)') +RE_ARRAY_ITEMS = M(S(RE_ARRAY_ITEM, SP)) +RE_ARRAY = S(M(RE_ARRAY_CAST, n='?'), r'\s*{\s*', + NAMED('arrayitems', RE_ARRAY_ITEMS), + r'}') + +RE_MACRO_CONCAT = M(S(OR(RE_IDENTIFIER, RE_STRING), SP), n='{2,}') + +# NOTE: this covers a very small subset of valid expressions + +RE_EXPRESSION = OR(RE_FUN_CALL, RE_SIMPLE_VALUE, RE_ARRAY, RE_SIZEOF, + RE_ADDRESS, RE_MACRO_CONCAT) + +TI_FIELDS = [ 'name', 'parent', 'abstract', 'interfaces', + 'instance_size', 'instance_init', 'instance_post_init', 'instance_finalize', + 'class_size', 'class_init', 'class_base_init', 'class_data'] + +RE_TI_FIELD_NAME = OR(*TI_FIELDS) + +RE_TI_FIELD_INIT = S(NAMED('comments', RE_COMMENTS), + r'\.', NAMED('field', RE_TI_FIELD_NAME), r'\s*=\s*', + NAMED('value', RE_EXPRESSION), r'\s*,?') +RE_TI_FIELDS = M(S(RE_TI_FIELD_INIT, SP)) + +RE_TYPEINFO_START = S(r'^[ \t]*', M(r'(static|const)\s+', name='modifiers'), r'TypeInfo\s+', + NAMED('name', RE_IDENTIFIER), r'\s*=\s*{') +RE_TYPEINFO_DEF = S(RE_TYPEINFO_START, + M(SP, NAMED('fields', RE_TI_FIELDS), + NAMED('endcomments', RE_COMMENTS), + r'^};?\n', + n='?', name='fullspec')) + +ParsedArray = List[str] +ParsedInitializerValue = Union[str, ParsedArray] +class InitializerValue(NamedTuple): + raw: str + parsed: Optional[ParsedInitializerValue] +TypeInfoInitializers = Dict[str, InitializerValue] + +def parse_array(m: Match) -> ParsedArray: + #DBG('parse_array: %r', m.group(0)) + return [m.group('arrayitem') for m in re.finditer(RE_ARRAY_ITEM, m.group('arrayitems'))] + +def parse_initializer_value(s) -> InitializerValue: + parsed: Optional[ParsedInitializerValue] = None + if m := re.match(RE_ARRAY, s): + assert m is not None + parsed = parse_array(m) + return InitializerValue(s, parsed) + +class TypeInfoVar(FileMatch): + """TypeInfo variable declaration with initializer + Will be replaced by OBJECT_DEFINE_TYPE* macro + (not implemented yet) + """ + regexp = RE_TYPEINFO_DEF + + @property + def initializers(self) -> Optional[TypeInfoInitializers]: + if getattr(self, '_inititalizers', None): + self._initializers: TypeInfoInitializers + return self._initializers + fields = self.group('fields') + if fields is None: + return None + d = dict((fm.group('field'), parse_initializer_value(fm.group('value'))) + for fm in re.finditer(RE_TI_FIELD_INIT, fields)) + self._initializers = d + return d + + def is_static(self) -> bool: + return 'static' in self.group('modifiers') + + def is_full(self) -> bool: + return bool(self.group('fullspec')) + + def get_initializers(self) -> TypeInfoInitializers: + """Helper for code that needs to deal with missing initializer info""" + if self.initializers is None: + return {} + return self.initializers + + def get_initializer_value(self, field: str) -> InitializerValue: + return self.get_initializers().get(field, InitializerValue('', '')) + + def extract_identifiers(self) -> Optional[TypeIdentifiers]: + """Try to extract identifiers from names being used""" + DBG("extracting idenfiers from %s", self.name) + values = self.initializers + if values is None: + return None + if 'name' not in values: + self.warn("name not set in TypeInfo variable %s", self.name) + return None + typename = values['name'].raw + uppercase = None + if typename and re.fullmatch(RE_IDENTIFIER, typename) and typename.startswith("TYPE_"): + uppercase = typename[len('TYPE_'):] + lowercase = None + funcs = set() + prefixes = set() + for field,suffix in [('instance_init', '_init'), + ('instance_finalize', '_finalize'), + ('class_init', '_class_init')]: + if field not in values: + continue + func = values[field].raw + funcs.add(func) + if func.endswith(suffix): + prefixes.add(func[:-len(suffix)]) + else: + self.warn("function name %s doesn't have expected %s suffix", + func, suffix) + if len(prefixes) == 1: + lowercase = prefixes.pop() + elif len(prefixes) > 1: + self.warn("inconsistent function names: %s", ' '.join(funcs)) + + instancetype = None + if 'instance_size' in values: + m = re.fullmatch(RE_SIZEOF, values['instance_size'].raw) + if m: + instancetype = m.group('sizeoftype') + classtype = None + if 'class_size' in values: + m = re.fullmatch(RE_SIZEOF, values['class_size'].raw) + if m: + classtype = m.group('sizeoftype') + #.parent = TYPE_##PARENT_MODULE_OBJ_NAME, \ + return TypeIdentifiers(typename=typename, + uppercase=uppercase, lowercase=lowercase, + instancetype=instancetype, classtype=classtype) + + def append_field(self, field, value) -> Patch: + """Generate patch appending a field initializer""" + content = f' .{field} = {value},\n' + return Patch(self.match.end('fields'), self.match.end('fields'), + content) + + #def gen_patches(self) -> Iterable[Patch]: + # basic_fields = { 'parent', 'name', + # 'instance_size', 'instance_init', 'instance_finalize', + # 'class_size', 'class_init', } + # if fields == basic_fields: + # yield self.make_patch(f'// CAN PATCH: {self.name}\n') + +class TypeInfoVarInitFuncs(TypeInfoVar): + """TypeInfo variable + Will create missing init functions + """ + def gen_patches(self) -> Iterable[Patch]: + values = self.initializers + if values is None: + self.warn("type not parsed completely: %s", self.name) + return + + macro = self.file.find_match(TypeInfoVar, self.name) + if macro is None: + self.warn("No TYPE_INFO macro for %s", self.name) + return + + ids = self.extract_identifiers() + if ids is None: + return + + DBG("identifiers extracted: %r", ids) + fields = set(values.keys()) + if ids.lowercase: + if 'instance_init' not in fields: + yield self.prepend(('static void %s_init(Object *obj)\n' + '{\n' + '}\n\n') % (ids.lowercase)) + yield self.append_field('instance_init', ids.lowercase+'_init') + + if 'instance_finalize' not in fields: + yield self.prepend(('static void %s_finalize(Object *obj)\n' + '{\n' + '}\n\n') % (ids.lowercase)) + yield self.append_field('instance_finalize', ids.lowercase+'_finalize') + + + if 'class_init' not in fields: + yield self.prepend(('static void %s_class_init(ObjectClass *oc, void *data)\n' + '{\n' + '}\n\n') % (ids.lowercase)) + yield self.append_field('class_init', ids.lowercase+'_class_init') + +class TypeInitMacro(FileMatch): + """type_info(...) macro use + Will be deleted if function is empty + """ + regexp = S(r'^[ \t]*type_init\(\s*', NAMED('name', RE_IDENTIFIER), r'\s*\);?[ \t]*\n') + def gen_patches(self) -> Iterable[Patch]: + fn = self.file.find_match(StaticVoidFunction, self.name) + DBG("function for %s: %s", self.name, fn) + if fn and fn.body == '': + yield fn.make_patch('') + yield self.make_patch('') + +class StaticVoidFunction(FileMatch): + """simple static void function + (no replacement rules) + """ + #NOTE: just like RE_FULL_STRUCT, this doesn't parse any of the body contents + # of the function. Tt will just look for "}" in the beginning of a line + regexp = S(r'static\s+void\s+', NAMED('name', RE_IDENTIFIER), r'\s*\(\s*void\s*\)\n', + r'{\n', + NAMED('body', + # acceptable inside the function body: + # - lines starting with space or tab + # - empty lines + # - preprocessor directives + r'([ \t][^\n]*\n|#[^\n]*\n|\n)*?'), + r'}\n') + + @property + def body(self) -> str: + return self.group('body') + +class TypeRegisterCall(FileMatch): + """type_register_static() call + Will be replaced by TYPE_INFO() macro + """ + regexp = S(r'^[ \t]*type_register_static\(&\s*', NAMED('name', RE_IDENTIFIER), r'\s*\);[ \t]*\n') + + def function(self) -> Optional['StaticVoidFunction']: + """Return function containing this call""" + for m in self.file.matches_of_type(StaticVoidFunction): + if m.contains(self): + return m + return None + + def gen_patches(self) -> Iterable[Patch]: + fn = self.function() + if fn is None: + self.warn("can't find function where type_register_static(&%s) is called", self.name) + return + + type_init = self.file.find_match(TypeInitMacro, fn.name) + if type_init is None: + self.warn("can't find type_init(%s) line", self.name) + return + + var = self.file.find_match(TypeInfoVar, self.name) + if var is None: + self.warn("can't find TypeInfo var declaration for %s", self.name) + return + + if not var.is_full(): + self.warn("variable declaration %s wasn't parsed fully", var.name) + return + + if fn.contains(var): + self.warn("TypeInfo %s variable is inside a function", self.name) + return + + # delete type_register_static() call: + yield self.make_patch('') + # append TYPE_REGISTER(...) after variable declaration: + yield var.append(f'TYPE_INFO({self.name})\n') + +class TypeInfoMacro(FileMatch): + """TYPE_INFO macro usage""" + regexp = S(r'^[ \t]*TYPE_INFO\s*\(\s*', NAMED('name', RE_IDENTIFIER), r'\s*\)[ \t]*;?[ \t]*\n') + +class CreateClassStruct(DeclareInstanceChecker): + """Replace DECLARE_INSTANCE_CHECKER with OBJECT_DECLARE_SIMPLE_TYPE""" + def gen_patches(self) -> Iterable[Patch]: + typename = self.group('typename') + DBG("looking for TypeInfo variable for %s", typename) + ti = [ti for ti in self.allfiles.matches_of_type(TypeInfoVar) + if ti.get_initializer_value('name').raw == typename] + DBG("type info vars: %r", ti) + if len(ti) > 1: + self.warn("multiple TypeInfo vars found for %s", typename) + return + if len(ti) == 0: + self.warn("no TypeInfo var found for %s", typename) + return + var = ti[0] + assert var.initializers + if 'class_size' in var.initializers: + self.warn("class size already set for TypeInfo %s", var.name) + return + classtype = self.group('instancetype')+'Class' + return + yield + #TODO: need to find out what's the parent class type... + #yield var.append_field('class_size', f'sizeof({classtype})') + #c = (f'OBJECT_DECLARE_SIMPLE_TYPE({instancetype}, {lowercase},\n' + # f' MODULE_OBJ_NAME, ParentClassType)\n') + #yield self.make_patch(c) + +def type_infos(file: FileInfo) -> Iterable[TypeInfoVar]: + return file.matches_of_type(TypeInfoVar) + +def full_types(file: FileInfo) -> Iterable[TypeInfoVar]: + return [t for t in type_infos(file) if t.is_full()] + +def partial_types(file: FileInfo) -> Iterable[TypeInfoVar]: + return [t for t in type_infos(file) if not t.is_full()] diff --git a/scripts/codeconverter/codeconverter/regexps.py b/scripts/codeconverter/codeconverter/regexps.py new file mode 100644 index 0000000000..1f7f6d036a --- /dev/null +++ b/scripts/codeconverter/codeconverter/regexps.py @@ -0,0 +1,89 @@ +"""Helpers for creation of regular expressions""" +import re + +import logging +logger = logging.getLogger(__name__) +DBG = logger.debug +INFO = logger.info +WARN = logger.warning + +def S(*regexps) -> str: + """Just a shortcut to concatenate multiple regexps more easily""" + return ''.join(regexps) + +def P(*regexps, name=None, capture=False, repeat='') -> str: + """Just add parenthesis around regexp(s), with optional name or repeat suffix""" + s = S(*regexps) + if name: + return f'(?P<{name}>{s}){repeat}' + elif capture: + return f'({s}){repeat}' + else: + return f'(?:{s}){repeat}' + +def NAMED(name, *regexps) -> str: + """Make named group using ...) syntax + + >>> NAMED('mygroup', 'xyz', 'abc') + '(?Pxyzabc)' + """ + return P(*regexps, name=name) + +def OR(*regexps, **kwargs) -> str: + """Build (a|b|c) regexp""" + return P('|'.join(regexps), **kwargs) + +def M(*regexps, n='*', name=None) -> str: + """Add repetition qualifier to regexp(s) + + >>> M('a', 'b') + '(?:ab)*' + >>> M('a' , 'b', n='+') + '(?:ab)+' + >>> M('a' , 'b', n='{2,3}', name='name') + '(?P(?:ab){2,3})' + """ + r = P(*regexps, repeat=n) + if name: + r = NAMED(name, r) + return r + +# helper to make parenthesis optional around regexp +OPTIONAL_PARS = lambda R: OR(S(r'\(\s*', R, r'\s*\)'), R) +def test_optional_pars(): + r = OPTIONAL_PARS('abc')+'$' + assert re.match(r, 'abc') + assert re.match(r, '(abc)') + assert not re.match(r, '(abcd)') + assert not re.match(r, '(abc') + assert not re.match(r, 'abc)') + + +# this disables the MULTILINE flag, so it will match at the +# beginning of the file: +RE_FILE_BEGIN = r'(?-m:^)' + +# C primitives: + +SP = r'\s*' + +RE_COMMENT = r'//[^\n]*$|/\*([^*]|\*[^/])*\*/' +RE_COMMENTS = M(RE_COMMENT + SP) + +RE_IDENTIFIER = r'[a-zA-Z_][a-zA-Z0-9_]*(?![a-zA-Z0-9])' +RE_STRING = r'"([^"\\]|\\[a-z"])*"' +RE_NUMBER = r'[0-9]+|0x[0-9a-fA-F]+' + +# space or escaped newlines: +CPP_SPACE = OR(r'\s', r'\\\n', repeat='+') + +RE_PATH = '[a-zA-Z0-9/_.-]+' + +RE_INCLUDEPATH = OR(S(r'\"', RE_PATH, r'\"'), + S(r'<', RE_PATH, r'>')) + +RE_INCLUDE = S(r'^[ \t]*#[ \t]*include[ \t]+', NAMED('includepath', RE_INCLUDEPATH), r'[ \t]*\n') +RE_SIMPLEDEFINE = S(r'^[ \t]*#[ \t]*define[ \t]+', RE_IDENTIFIER, r'[ \t]*\n') + +RE_STRUCT_TYPE = S(r'struct\s+', RE_IDENTIFIER) +RE_TYPE = OR(RE_IDENTIFIER, RE_STRUCT_TYPE) diff --git a/scripts/codeconverter/codeconverter/test_patching.py b/scripts/codeconverter/codeconverter/test_patching.py new file mode 100644 index 0000000000..3d8f1c5169 --- /dev/null +++ b/scripts/codeconverter/codeconverter/test_patching.py @@ -0,0 +1,98 @@ +from tempfile import NamedTemporaryFile +from .patching import FileInfo, FileMatch, Patch, FileList +from .regexps import * + +class BasicPattern(FileMatch): + regexp = '[abc]{3}' + + @property + def name(self): + return self.group(0) + + def replacement(self) -> str: + # replace match with the middle character repeated 5 times + return self.group(0)[1].upper()*5 + +def test_pattern_patching(): + of = NamedTemporaryFile('wt') + of.writelines(['one line\n', + 'this pattern will be patched: defbbahij\n', + 'third line\n', + 'another pattern: jihaabfed']) + of.flush() + + files = FileList() + f = FileInfo(files, of.name) + f.load() + f.scan_for_matches() + matches = f.matches_of_type(BasicPattern) + assert len(matches) == 2 + p2 = matches[1] + + # manually add patch, to see if .append() works: + f.patches.append(p2.append('XXX')) + + # apply all patches: + f.gen_patches() + patched = f.get_patched_content() + assert patched == ('one line\n'+ + 'this pattern will be patched: defBBBBBhij\n'+ + 'third line\n'+ + 'another pattern: jihAAAAAXXXfed') + +class Function(FileMatch): + regexp = S(r'BEGIN\s+', NAMED('name', RE_IDENTIFIER), r'\n', + r'(.*\n)*?END\n') + +class Statement(FileMatch): + regexp = S(r'^\s*', NAMED('name', RE_IDENTIFIER), r'\(\)\n') + +def test_container_match(): + of = NamedTemporaryFile('wt') + of.writelines(['statement1()\n', + 'statement2()\n', + 'BEGIN function1\n', + ' statement3()\n', + ' statement4()\n', + 'END\n', + 'BEGIN function2\n', + ' statement5()\n', + ' statement6()\n', + 'END\n', + 'statement7()\n']) + of.flush() + + files = FileList() + f = FileInfo(files, of.name) + f.load() + assert len(f.matches_of_type(Function)) == 2 + print(' '.join(m.name for m in f.matches_of_type(Statement))) + assert len(f.matches_of_type(Statement)) == 7 + + f1 = f.find_match(Function, 'function1') + f2 = f.find_match(Function, 'function2') + st1 = f.find_match(Statement, 'statement1') + st2 = f.find_match(Statement, 'statement2') + st3 = f.find_match(Statement, 'statement3') + st4 = f.find_match(Statement, 'statement4') + st5 = f.find_match(Statement, 'statement5') + st6 = f.find_match(Statement, 'statement6') + st7 = f.find_match(Statement, 'statement7') + + assert not f1.contains(st1) + assert not f1.contains(st2) + assert not f1.contains(st2) + assert f1.contains(st3) + assert f1.contains(st4) + assert not f1.contains(st5) + assert not f1.contains(st6) + assert not f1.contains(st7) + + assert not f2.contains(st1) + assert not f2.contains(st2) + assert not f2.contains(st2) + assert not f2.contains(st3) + assert not f2.contains(st4) + assert f2.contains(st5) + assert f2.contains(st6) + assert not f2.contains(st7) diff --git a/scripts/codeconverter/codeconverter/test_regexps.py b/scripts/codeconverter/codeconverter/test_regexps.py new file mode 100644 index 0000000000..63466e4bfe --- /dev/null +++ b/scripts/codeconverter/codeconverter/test_regexps.py @@ -0,0 +1,272 @@ +from .regexps import * +from .qom_macros import * +from .qom_type_info import * + +def test_res(): + def fullmatch(regexp, s): + return re.fullmatch(regexp, s, re.MULTILINE) + + assert fullmatch(RE_IDENTIFIER, 'sizeof') + assert fullmatch(RE_IDENTIFIER, 'X86CPU') + assert fullmatch(RE_FUN_CALL, 'sizeof(X86CPU)') + assert fullmatch(RE_IDENTIFIER, 'X86_CPU_TYPE_NAME') + assert fullmatch(RE_SIMPLE_VALUE, '"base"') + print(RE_FUN_CALL) + assert fullmatch(RE_FUN_CALL, 'X86_CPU_TYPE_NAME("base")') + print(RE_TI_FIELD_INIT) + assert fullmatch(RE_TI_FIELD_INIT, '.name = X86_CPU_TYPE_NAME("base"),') + + + assert fullmatch(RE_MACRO_CONCAT, 'TYPE_ASPEED_GPIO "-ast2600"') + assert fullmatch(RE_EXPRESSION, 'TYPE_ASPEED_GPIO "-ast2600"') + + print(RE_MACRO_DEFINE) + assert re.search(RE_MACRO_DEFINE, r''' + #define OFFSET_CHECK(c) \ + do { \ + if (!(c)) { \ + goto bad_offset; \ + } \ + } while (0) + ''', re.MULTILINE) + + print(RE_CHECK_MACRO) + print(CPP_SPACE) + assert not re.match(RE_CHECK_MACRO, r''' + #define OFFSET_CHECK(c) \ + do { \ + if (!(c)) { \ + goto bad_offset; \ + } \ + } while (0)''', re.MULTILINE) + + print(RE_CHECK_MACRO) + assert fullmatch(RE_CHECK_MACRO, r'''#define PCI_DEVICE(obj) \ + OBJECT_CHECK(PCIDevice, (obj), TYPE_PCI_DEVICE) +''') + assert fullmatch(RE_CHECK_MACRO, r'''#define COLLIE_MACHINE(obj) \ + OBJECT_CHECK(CollieMachineState, obj, TYPE_COLLIE_MACHINE) +''') + + print(RE_TYPEINFO_START) + assert re.search(RE_TYPEINFO_START, r''' + cc->open = qmp_chardev_open_file; +} + +static const TypeInfo char_file_type_info = { + .name = TYPE_CHARDEV_FILE, +#ifdef _WIN32 + .parent = TYPE_CHARDEV_WIN, +''', re.MULTILINE) + assert re.search(RE_TYPEINFO_START, r''' + TypeInfo ti = { + .name = armsse_variants[i].name, + .parent = TYPE_ARMSSE, + .class_init = armsse_class_init, + .class_data = (void *)&armsse_variants[i], + };''', re.MULTILINE) + + print(RE_ARRAY_ITEM) + assert fullmatch(RE_ARRAY_ITEM, '{ TYPE_HOTPLUG_HANDLER },') + assert fullmatch(RE_ARRAY_ITEM, '{ TYPE_ACPI_DEVICE_IF },') + assert fullmatch(RE_ARRAY_ITEM, '{ }') + assert fullmatch(RE_ARRAY_CAST, '(InterfaceInfo[])') + assert fullmatch(RE_ARRAY, '''(InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { TYPE_ACPI_DEVICE_IF }, + { } + }''') + print(RE_COMMENT) + assert fullmatch(RE_COMMENT, r'''/* multi-line + * comment + */''') + + print(RE_TI_FIELDS) + assert fullmatch(RE_TI_FIELDS, r'''/* could be TYPE_SYS_BUS_DEVICE (or LPC etc) */ + .parent = TYPE_DEVICE,''') + assert fullmatch(RE_TI_FIELDS, r'''.name = TYPE_TPM_CRB, + /* could be TYPE_SYS_BUS_DEVICE (or LPC etc) */ + .parent = TYPE_DEVICE, + .instance_size = sizeof(CRBState), + .class_init = tpm_crb_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_TPM_IF }, + { } + }''') + assert fullmatch(RE_TI_FIELDS + RE_COMMENTS, + r'''.name = TYPE_PALM_MISC_GPIO, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PalmMiscGPIOState), + .instance_init = palm_misc_gpio_init, + /* + * No class init required: device has no internal state so does not + * need to set up reset or vmstate, and has no realize method. + */''') + + print(RE_TYPEINFO_DEF) + test_empty = 'static const TypeInfo x86_base_cpu_type_info = {\n'+\ + '};\n'; + assert fullmatch(RE_TYPEINFO_DEF, test_empty) + + test_simple = r''' + static const TypeInfo x86_base_cpu_type_info = { + .name = X86_CPU_TYPE_NAME("base"), + .parent = TYPE_X86_CPU, + .class_init = x86_cpu_base_class_init, + }; + ''' + assert re.search(RE_TYPEINFO_DEF, test_simple, re.MULTILINE) + + test_interfaces = r''' + static const TypeInfo acpi_ged_info = { + .name = TYPE_ACPI_GED, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(AcpiGedState), + .instance_init = acpi_ged_initfn, + .class_init = acpi_ged_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { TYPE_ACPI_DEVICE_IF }, + { } + } + }; + ''' + assert re.search(RE_TYPEINFO_DEF, test_interfaces, re.MULTILINE) + + test_comments = r''' + static const TypeInfo palm_misc_gpio_info = { + .name = TYPE_PALM_MISC_GPIO, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PalmMiscGPIOState), + .instance_init = palm_misc_gpio_init, + /* + * No class init required: device has no internal state so does not + * need to set up reset or vmstate, and has no realize method. + */ + }; + ''' + assert re.search(RE_TYPEINFO_DEF, test_comments, re.MULTILINE) + + test_comments = r''' + static const TypeInfo tpm_crb_info = { + .name = TYPE_TPM_CRB, + /* could be TYPE_SYS_BUS_DEVICE (or LPC etc) */ + .parent = TYPE_DEVICE, + .instance_size = sizeof(CRBState), + .class_init = tpm_crb_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_TPM_IF }, + { } + } + }; + ''' + assert re.search(RE_TYPEINFO_DEF, test_comments, re.MULTILINE) + +def test_struct_re(): + print('---') + print(RE_STRUCT_TYPEDEF) + assert re.search(RE_STRUCT_TYPEDEF, r''' +typedef struct TCGState { + AccelState parent_obj; + + bool mttcg_enabled; + unsigned long tb_size; +} TCGState; +''', re.MULTILINE) + + assert re.search(RE_STRUCT_TYPEDEF, r''' +typedef struct { + ISADevice parent_obj; + + QEMUSoundCard card; + uint32_t freq; + uint32_t port; + int ticking[2]; + int enabled; + int active; + int bufpos; +#ifdef DEBUG + int64_t exp[2]; +#endif + int16_t *mixbuf; + uint64_t dexp[2]; + SWVoiceOut *voice; + int left, pos, samples; + QEMUAudioTimeStamp ats; + FM_OPL *opl; + PortioList port_list; +} AdlibState; +''', re.MULTILINE) + + false_positive = r''' +typedef struct dma_pagetable_entry { + int32_t frame; + int32_t owner; +} A B C D E; +struct foo { + int x; +} some_variable; +''' + assert not re.search(RE_STRUCT_TYPEDEF, false_positive, re.MULTILINE) + +def test_initial_includes(): + print(InitialIncludes.regexp) + c = ''' +#ifndef HW_FLASH_H +#define HW_FLASH_H + +/* NOR flash devices */ + +#include "qom/object.h" +#include "exec/hwaddr.h" + +/* pflash_cfi01.c */ +''' + print(repr(list(m.groupdict() for m in re.finditer(InitialIncludes.regexp, c, re.MULTILINE)))) + m = re.match(InitialIncludes.regexp, c, re.MULTILINE) + assert m + print(repr(m.group(0))) + assert m.group(0).endswith('#include "exec/hwaddr.h"\n') + + c = '''#ifndef QEMU_VIRTIO_9P_H +#define QEMU_VIRTIO_9P_H + +#include "standard-headers/linux/virtio_9p.h" +#include "hw/virtio/virtio.h" +#include "9p.h" + + +''' + print(repr(list(m.groupdict() for m in re.finditer(InitialIncludes.regexp, c, re.MULTILINE)))) + m = re.match(InitialIncludes.regexp, c, re.MULTILINE) + assert m + print(repr(m.group(0))) + assert m.group(0).endswith('#include "9p.h"\n') + + c = '''#include "qom/object.h" +/* + * QEMU ES1370 emulation +... + */ + +/* #define DEBUG_ES1370 */ +/* #define VERBOSE_ES1370 */ +#define SILENT_ES1370 + +#include "qemu/osdep.h" +#include "hw/audio/soundhw.h" +#include "audio/audio.h" +#include "hw/pci/pci.h" +#include "migration/vmstate.h" +#include "qemu/module.h" +#include "sysemu/dma.h" + +/* Missing stuff: + SCTRL_P[12](END|ST)INC +''' + print(repr(list(m.groupdict() for m in re.finditer(InitialIncludes.regexp, c, re.MULTILINE)))) + m = re.match(InitialIncludes.regexp, c, re.MULTILINE) + assert m + print(repr(m.group(0))) + assert m.group(0).endswith('#include "sysemu/dma.h"\n') + diff --git a/scripts/codeconverter/codeconverter/utils.py b/scripts/codeconverter/codeconverter/utils.py new file mode 100644 index 0000000000..a9891fd083 --- /dev/null +++ b/scripts/codeconverter/codeconverter/utils.py @@ -0,0 +1,65 @@ +from typing import * + +import logging +logger = logging.getLogger(__name__) +DBG = logger.debug +INFO = logger.info +WARN = logger.warning + +T = TypeVar('T') +def opt_compare(a: T, b: T) -> bool: + """Compare two values, ignoring mismatches if one of them is None""" + return (a is None) or (b is None) or (a == b) + +def merge(a: T, b: T) -> T: + """Merge two values if they matched using opt_compare()""" + assert opt_compare(a, b) + if a is None: + return b + else: + return a + +def test_comp_merge(): + assert opt_compare(None, 1) == True + assert opt_compare(2, None) == True + assert opt_compare(1, 1) == True + assert opt_compare(1, 2) == False + + assert merge(None, None) is None + assert merge(None, 10) == 10 + assert merge(10, None) == 10 + assert merge(10, 10) == 10 + + +LineNumber = NewType('LineNumber', int) +ColumnNumber = NewType('ColumnNumber', int) +class LineAndColumn(NamedTuple): + line: int + col: int + + def __str__(self): + return '%d:%d' % (self.line, self.col) + +def line_col(s, position: int) -> LineAndColumn: + """Return line and column for a char position in string + + Character position starts in 0, but lines and columns start in 1. + """ + before = s[:position] + lines = before.split('\n') + line = len(lines) + col = len(lines[-1]) + 1 + return LineAndColumn(line, col) + +def test_line_col(): + assert line_col('abc\ndefg\nhijkl', 0) == (1, 1) + assert line_col('abc\ndefg\nhijkl', 2) == (1, 3) + assert line_col('abc\ndefg\nhijkl', 3) == (1, 4) + assert line_col('abc\ndefg\nhijkl', 4) == (2, 1) + assert line_col('abc\ndefg\nhijkl', 10) == (3, 2) + +def not_optional(arg: Optional[T]) -> T: + assert arg is not None + return arg + +__all__ = ['not_optional', 'opt_compare', 'merge', 'line_col', 'LineAndColumn'] \ No newline at end of file diff --git a/scripts/codeconverter/converter.py b/scripts/codeconverter/converter.py new file mode 100755 index 0000000000..58300b5a21 --- /dev/null +++ b/scripts/codeconverter/converter.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +import sys +import argparse +import os +import os.path +import re +from typing import * + +from codeconverter.patching import FileInfo, match_class_dict, FileList +import codeconverter.qom_macros +from codeconverter.qom_type_info import TI_FIELDS, type_infos, TypeInfoVar + +import logging +logger = logging.getLogger(__name__) +DBG = logger.debug +INFO = logger.info +WARN = logger.warning + +def process_all_files(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None: + DBG("filenames: %r", args.filenames) + + files = FileList() + files.extend(FileInfo(files, fn, args.force) for fn in args.filenames) + for f in files: + DBG('opening %s', f.filename) + f.load() + + if args.table: + fields = ['filename', 'variable_name'] + TI_FIELDS + print('\t'.join(fields)) + for f in files: + for t in f.matches_of_type(TypeInfoVar): + assert isinstance(t, TypeInfoVar) + values = [f.filename, t.name] + \ + [t.get_initializer_value(f).raw + for f in TI_FIELDS] + DBG('values: %r', values) + assert all('\t' not in v for v in values) + values = [v.replace('\n', ' ').replace('"', '') for v in values] + print('\t'.join(values)) + return + + match_classes = match_class_dict() + if not args.patterns: + parser.error("--pattern is required") + + classes = [p for arg in args.patterns + for p in re.split(r'[\s,]', arg)] + for c in classes: + if c not in match_classes: + print("Invalid pattern name: %s" % (c), file=sys.stderr) + print("Valid patterns:", file=sys.stderr) + print(PATTERN_HELP, file=sys.stderr) + sys.exit(1) + + DBG("classes: %r", classes) + for f in files: + INFO("patching contents of %s", f.filename) + f.patch_content(max_passes=args.passes, class_names=classes) + + for f in files: + #alltypes.extend(f.type_infos) + #full_types.extend(f.full_types()) + + if not args.dry_run: + if args.inplace: + f.patch_inplace() + if args.diff: + f.show_diff() + if not args.diff and not args.inplace: + f.write_to_file(sys.stdout) + sys.stdout.flush() + + +PATTERN_HELP = ('\n'.join(" %s: %s" % (n, str(c.__doc__).strip()) + for (n,c) in sorted(match_class_dict().items()) + if c.has_replacement_rule())) + +def main() -> None: + p = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter) + p.add_argument('filenames', nargs='+') + p.add_argument('--passes', type=int, default=1, + help="Number of passes (0 means unlimited)") + p.add_argument('--pattern', required=True, action='append', + default=[], dest='patterns', + help="Pattern to scan for") + p.add_argument('--inplace', '-i', action='store_true', + help="Patch file in place") + p.add_argument('--dry-run', action='store_true', + help="Don't patch files or print patching results") + p.add_argument('--force', '-f', action='store_true', + help="Perform changes even if not completely safe") + p.add_argument('--diff', action='store_true', + help="Print diff output on stdout") + p.add_argument('--debug', '-d', action='store_true', + help="Enable debugging") + p.add_argument('--verbose', '-v', action='store_true', + help="Verbose logging on stderr") + p.add_argument('--table', action='store_true', + help="Print CSV table of type information") + p.add_argument_group("Valid pattern names", + PATTERN_HELP) + args = p.parse_args() + + loglevel = (logging.DEBUG if args.debug + else logging.INFO if args.verbose + else logging.WARN) + logging.basicConfig(format='%(levelname)s: %(message)s', level=loglevel) + DBG("args: %r", args) + process_all_files(p, args) + +if __name__ == '__main__': + main() \ No newline at end of file From patchwork Thu Aug 13 22:26:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 275474 Return-Path: Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C78AC433E1 for ; Thu, 13 Aug 2020 22:44:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 825242078B for ; Thu, 13 Aug 2020 22:44:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RmbteArq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 825242078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6Lxe-0000XE-No for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:44:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Lh4-0006Td-V8 for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:31 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:58808 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgv-0002wT-MI for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5RWGF/CmpjsW4+a3cml5dQTXyhS6spBseSDyaR4boIQ=; b=RmbteArq3MrFd8WnnAp7zdXUPqn6fUCqY1//Cku7KKejHEupha5O40qhjp0sAU3SQfMHYe 3p/2A3dGWm1jL156JbxuRIziw+oX7JQv/q72TJKRyFfpdnANrjYKVZiDrW1Ha28aN+hcQ1 Vk8/Ge1wevh8YcnlqoMVKyBwGhJCEFw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-1L3VRww2M2m9QE-JdSLAtw-1; Thu, 13 Aug 2020 18:27:12 -0400 X-MC-Unique: 1L3VRww2M2m9QE-JdSLAtw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A8B3A100CA8A for ; Thu, 13 Aug 2020 22:27:11 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id B808865F5E; Thu, 13 Aug 2020 22:27:10 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 34/41] [automated] Use TYPE_INFO macro Date: Thu, 13 Aug 2020 18:26:18 -0400 Message-Id: <20200813222625.243136-35-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Generated using: $ ./scripts/codeconverter/converter.py -i --passes=2 \ --pattern=TypeRegisterCall,TypeInitMacro $(git grep -l TypeInfo -- '*.[ch]') Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. BerrangĂ© --- accel/accel.c | 6 +----- accel/kvm/kvm-all.c | 6 +----- accel/qtest.c | 6 +----- accel/tcg/tcg-all.c | 6 +----- accel/xen/xen-all.c | 6 +----- authz/base.c | 6 +----- authz/list.c | 7 +------ authz/listfile.c | 7 +------ authz/pamacct.c | 7 +------ authz/simple.c | 7 +------ backends/cryptodev-builtin.c | 7 +------ backends/cryptodev-vhost-user.c | 7 +------ backends/cryptodev.c | 7 +------ backends/dbus-vmstate.c | 7 +------ backends/hostmem-file.c | 6 +----- backends/hostmem-memfd.c | 2 +- backends/hostmem-ram.c | 6 +----- backends/hostmem.c | 6 +----- backends/rng-builtin.c | 6 +----- backends/rng-egd.c | 6 +----- backends/rng-random.c | 6 +----- backends/rng.c | 6 +----- backends/tpm/tpm_backend.c | 8 ++------ backends/tpm/tpm_emulator.c | 6 +----- backends/tpm/tpm_passthrough.c | 6 +----- backends/vhost-user.c | 6 +----- block/throttle-groups.c | 6 +----- chardev/baum.c | 6 +----- chardev/char-console.c | 6 +----- chardev/char-fd.c | 6 +----- chardev/char-mux.c | 6 +----- chardev/char-null.c | 6 +----- chardev/char-parallel.c | 6 +----- chardev/char-pty.c | 6 +----- chardev/char-ringbuf.c | 8 ++------ chardev/char-socket.c | 6 +----- chardev/char-udp.c | 6 +----- chardev/char-win-stdio.c | 6 +----- chardev/char-win.c | 6 +----- chardev/char.c | 6 +----- chardev/msmouse.c | 6 +----- chardev/spice.c | 10 +++------- chardev/testdev.c | 6 +----- chardev/wctablet.c | 6 +----- crypto/secret.c | 7 +------ crypto/secret_common.c | 7 +------ crypto/secret_keyring.c | 7 +------ crypto/tls-cipher-suites.c | 6 +----- crypto/tlscreds.c | 7 +------ crypto/tlscredsanon.c | 7 +------ crypto/tlscredspsk.c | 7 +------ crypto/tlscredsx509.c | 7 +------ gdbstub.c | 6 +----- hw/9pfs/virtio-9p-device.c | 6 +----- hw/acpi/generic_event_device.c | 6 +----- hw/acpi/piix4.c | 6 +----- hw/acpi/vmgenid.c | 6 +----- hw/adc/stm32f2xx_adc.c | 6 +----- hw/alpha/typhoon.c | 8 ++------ hw/arm/allwinner-a10.c | 6 +----- hw/arm/allwinner-h3.c | 6 +----- hw/arm/armsse.c | 2 +- hw/arm/armv7m.c | 8 ++------ hw/arm/bcm2835_peripherals.c | 6 +----- hw/arm/bcm2836.c | 2 +- hw/arm/boot.c | 6 +----- hw/arm/collie.c | 6 +----- hw/arm/digic.c | 6 +----- hw/arm/exynos4210.c | 6 +----- hw/arm/exynos4_boards.c | 8 ++------ hw/arm/fsl-imx25.c | 6 +----- hw/arm/fsl-imx31.c | 6 +----- hw/arm/fsl-imx6.c | 6 +----- hw/arm/fsl-imx6ul.c | 6 +----- hw/arm/fsl-imx7.c | 6 +----- hw/arm/gumstix.c | 8 ++------ hw/arm/highbank.c | 14 +++----------- hw/arm/integratorcp.c | 10 +++------- hw/arm/microbit.c | 6 +----- hw/arm/mps2-tz.c | 10 +++------- hw/arm/mps2.c | 10 +++------- hw/arm/msf2-soc.c | 6 +----- hw/arm/musca.c | 10 +++------- hw/arm/musicpal.c | 22 +++++++++------------- hw/arm/nrf51_soc.c | 6 +----- hw/arm/nseries.c | 8 ++------ hw/arm/omap_sx1.c | 8 ++------ hw/arm/palm.c | 6 +----- hw/arm/pxa2xx.c | 14 +++++--------- hw/arm/pxa2xx_gpio.c | 6 +----- hw/arm/pxa2xx_pic.c | 6 +----- hw/arm/realview.c | 12 ++++-------- hw/arm/sbsa-ref.c | 6 +----- hw/arm/smmu-common.c | 6 +----- hw/arm/spitz.c | 28 ++++++++++------------------ hw/arm/stellaris.c | 18 +++++------------- hw/arm/stm32f205_soc.c | 6 +----- hw/arm/stm32f405_soc.c | 6 +----- hw/arm/strongarm.c | 16 ++++++---------- hw/arm/tosa.c | 10 +++------- hw/arm/versatilepb.c | 14 +++----------- hw/arm/vexpress.c | 10 +++------- hw/arm/virt.c | 6 +----- hw/arm/xilinx_zynq.c | 6 +----- hw/arm/xlnx-versal-virt.c | 6 +----- hw/arm/xlnx-versal.c | 6 +----- hw/arm/xlnx-zcu102.c | 6 +----- hw/arm/xlnx-zynqmp.c | 6 +----- hw/audio/cs4231.c | 6 +----- hw/audio/hda-codec.c | 12 ++++-------- hw/audio/intel-hda.c | 10 +++++----- hw/audio/marvell_88w8618.c | 6 +----- hw/audio/milkymist-ac97.c | 6 +----- hw/audio/pcspk.c | 2 +- hw/audio/pl041.c | 6 +----- hw/audio/wm8750.c | 6 +----- hw/block/fdc.c | 16 ++++++---------- hw/block/m25p80.c | 2 +- hw/block/nand.c | 6 +----- hw/block/nvme.c | 6 +----- hw/block/onenand.c | 6 +----- hw/block/pflash_cfi01.c | 6 +----- hw/block/pflash_cfi02.c | 6 +----- hw/block/swim.c | 10 +++------- hw/block/vhost-user-blk.c | 6 +----- hw/block/virtio-blk.c | 6 +----- hw/block/xen-block.c | 10 +++------- hw/char/avr_usart.c | 6 +----- hw/char/bcm2835_aux.c | 6 +----- hw/char/cadence_uart.c | 6 +----- hw/char/cmsdk-apb-uart.c | 6 +----- hw/char/debugcon.c | 6 +----- hw/char/digic-uart.c | 6 +----- hw/char/escc.c | 6 +----- hw/char/etraxfs_ser.c | 6 +----- hw/char/exynos4210_uart.c | 6 +----- hw/char/grlib_apbuart.c | 6 +----- hw/char/ibex_uart.c | 6 +----- hw/char/imx_serial.c | 6 +----- hw/char/ipoctal232.c | 6 +----- hw/char/lm32_juart.c | 6 +----- hw/char/lm32_uart.c | 6 +----- hw/char/mcf_uart.c | 6 +----- hw/char/milkymist-uart.c | 6 +----- hw/char/nrf51_uart.c | 6 +----- hw/char/parallel.c | 6 +----- hw/char/pl011.c | 8 ++------ hw/char/renesas_sci.c | 6 +----- hw/char/sclpconsole-lm.c | 6 +----- hw/char/sclpconsole.c | 6 +----- hw/char/serial-isa.c | 6 +----- hw/char/serial-pci-multi.c | 8 ++------ hw/char/serial-pci.c | 6 +----- hw/char/serial.c | 10 +++------- hw/char/spapr_vty.c | 2 +- hw/char/stm32f2xx_usart.c | 6 +----- hw/char/terminal3270.c | 6 +----- hw/char/virtio-console.c | 8 ++------ hw/char/virtio-serial-bus.c | 10 +++------- hw/char/xilinx_uartlite.c | 6 +----- hw/core/bus.c | 6 +----- hw/core/clock.c | 6 +----- hw/core/cpu.c | 6 +----- hw/core/fw-path-provider.c | 6 +----- hw/core/generic-loader.c | 6 +----- hw/core/hotplug.c | 6 +----- hw/core/irq.c | 6 +----- hw/core/machine.c | 6 +----- hw/core/nmi.c | 6 +----- hw/core/or-irq.c | 6 +----- hw/core/platform-bus.c | 6 +----- hw/core/qdev.c | 6 +----- hw/core/register.c | 6 +----- hw/core/resettable.c | 6 +----- hw/core/split-irq.c | 6 +----- hw/core/stream.c | 6 +----- hw/core/sysbus.c | 8 ++------ hw/core/vmstate-if.c | 6 +----- hw/cpu/a15mpcore.c | 6 +----- hw/cpu/a9mpcore.c | 6 +----- hw/cpu/arm11mpcore.c | 6 +----- hw/cpu/cluster.c | 6 +----- hw/cpu/core.c | 6 +----- hw/cpu/realview_mpcore.c | 6 +----- hw/display/ads7846.c | 6 +----- hw/display/artist.c | 6 +----- hw/display/ati.c | 6 +----- hw/display/bcm2835_fb.c | 6 +----- hw/display/bochs-display.c | 6 +----- hw/display/cg3.c | 6 +----- hw/display/cirrus_vga.c | 6 +----- hw/display/cirrus_vga_isa.c | 6 +----- hw/display/dpcd.c | 6 +----- hw/display/exynos4210_fimd.c | 6 +----- hw/display/g364fb.c | 6 +----- hw/display/i2c-ddc.c | 6 +----- hw/display/jazz_led.c | 6 +----- hw/display/macfb.c | 8 ++------ hw/display/milkymist-tmu2.c | 6 +----- hw/display/milkymist-vgafb.c | 6 +----- hw/display/next-fb.c | 6 +----- hw/display/pl110.c | 10 +++------- hw/display/qxl.c | 10 +++------- hw/display/ramfb-standalone.c | 6 +----- hw/display/sii9022.c | 6 +----- hw/display/sm501.c | 8 ++------ hw/display/ssd0303.c | 6 +----- hw/display/ssd0323.c | 6 +----- hw/display/tcx.c | 6 +----- hw/display/vga-isa.c | 6 +----- hw/display/vga-pci.c | 10 +++------- hw/display/vhost-user-gpu.c | 6 +----- hw/display/virtio-gpu-base.c | 7 +------ hw/display/virtio-gpu-pci.c | 2 +- hw/display/virtio-gpu.c | 6 +----- hw/display/virtio-vga.c | 2 +- hw/display/vmware_vga.c | 6 +----- hw/display/xlnx_dp.c | 6 +----- hw/dma/bcm2835_dma.c | 6 +----- hw/dma/i82374.c | 6 +----- hw/dma/i8257.c | 6 +----- hw/dma/pl080.c | 8 ++------ hw/dma/pl330.c | 6 +----- hw/dma/puv3_dma.c | 6 +----- hw/dma/pxa2xx_dma.c | 6 +----- hw/dma/rc4030.c | 8 ++------ hw/dma/sparc32_dma.c | 12 ++++-------- hw/dma/xilinx_axidma.c | 10 +++------- hw/dma/xlnx-zdma.c | 6 +----- hw/dma/xlnx-zynq-devcfg.c | 6 +----- hw/dma/xlnx_dpdma.c | 6 +----- hw/gpio/aspeed_gpio.c | 14 +++++--------- hw/gpio/bcm2835_gpio.c | 6 +----- hw/gpio/gpio_key.c | 6 +----- hw/gpio/imx_gpio.c | 6 +----- hw/gpio/max7310.c | 6 +----- hw/gpio/mpc8xxx.c | 6 +----- hw/gpio/nrf51_gpio.c | 6 +----- hw/gpio/omap_gpio.c | 8 ++------ hw/gpio/pl061.c | 8 ++------ hw/gpio/puv3_gpio.c | 6 +----- hw/gpio/zaurus.c | 6 +----- hw/hppa/dino.c | 6 +----- hw/hppa/lasi.c | 6 +----- hw/hyperv/hyperv.c | 6 +----- hw/hyperv/hyperv_testdev.c | 6 +----- hw/hyperv/vmbus.c | 10 +++------- hw/i2c/aspeed_i2c.c | 12 ++++-------- hw/i2c/bitbang_i2c.c | 6 +----- hw/i2c/core.c | 8 ++------ hw/i2c/exynos4210_i2c.c | 6 +----- hw/i2c/imx_i2c.c | 6 +----- hw/i2c/microbit_i2c.c | 6 +----- hw/i2c/mpc_i2c.c | 6 +----- hw/i2c/omap_i2c.c | 6 +----- hw/i2c/ppc4xx_i2c.c | 6 +----- hw/i2c/smbus_eeprom.c | 6 +----- hw/i2c/smbus_ich9.c | 6 +----- hw/i2c/smbus_slave.c | 6 +----- hw/i2c/versatile_i2c.c | 6 +----- hw/i386/amd_iommu.c | 10 +++------- hw/i386/intel_iommu.c | 8 ++------ hw/i386/kvm/apic.c | 6 +----- hw/i386/kvm/clock.c | 6 +----- hw/i386/kvm/i8254.c | 6 +----- hw/i386/kvm/i8259.c | 6 +----- hw/i386/kvm/ioapic.c | 6 +----- hw/i386/kvmvapic.c | 6 +----- hw/i386/microvm.c | 6 +----- hw/i386/pc.c | 6 +----- hw/i386/pc_piix.c | 6 +----- hw/i386/port92.c | 6 +----- hw/i386/vmmouse.c | 6 +----- hw/i386/vmport.c | 6 +----- hw/i386/x86-iommu.c | 6 +----- hw/i386/x86.c | 6 +----- hw/i386/xen/xen_apic.c | 6 +----- hw/i386/xen/xen_platform.c | 6 +----- hw/i386/xen/xen_pvdevice.c | 6 +----- hw/ide/ahci-allwinner.c | 6 +----- hw/ide/ahci.c | 6 +----- hw/ide/cmd646.c | 6 +----- hw/ide/ich.c | 6 +----- hw/ide/isa.c | 6 +----- hw/ide/macio.c | 6 +----- hw/ide/microdrive.c | 8 ++------ hw/ide/mmio.c | 6 +----- hw/ide/pci.c | 6 +----- hw/ide/piix.c | 10 +++------- hw/ide/qdev.c | 14 +++++--------- hw/ide/sii3112.c | 6 +----- hw/ide/via.c | 6 +----- hw/input/adb-kbd.c | 6 +----- hw/input/adb-mouse.c | 6 +----- hw/input/adb.c | 8 ++------ hw/input/lm832x.c | 6 +----- hw/input/milkymist-softusb.c | 6 +----- hw/input/pckbd.c | 6 +----- hw/input/pl050.c | 10 +++------- hw/input/vhost-user-input.c | 6 +----- hw/input/virtio-input-hid.c | 12 ++++-------- hw/input/virtio-input-host.c | 6 +----- hw/input/virtio-input.c | 6 +----- hw/intc/allwinner-a10-pic.c | 6 +----- hw/intc/apic.c | 6 +----- hw/intc/apic_common.c | 6 +----- hw/intc/arm_gic.c | 6 +----- hw/intc/arm_gic_common.c | 6 +----- hw/intc/arm_gic_kvm.c | 6 +----- hw/intc/arm_gicv2m.c | 6 +----- hw/intc/arm_gicv3.c | 6 +----- hw/intc/arm_gicv3_common.c | 6 +----- hw/intc/arm_gicv3_its_common.c | 6 +----- hw/intc/arm_gicv3_its_kvm.c | 6 +----- hw/intc/arm_gicv3_kvm.c | 6 +----- hw/intc/armv7m_nvic.c | 6 +----- hw/intc/aspeed_vic.c | 6 +----- hw/intc/bcm2835_ic.c | 6 +----- hw/intc/bcm2836_control.c | 6 +----- hw/intc/etraxfs_pic.c | 6 +----- hw/intc/exynos4210_combiner.c | 6 +----- hw/intc/exynos4210_gic.c | 12 ++---------- hw/intc/grlib_irqmp.c | 6 +----- hw/intc/heathrow_pic.c | 6 +----- hw/intc/i8259.c | 6 +----- hw/intc/i8259_common.c | 6 +----- hw/intc/ibex_plic.c | 6 +----- hw/intc/imx_avic.c | 6 +----- hw/intc/imx_gpcv2.c | 6 +----- hw/intc/intc.c | 6 +----- hw/intc/ioapic.c | 6 +----- hw/intc/ioapic_common.c | 6 +----- hw/intc/lm32_pic.c | 6 +----- hw/intc/loongson_liointc.c | 6 +----- hw/intc/mips_gic.c | 6 +----- hw/intc/nios2_iic.c | 6 +----- hw/intc/omap_intc.c | 10 +++------- hw/intc/ompic.c | 6 +----- hw/intc/openpic.c | 6 +----- hw/intc/openpic_kvm.c | 6 +----- hw/intc/pl190.c | 6 +----- hw/intc/pnv_xive.c | 6 +----- hw/intc/puv3_intc.c | 6 +----- hw/intc/realview_gic.c | 6 +----- hw/intc/rx_icu.c | 6 +----- hw/intc/s390_flic.c | 8 ++------ hw/intc/s390_flic_kvm.c | 6 +----- hw/intc/slavio_intctl.c | 6 +----- hw/intc/spapr_xive.c | 6 +----- hw/intc/xics.c | 10 +++------- hw/intc/xics_pnv.c | 6 +----- hw/intc/xics_spapr.c | 6 +----- hw/intc/xilinx_intc.c | 6 +----- hw/intc/xive.c | 18 +++++++----------- hw/intc/xlnx-pmu-iomod-intc.c | 6 +----- hw/intc/xlnx-zynqmp-ipi.c | 6 +----- hw/ipack/ipack.c | 8 ++------ hw/ipack/tpci200.c | 6 +----- hw/ipmi/ipmi.c | 8 ++------ hw/ipmi/ipmi_bmc_sim.c | 6 +----- hw/ipmi/isa_ipmi_bt.c | 6 +----- hw/ipmi/isa_ipmi_kcs.c | 6 +----- hw/ipmi/pci_ipmi_bt.c | 6 +----- hw/ipmi/pci_ipmi_kcs.c | 6 +----- hw/ipmi/smbus_ipmi.c | 6 +----- hw/isa/i82378.c | 6 +----- hw/isa/isa-bus.c | 12 ++++-------- hw/isa/isa-superio.c | 8 ++------ hw/isa/lpc_ich9.c | 6 +----- hw/isa/pc87312.c | 6 +----- hw/isa/piix3.c | 10 +++------- hw/isa/piix4.c | 6 +----- hw/isa/smc37c669-superio.c | 6 +----- hw/isa/vt82c686.c | 14 +++++--------- hw/lm32/lm32_boards.c | 8 ++------ hw/m68k/mcf_intc.c | 6 +----- hw/m68k/next-cube.c | 6 +----- hw/m68k/next-kbd.c | 6 +----- hw/m68k/q800.c | 6 +----- hw/mem/memory-device.c | 6 +----- hw/mem/nvdimm.c | 6 +----- hw/mem/pc-dimm.c | 6 +----- hw/microblaze/xlnx-zynqmp-pmu.c | 6 +----- hw/mips/boston.c | 6 +----- hw/mips/cps.c | 6 +----- hw/mips/gt64xxx_pci.c | 8 ++------ hw/mips/jazz.c | 8 ++------ hw/mips/malta.c | 6 +----- hw/misc/a9scu.c | 6 +----- hw/misc/allwinner-cpucfg.c | 6 +----- hw/misc/allwinner-h3-ccu.c | 6 +----- hw/misc/allwinner-h3-dramc.c | 6 +----- hw/misc/allwinner-h3-sysctrl.c | 6 +----- hw/misc/allwinner-sid.c | 6 +----- hw/misc/applesmc.c | 6 +----- hw/misc/arm11scu.c | 6 +----- hw/misc/arm_integrator_debug.c | 6 +----- hw/misc/arm_l2x0.c | 6 +----- hw/misc/arm_sysctl.c | 6 +----- hw/misc/armsse-cpuid.c | 6 +----- hw/misc/armsse-mhu.c | 6 +----- hw/misc/aspeed_scu.c | 12 ++++-------- hw/misc/aspeed_sdmc.c | 12 ++++-------- hw/misc/aspeed_xdma.c | 6 +----- hw/misc/auxbus.c | 10 +++------- hw/misc/avr_power.c | 6 +----- hw/misc/bcm2835_mbox.c | 6 +----- hw/misc/bcm2835_mphi.c | 6 +----- hw/misc/bcm2835_property.c | 6 +----- hw/misc/bcm2835_rng.c | 6 +----- hw/misc/bcm2835_thermal.c | 6 +----- hw/misc/debugexit.c | 6 +----- hw/misc/eccmemctl.c | 6 +----- hw/misc/empty_slot.c | 6 +----- hw/misc/exynos4210_clk.c | 2 +- hw/misc/exynos4210_pmu.c | 6 +----- hw/misc/exynos4210_rng.c | 6 +----- hw/misc/grlib_ahb_apb_pnp.c | 8 ++------ hw/misc/imx25_ccm.c | 6 +----- hw/misc/imx31_ccm.c | 6 +----- hw/misc/imx6_ccm.c | 6 +----- hw/misc/imx6_src.c | 6 +----- hw/misc/imx6ul_ccm.c | 6 +----- hw/misc/imx7_ccm.c | 8 ++------ hw/misc/imx7_gpr.c | 6 +----- hw/misc/imx7_snvs.c | 6 +----- hw/misc/imx_ccm.c | 6 +----- hw/misc/imx_rngc.c | 6 +----- hw/misc/iotkit-secctl.c | 6 +----- hw/misc/iotkit-sysctl.c | 6 +----- hw/misc/iotkit-sysinfo.c | 6 +----- hw/misc/ivshmem.c | 10 +++------- hw/misc/mac_via.c | 10 +++------- hw/misc/macio/cuda.c | 8 ++------ hw/misc/macio/gpio.c | 6 +----- hw/misc/macio/mac_dbdma.c | 6 +----- hw/misc/macio/macio.c | 12 ++++-------- hw/misc/macio/pmu.c | 8 ++------ hw/misc/max111x.c | 10 +++------- hw/misc/milkymist-hpdmc.c | 6 +----- hw/misc/milkymist-pfpu.c | 6 +----- hw/misc/mips_cmgcr.c | 6 +----- hw/misc/mips_cpc.c | 6 +----- hw/misc/mips_itu.c | 6 +----- hw/misc/mos6522.c | 6 +----- hw/misc/mps2-fpgaio.c | 6 +----- hw/misc/mps2-scc.c | 6 +----- hw/misc/msf2-sysreg.c | 6 +----- hw/misc/mst_fpga.c | 6 +----- hw/misc/nrf51_rng.c | 6 +----- hw/misc/pc-testdev.c | 6 +----- hw/misc/pca9552.c | 8 ++------ hw/misc/pci-testdev.c | 6 +----- hw/misc/puv3_pm.c | 6 +----- hw/misc/pvpanic.c | 6 +----- hw/misc/sga.c | 6 +----- hw/misc/slavio_misc.c | 8 ++------ hw/misc/stm32f2xx_syscfg.c | 6 +----- hw/misc/stm32f4xx_exti.c | 6 +----- hw/misc/stm32f4xx_syscfg.c | 6 +----- hw/misc/tmp105.c | 6 +----- hw/misc/tmp421.c | 2 +- hw/misc/tz-mpc.c | 8 ++------ hw/misc/tz-msc.c | 6 +----- hw/misc/tz-ppc.c | 6 +----- hw/misc/unimp.c | 6 +----- hw/misc/vmcoreinfo.c | 6 +----- hw/misc/zynq-xadc.c | 6 +----- hw/misc/zynq_slcr.c | 6 +----- hw/net/allwinner-sun8i-emac.c | 6 +----- hw/net/allwinner_emac.c | 6 +----- hw/net/cadence_gem.c | 6 +----- hw/net/can/can_kvaser_pci.c | 6 +----- hw/net/can/can_mioe3680_pci.c | 6 +----- hw/net/can/can_pcm3680_pci.c | 6 +----- hw/net/dp8393x.c | 6 +----- hw/net/e1000.c | 2 +- hw/net/e1000e.c | 6 +----- hw/net/etraxfs_eth.c | 6 +----- hw/net/fsl_etsec/etsec.c | 6 +----- hw/net/ftgmac100.c | 8 ++------ hw/net/imx_fec.c | 8 ++------ hw/net/lan9118.c | 6 +----- hw/net/lance.c | 6 +----- hw/net/lasi_i82596.c | 6 +----- hw/net/mcf_fec.c | 6 +----- hw/net/milkymist-minimac2.c | 6 +----- hw/net/mipsnet.c | 6 +----- hw/net/msf2-emac.c | 6 +----- hw/net/ne2000-isa.c | 6 +----- hw/net/ne2000-pci.c | 6 +----- hw/net/opencores_eth.c | 6 +----- hw/net/pcnet-pci.c | 6 +----- hw/net/rocker/rocker.c | 6 +----- hw/net/rtl8139.c | 6 +----- hw/net/smc91c111.c | 6 +----- hw/net/spapr_llan.c | 2 +- hw/net/stellaris_enet.c | 6 +----- hw/net/sungem.c | 6 +----- hw/net/sunhme.c | 6 +----- hw/net/tulip.c | 6 +----- hw/net/virtio-net.c | 6 +----- hw/net/vmxnet3.c | 2 +- hw/net/xgmac.c | 6 +----- hw/net/xilinx_axienet.c | 10 +++------- hw/net/xilinx_ethlite.c | 6 +----- hw/nubus/mac-nubus-bridge.c | 6 +----- hw/nubus/nubus-bridge.c | 6 +----- hw/nubus/nubus-bus.c | 6 +----- hw/nubus/nubus-device.c | 6 +----- hw/nvram/ds1225y.c | 6 +----- hw/nvram/eeprom_at24c.c | 6 +----- hw/nvram/fw_cfg.c | 12 ++++-------- hw/nvram/mac_nvram.c | 6 +----- hw/nvram/nrf51_nvm.c | 6 +----- hw/nvram/spapr_nvram.c | 6 +----- hw/pci-bridge/dec.c | 10 +++------- hw/pci-bridge/i82801b11.c | 6 +----- hw/pci-bridge/ioh3420.c | 6 +----- hw/pci-bridge/pci_bridge_dev.c | 8 ++------ hw/pci-bridge/pci_expander_bridge.c | 14 +++++--------- hw/pci-bridge/pcie_pci_bridge.c | 6 +----- hw/pci-bridge/pcie_root_port.c | 6 +----- hw/pci-bridge/simba.c | 6 +----- hw/pci-bridge/xio3130_downstream.c | 6 +----- hw/pci-bridge/xio3130_upstream.c | 6 +----- hw/pci-host/bonito.c | 8 ++------ hw/pci-host/designware.c | 8 ++------ hw/pci-host/gpex.c | 8 ++------ hw/pci-host/grackle.c | 8 ++------ hw/pci-host/i440fx.c | 8 ++------ hw/pci-host/pnv_phb3.c | 12 ++++-------- hw/pci-host/pnv_phb3_msi.c | 6 +----- hw/pci-host/pnv_phb3_pbcq.c | 6 +----- hw/pci-host/pnv_phb4.c | 12 ++++-------- hw/pci-host/pnv_phb4_pec.c | 8 ++------ hw/pci-host/ppce500.c | 8 ++------ hw/pci-host/prep.c | 8 ++------ hw/pci-host/q35.c | 8 ++------ hw/pci-host/sabre.c | 8 ++------ hw/pci-host/uninorth.c | 18 +++++++++--------- hw/pci-host/versatile.c | 10 +++------- hw/pci-host/xen_igd_pt.c | 6 +----- hw/pci-host/xilinx-pcie.c | 8 ++------ hw/pci/pci.c | 14 +++++--------- hw/pci/pci_bridge.c | 6 +----- hw/pci/pci_host.c | 6 +----- hw/pci/pcie_host.c | 6 +----- hw/pci/pcie_port.c | 8 ++------ hw/pcmcia/pcmcia.c | 6 +----- hw/pcmcia/pxa2xx.c | 6 +----- hw/ppc/e500.c | 8 ++------ hw/ppc/e500plat.c | 6 +----- hw/ppc/mac_newworld.c | 6 +----- hw/ppc/mac_oldworld.c | 6 +----- hw/ppc/mpc8544_guts.c | 6 +----- hw/ppc/mpc8544ds.c | 6 +----- hw/ppc/pnv_core.c | 6 +----- hw/ppc/pnv_homer.c | 10 +++------- hw/ppc/pnv_lpc.c | 12 ++++-------- hw/ppc/pnv_occ.c | 10 +++------- hw/ppc/pnv_pnor.c | 6 +----- hw/ppc/pnv_psi.c | 12 ++++-------- hw/ppc/pnv_xscom.c | 6 +----- hw/ppc/ppc405_boards.c | 8 ++------ hw/ppc/ppc440_pcix.c | 6 +----- hw/ppc/ppc440_uc.c | 6 +----- hw/ppc/ppc4xx_pci.c | 8 ++------ hw/ppc/ppce500_spin.c | 6 +----- hw/ppc/prep_systemio.c | 6 +----- hw/ppc/rs6000_mc.c | 6 +----- hw/ppc/spapr.c | 6 +----- hw/ppc/spapr_drc.c | 16 ++++++++-------- hw/ppc/spapr_iommu.c | 8 ++------ hw/ppc/spapr_irq.c | 6 +----- hw/ppc/spapr_pci.c | 6 +----- hw/ppc/spapr_rng.c | 6 +----- hw/ppc/spapr_rtc.c | 6 +----- hw/ppc/spapr_tpm_proxy.c | 2 +- hw/ppc/spapr_vio.c | 10 +++------- hw/rdma/rdma.c | 6 +----- hw/rdma/vmw/pvrdma_main.c | 6 +----- hw/riscv/opentitan.c | 6 +----- hw/riscv/riscv_hart.c | 6 +----- hw/riscv/sifive_clint.c | 6 +----- hw/riscv/sifive_e.c | 12 ++---------- hw/riscv/sifive_e_prci.c | 6 +----- hw/riscv/sifive_gpio.c | 6 +----- hw/riscv/sifive_plic.c | 6 +----- hw/riscv/sifive_test.c | 6 +----- hw/riscv/sifive_u.c | 12 ++---------- hw/riscv/sifive_u_otp.c | 6 +----- hw/riscv/sifive_u_prci.c | 6 +----- hw/riscv/virt.c | 6 +----- hw/rtc/allwinner-rtc.c | 12 ++++-------- hw/rtc/aspeed_rtc.c | 6 +----- hw/rtc/ds1338.c | 6 +----- hw/rtc/exynos4210_rtc.c | 6 +----- hw/rtc/goldfish_rtc.c | 6 +----- hw/rtc/m41t80.c | 6 +----- hw/rtc/m48t59-isa.c | 2 +- hw/rtc/m48t59.c | 4 ++-- hw/rtc/mc146818rtc.c | 6 +----- hw/rtc/pl031.c | 6 +----- hw/rtc/sun4v-rtc.c | 6 +----- hw/rtc/twl92230.c | 6 +----- hw/rtc/xlnx-zynqmp-rtc.c | 6 +----- hw/s390x/3270-ccw.c | 6 +----- hw/s390x/ap-bridge.c | 8 ++------ hw/s390x/ap-device.c | 6 +----- hw/s390x/ccw-device.c | 6 +----- hw/s390x/css-bridge.c | 8 ++------ hw/s390x/event-facility.c | 10 +++------- hw/s390x/ipl.c | 6 +----- hw/s390x/s390-ccw.c | 6 +----- hw/s390x/s390-pci-bus.c | 14 +++++--------- hw/s390x/s390-skeys-kvm.c | 6 +----- hw/s390x/s390-skeys.c | 8 ++------ hw/s390x/s390-stattrib-kvm.c | 6 +----- hw/s390x/s390-stattrib.c | 8 ++------ hw/s390x/s390-virtio-ccw.c | 6 +----- hw/s390x/sclp.c | 6 +----- hw/s390x/sclpcpu.c | 6 +----- hw/s390x/sclpquiesce.c | 6 +----- hw/s390x/tod-kvm.c | 6 +----- hw/s390x/tod-qemu.c | 6 +----- hw/s390x/tod.c | 6 +----- hw/s390x/vhost-vsock-ccw.c | 6 +----- hw/s390x/virtio-ccw-9p.c | 6 +----- hw/s390x/virtio-ccw-balloon.c | 6 +----- hw/s390x/virtio-ccw-blk.c | 6 +----- hw/s390x/virtio-ccw-crypto.c | 6 +----- hw/s390x/virtio-ccw-gpu.c | 6 +----- hw/s390x/virtio-ccw-input.c | 14 +++++--------- hw/s390x/virtio-ccw-net.c | 6 +----- hw/s390x/virtio-ccw-rng.c | 6 +----- hw/s390x/virtio-ccw-scsi.c | 4 ++-- hw/s390x/virtio-ccw-serial.c | 6 +----- hw/s390x/virtio-ccw.c | 8 ++------ hw/scsi/esp-pci.c | 8 ++------ hw/scsi/esp.c | 6 +----- hw/scsi/lsi53c895a.c | 8 ++------ hw/scsi/megasas.c | 2 +- hw/scsi/scsi-bus.c | 8 ++------ hw/scsi/scsi-disk.c | 10 +++++----- hw/scsi/scsi-generic.c | 6 +----- hw/scsi/spapr_vscsi.c | 6 +----- hw/scsi/vhost-scsi-common.c | 6 +----- hw/scsi/vhost-scsi.c | 6 +----- hw/scsi/vhost-user-scsi.c | 6 +----- hw/scsi/virtio-scsi.c | 8 ++------ hw/scsi/vmw_pvscsi.c | 7 +------ hw/sd/allwinner-sdhost.c | 12 ++++-------- hw/sd/aspeed_sdhci.c | 6 +----- hw/sd/bcm2835_sdhost.c | 8 ++------ hw/sd/core.c | 6 +----- hw/sd/milkymist-memcard.c | 6 +----- hw/sd/pl181.c | 6 +----- hw/sd/pxa2xx_mmci.c | 8 ++------ hw/sd/sd.c | 6 +----- hw/sd/sdhci-pci.c | 6 +----- hw/sd/sdhci.c | 12 ++++-------- hw/sd/ssi-sd.c | 6 +----- hw/sh4/sh_pci.c | 8 ++------ hw/sparc/sun4m.c | 28 ++++++++++++++-------------- hw/sparc/sun4m_iommu.c | 8 ++------ hw/sparc64/niagara.c | 6 +----- hw/sparc64/sun4u.c | 12 ++++++------ hw/sparc64/sun4u_iommu.c | 8 ++------ hw/ssi/aspeed_smc.c | 2 +- hw/ssi/imx_spi.c | 6 +----- hw/ssi/mss-spi.c | 6 +----- hw/ssi/pl022.c | 6 +----- hw/ssi/ssi.c | 8 ++------ hw/ssi/stm32f2xx_spi.c | 6 +----- hw/ssi/xilinx_spi.c | 6 +----- hw/ssi/xilinx_spips.c | 10 +++------- hw/timer/a9gtimer.c | 6 +----- hw/timer/allwinner-a10-pit.c | 6 +----- hw/timer/altera_timer.c | 6 +----- hw/timer/arm_mptimer.c | 6 +----- hw/timer/arm_timer.c | 8 ++------ hw/timer/armv7m_systick.c | 6 +----- hw/timer/aspeed_timer.c | 12 ++++-------- hw/timer/avr_timer16.c | 6 +----- hw/timer/bcm2835_systmr.c | 6 +----- hw/timer/cadence_ttc.c | 6 +----- hw/timer/cmsdk-apb-dualtimer.c | 6 +----- hw/timer/cmsdk-apb-timer.c | 6 +----- hw/timer/digic-timer.c | 6 +----- hw/timer/etraxfs_timer.c | 6 +----- hw/timer/exynos4210_mct.c | 6 +----- hw/timer/exynos4210_pwm.c | 6 +----- hw/timer/grlib_gptimer.c | 6 +----- hw/timer/hpet.c | 6 +----- hw/timer/i8254.c | 6 +----- hw/timer/i8254_common.c | 6 +----- hw/timer/imx_epit.c | 6 +----- hw/timer/imx_gpt.c | 12 ++++-------- hw/timer/lm32_timer.c | 6 +----- hw/timer/milkymist-sysctl.c | 6 +----- hw/timer/mss-timer.c | 6 +----- hw/timer/nrf51_timer.c | 6 +----- hw/timer/puv3_ost.c | 6 +----- hw/timer/pxa2xx_timer.c | 10 +++------- hw/timer/renesas_cmt.c | 6 +----- hw/timer/renesas_tmr.c | 6 +----- hw/timer/slavio_timer.c | 6 +----- hw/timer/stm32f2xx_timer.c | 6 +----- hw/timer/xilinx_timer.c | 6 +----- hw/tpm/tpm_crb.c | 6 +----- hw/tpm/tpm_spapr.c | 6 +----- hw/tpm/tpm_tis_isa.c | 6 +----- hw/tpm/tpm_tis_sysbus.c | 6 +----- hw/usb/bus.c | 8 ++------ hw/usb/ccid-card-emulated.c | 6 +----- hw/usb/ccid-card-passthru.c | 6 +----- hw/usb/chipidea.c | 6 +----- hw/usb/dev-audio.c | 2 +- hw/usb/dev-hid.c | 8 ++++---- hw/usb/dev-hub.c | 6 +----- hw/usb/dev-mtp.c | 6 +----- hw/usb/dev-network.c | 6 +----- hw/usb/dev-serial.c | 6 +++--- hw/usb/dev-smartcard-reader.c | 6 +++--- hw/usb/dev-storage.c | 10 +++------- hw/usb/dev-uas.c | 6 +----- hw/usb/dev-wacom.c | 2 +- hw/usb/hcd-dwc2.c | 6 +----- hw/usb/hcd-ehci-pci.c | 2 +- hw/usb/hcd-ehci-sysbus.c | 18 +++++++----------- hw/usb/hcd-ohci-pci.c | 6 +----- hw/usb/hcd-ohci.c | 6 +----- hw/usb/hcd-uhci.c | 2 +- hw/usb/hcd-xhci-nec.c | 6 +----- hw/usb/hcd-xhci.c | 8 ++------ hw/usb/host-libusb.c | 6 +----- hw/usb/imx-usb-phy.c | 6 +----- hw/usb/redirect.c | 6 +----- hw/usb/tusb6010.c | 6 +----- hw/vfio/amd-xgbe.c | 6 +----- hw/vfio/ap.c | 6 +----- hw/vfio/calxeda-xgmac.c | 6 +----- hw/vfio/ccw.c | 6 +----- hw/vfio/igd.c | 6 +----- hw/vfio/pci.c | 8 ++------ hw/vfio/platform.c | 6 +----- hw/virtio/vhost-user-fs.c | 6 +----- hw/virtio/vhost-user-vsock.c | 6 +----- hw/virtio/vhost-vsock-common.c | 6 +----- hw/virtio/vhost-vsock.c | 6 +----- hw/virtio/virtio-balloon.c | 6 +----- hw/virtio/virtio-bus.c | 6 +----- hw/virtio/virtio-crypto.c | 6 +----- hw/virtio/virtio-input-pci.c | 4 ++-- hw/virtio/virtio-iommu.c | 8 ++------ hw/virtio/virtio-mem.c | 6 +----- hw/virtio/virtio-mmio.c | 8 ++------ hw/virtio/virtio-pci.c | 4 ++-- hw/virtio/virtio-pmem.c | 6 +----- hw/virtio/virtio-rng.c | 6 +----- hw/virtio/virtio.c | 6 +----- hw/watchdog/cmsdk-apb-watchdog.c | 8 ++------ hw/watchdog/wdt_aspeed.c | 8 ++++---- hw/watchdog/wdt_diag288.c | 2 +- hw/watchdog/wdt_i6300esb.c | 2 +- hw/watchdog/wdt_ib700.c | 2 +- hw/watchdog/wdt_imx2.c | 2 +- hw/xen/xen-bus.c | 10 +++------- hw/xen/xen-legacy-backend.c | 10 +++------- hw/xen/xen_pt.c | 6 +----- hw/xtensa/xtfpga.c | 20 ++++++++------------ io/channel-buffer.c | 6 +----- io/channel-command.c | 6 +----- io/channel-file.c | 6 +----- io/channel-socket.c | 6 +----- io/channel-tls.c | 6 +----- io/channel-websock.c | 6 +----- io/channel.c | 6 +----- io/dns-resolver.c | 6 +----- io/net-listener.c | 6 +----- iothread.c | 6 +----- migration/migration.c | 6 +----- migration/rdma.c | 6 +----- net/can/can_core.c | 6 +----- net/can/can_host.c | 6 +----- net/can/can_socketcan.c | 6 +----- net/colo-compare.c | 6 +----- net/dump.c | 6 +----- net/filter-buffer.c | 6 +----- net/filter-mirror.c | 8 ++------ net/filter-replay.c | 6 +----- net/filter-rewriter.c | 6 +----- net/filter.c | 6 +----- qom/container.c | 6 +----- scsi/pr-manager-helper.c | 6 +----- scsi/pr-manager.c | 7 +------ softmmu/memory.c | 8 ++------ target/arm/cpu.c | 4 ++-- target/arm/cpu64.c | 2 +- target/hppa/cpu.c | 6 +----- target/i386/cpu.c | 8 ++++---- target/i386/hax-all.c | 6 +----- target/i386/hvf/hvf.c | 6 +----- target/i386/sev.c | 7 +------ target/i386/whpx-all.c | 6 +----- target/microblaze/cpu.c | 6 +----- target/mips/cpu.c | 2 +- target/nios2/cpu.c | 6 +----- target/ppc/translate_init.inc.c | 4 ++-- target/rx/cpu.c | 8 ++------ target/s390x/cpu.c | 6 +----- target/s390x/cpu_models.c | 6 +++--- target/sparc/cpu.c | 2 +- target/tilegx/cpu.c | 6 +----- target/xtensa/cpu.c | 6 +----- ui/console.c | 6 +----- ui/input-barrier.c | 6 +----- ui/input-linux.c | 6 +----- 819 files changed, 1183 insertions(+), 4322 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index cb555e3b06..5239dd7f45 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -36,6 +36,7 @@ static const TypeInfo accel_type = { .class_size = sizeof(AccelClass), .instance_size = sizeof(AccelState), }; +TYPE_INFO(accel_type) /* Lookup AccelClass from opt_name. Returns NULL if not found */ AccelClass *accel_find(const char *opt_name) @@ -77,9 +78,4 @@ void accel_setup_post(MachineState *ms) } } -static void register_accel_types(void) -{ - type_register_static(&accel_type); -} -type_init(register_accel_types); diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 63ef6af9a1..ab89d0ef94 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -3208,10 +3208,6 @@ static const TypeInfo kvm_accel_type = { .class_init = kvm_accel_class_init, .instance_size = sizeof(KVMState), }; +TYPE_INFO(kvm_accel_type) -static void kvm_type_init(void) -{ - type_register_static(&kvm_accel_type); -} -type_init(kvm_type_init); diff --git a/accel/qtest.c b/accel/qtest.c index 5b88f55921..d19a6297bb 100644 --- a/accel/qtest.c +++ b/accel/qtest.c @@ -45,10 +45,6 @@ static const TypeInfo qtest_accel_type = { .parent = TYPE_ACCEL, .class_init = qtest_accel_class_init, }; +TYPE_INFO(qtest_accel_type) -static void qtest_type_init(void) -{ - type_register_static(&qtest_accel_type); -} -type_init(qtest_type_init); diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index eace2c113b..c29e72fb1f 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -217,10 +217,6 @@ static const TypeInfo tcg_accel_type = { .class_init = tcg_accel_class_init, .instance_size = sizeof(TCGState), }; +TYPE_INFO(tcg_accel_type) -static void register_accel_types(void) -{ - type_register_static(&tcg_accel_type); -} -type_init(register_accel_types); diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 60b971d0a8..888053a39f 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -213,10 +213,6 @@ static const TypeInfo xen_accel_type = { .parent = TYPE_ACCEL, .class_init = xen_accel_class_init, }; +TYPE_INFO(xen_accel_type) -static void xen_type_init(void) -{ - type_register_static(&xen_accel_type); -} -type_init(xen_type_init); diff --git a/authz/base.c b/authz/base.c index c75bce3fd1..619b4bb706 100644 --- a/authz/base.c +++ b/authz/base.c @@ -73,11 +73,7 @@ static const TypeInfo authz_info = { .class_size = sizeof(QAuthZClass), .abstract = true, }; +TYPE_INFO(authz_info) -static void qauthz_register_types(void) -{ - type_register_static(&authz_info); -} -type_init(qauthz_register_types) diff --git a/authz/list.c b/authz/list.c index 8e904bfc93..bfe1310d47 100644 --- a/authz/list.c +++ b/authz/list.c @@ -259,13 +259,8 @@ static const TypeInfo qauthz_list_info = { { } } }; +TYPE_INFO(qauthz_list_info) -static void -qauthz_list_register_types(void) -{ - type_register_static(&qauthz_list_info); -} -type_init(qauthz_list_register_types); diff --git a/authz/listfile.c b/authz/listfile.c index 666df872ad..048255aa76 100644 --- a/authz/listfile.c +++ b/authz/listfile.c @@ -270,13 +270,8 @@ static const TypeInfo qauthz_list_file_info = { { } } }; +TYPE_INFO(qauthz_list_file_info) -static void -qauthz_list_file_register_types(void) -{ - type_register_static(&qauthz_list_file_info); -} -type_init(qauthz_list_file_register_types); diff --git a/authz/pamacct.c b/authz/pamacct.c index 3c6be43916..7dd240f654 100644 --- a/authz/pamacct.c +++ b/authz/pamacct.c @@ -136,13 +136,8 @@ static const TypeInfo qauthz_pam_info = { { } } }; +TYPE_INFO(qauthz_pam_info) -static void -qauthz_pam_register_types(void) -{ - type_register_static(&qauthz_pam_info); -} -type_init(qauthz_pam_register_types); diff --git a/authz/simple.c b/authz/simple.c index 84954b80a5..f9c53df352 100644 --- a/authz/simple.c +++ b/authz/simple.c @@ -103,13 +103,8 @@ static const TypeInfo qauthz_simple_info = { { } } }; +TYPE_INFO(qauthz_simple_info) -static void -qauthz_simple_register_types(void) -{ - type_register_static(&qauthz_simple_info); -} -type_init(qauthz_simple_register_types); diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index 14316333fe..cb3690383f 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -384,11 +384,6 @@ static const TypeInfo cryptodev_builtin_info = { .class_init = cryptodev_builtin_class_init, .instance_size = sizeof(CryptoDevBackendBuiltin), }; +TYPE_INFO(cryptodev_builtin_info) -static void -cryptodev_builtin_register_types(void) -{ - type_register_static(&cryptodev_builtin_info); -} -type_init(cryptodev_builtin_register_types); diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c index dbe5a8aae6..0fffa10214 100644 --- a/backends/cryptodev-vhost-user.c +++ b/backends/cryptodev-vhost-user.c @@ -372,11 +372,6 @@ static const TypeInfo cryptodev_vhost_user_info = { .instance_finalize = cryptodev_vhost_user_finalize, .instance_size = sizeof(CryptoDevBackendVhostUser), }; +TYPE_INFO(cryptodev_vhost_user_info) -static void -cryptodev_vhost_user_register_types(void) -{ - type_register_static(&cryptodev_vhost_user_info); -} -type_init(cryptodev_vhost_user_register_types); diff --git a/backends/cryptodev.c b/backends/cryptodev.c index ada4ebe78b..9180af54e9 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -245,11 +245,6 @@ static const TypeInfo cryptodev_backend_info = { { } } }; +TYPE_INFO(cryptodev_backend_info) -static void -cryptodev_backend_register_types(void) -{ - type_register_static(&cryptodev_backend_info); -} -type_init(cryptodev_backend_register_types); diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c index 56361a6272..d8cc3e7e25 100644 --- a/backends/dbus-vmstate.c +++ b/backends/dbus-vmstate.c @@ -499,11 +499,6 @@ static const TypeInfo dbus_vmstate_info = { { } } }; +TYPE_INFO(dbus_vmstate_info) -static void -register_types(void) -{ - type_register_static(&dbus_vmstate_info); -} -type_init(register_types); diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 5b819020b4..5037357cd0 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -199,10 +199,6 @@ static const TypeInfo file_backend_info = { .instance_finalize = file_backend_instance_finalize, .instance_size = sizeof(HostMemoryBackendFile), }; +TYPE_INFO(file_backend_info) -static void register_types(void) -{ - type_register_static(&file_backend_info); -} -type_init(register_types); diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 4c040a7541..4b4f13a3ca 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -161,11 +161,11 @@ static const TypeInfo memfd_backend_info = { .class_init = memfd_backend_class_init, .instance_size = sizeof(HostMemoryBackendMemfd), }; +TYPE_INFO(memfd_backend_info) static void register_types(void) { if (qemu_memfd_check(MFD_ALLOW_SEALING)) { - type_register_static(&memfd_backend_info); } } diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c index 5cc53e76c9..3bbe53f1ce 100644 --- a/backends/hostmem-ram.c +++ b/backends/hostmem-ram.c @@ -45,10 +45,6 @@ static const TypeInfo ram_backend_info = { .parent = TYPE_MEMORY_BACKEND, .class_init = ram_backend_class_init, }; +TYPE_INFO(ram_backend_info) -static void register_types(void) -{ - type_register_static(&ram_backend_info); -} -type_init(register_types); diff --git a/backends/hostmem.c b/backends/hostmem.c index 4bde00e8e7..49d15e61be 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -516,10 +516,6 @@ static const TypeInfo host_memory_backend_info = { { } } }; +TYPE_INFO(host_memory_backend_info) -static void register_types(void) -{ - type_register_static(&host_memory_backend_info); -} -type_init(register_types); diff --git a/backends/rng-builtin.c b/backends/rng-builtin.c index ba1b8d66b8..d6afd54b3e 100644 --- a/backends/rng-builtin.c +++ b/backends/rng-builtin.c @@ -68,10 +68,6 @@ static const TypeInfo rng_builtin_info = { .instance_finalize = rng_builtin_finalize, .class_init = rng_builtin_class_init, }; +TYPE_INFO(rng_builtin_info) -static void register_types(void) -{ - type_register_static(&rng_builtin_info); -} -type_init(register_types); diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 7aaa6ee239..90d57417ff 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -165,10 +165,6 @@ static const TypeInfo rng_egd_info = { .instance_init = rng_egd_init, .instance_finalize = rng_egd_finalize, }; +TYPE_INFO(rng_egd_info) -static void register_types(void) -{ - type_register_static(&rng_egd_info); -} -type_init(register_types); diff --git a/backends/rng-random.c b/backends/rng-random.c index 32998d8ee7..59dba2b3f4 100644 --- a/backends/rng-random.c +++ b/backends/rng-random.c @@ -144,10 +144,6 @@ static const TypeInfo rng_random_info = { .instance_init = rng_random_init, .instance_finalize = rng_random_finalize, }; +TYPE_INFO(rng_random_info) -static void register_types(void) -{ - type_register_static(&rng_random_info); -} -type_init(register_types); diff --git a/backends/rng.c b/backends/rng.c index 484f04e891..dcea7a89e9 100644 --- a/backends/rng.c +++ b/backends/rng.c @@ -139,10 +139,6 @@ static const TypeInfo rng_backend_info = { { } } }; +TYPE_INFO(rng_backend_info) -static void register_types(void) -{ - type_register_static(&rng_backend_info); -} -type_init(register_types); diff --git a/backends/tpm/tpm_backend.c b/backends/tpm/tpm_backend.c index 375587e743..9aac3df542 100644 --- a/backends/tpm/tpm_backend.c +++ b/backends/tpm/tpm_backend.c @@ -192,17 +192,13 @@ static const TypeInfo tpm_backend_info = { .class_size = sizeof(TPMBackendClass), .abstract = true, }; +TYPE_INFO(tpm_backend_info) static const TypeInfo tpm_if_info = { .name = TYPE_TPM_IF, .parent = TYPE_INTERFACE, .class_size = sizeof(TPMIfClass), }; +TYPE_INFO(tpm_if_info) -static void register_types(void) -{ - type_register_static(&tpm_backend_info); - type_register_static(&tpm_if_info); -} -type_init(register_types); diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c index a9b0f55e67..ac441337d9 100644 --- a/backends/tpm/tpm_emulator.c +++ b/backends/tpm/tpm_emulator.c @@ -996,10 +996,6 @@ static const TypeInfo tpm_emulator_info = { .instance_init = tpm_emulator_inst_init, .instance_finalize = tpm_emulator_inst_finalize, }; +TYPE_INFO(tpm_emulator_info) -static void tpm_emulator_register(void) -{ - type_register_static(&tpm_emulator_info); -} -type_init(tpm_emulator_register) diff --git a/backends/tpm/tpm_passthrough.c b/backends/tpm/tpm_passthrough.c index 7403807ec4..8e67b4b7d6 100644 --- a/backends/tpm/tpm_passthrough.c +++ b/backends/tpm/tpm_passthrough.c @@ -396,10 +396,6 @@ static const TypeInfo tpm_passthrough_info = { .instance_init = tpm_passthrough_inst_init, .instance_finalize = tpm_passthrough_inst_finalize, }; +TYPE_INFO(tpm_passthrough_info) -static void tpm_passthrough_register(void) -{ - type_register_static(&tpm_passthrough_info); -} -type_init(tpm_passthrough_register) diff --git a/backends/vhost-user.c b/backends/vhost-user.c index 9e6e198546..25873b1981 100644 --- a/backends/vhost-user.c +++ b/backends/vhost-user.c @@ -199,10 +199,6 @@ static const TypeInfo vhost_user_backend_info = { .instance_finalize = vhost_user_backend_finalize, .class_size = sizeof(VhostUserBackendClass), }; +TYPE_INFO(vhost_user_backend_info) -static void register_types(void) -{ - type_register_static(&vhost_user_backend_info); -} -type_init(register_types); diff --git a/block/throttle-groups.c b/block/throttle-groups.c index 4e28365d8d..49f68bef50 100644 --- a/block/throttle-groups.c +++ b/block/throttle-groups.c @@ -968,10 +968,6 @@ static const TypeInfo throttle_group_info = { { } }, }; +TYPE_INFO(throttle_group_info) -static void throttle_groups_init(void) -{ - type_register_static(&throttle_group_info); -} -type_init(throttle_groups_init); diff --git a/chardev/baum.c b/chardev/baum.c index 9c95e7bc79..f111ebfe05 100644 --- a/chardev/baum.c +++ b/chardev/baum.c @@ -677,10 +677,6 @@ static const TypeInfo char_braille_type_info = { .instance_finalize = char_braille_finalize, .class_init = char_braille_class_init, }; +TYPE_INFO(char_braille_type_info) -static void register_types(void) -{ - type_register_static(&char_braille_type_info); -} -type_init(register_types); diff --git a/chardev/char-console.c b/chardev/char-console.c index 6c4ce5dbce..89b083c5b9 100644 --- a/chardev/char-console.c +++ b/chardev/char-console.c @@ -46,10 +46,6 @@ static const TypeInfo char_console_type_info = { .parent = TYPE_CHARDEV_WIN, .class_init = char_console_class_init, }; +TYPE_INFO(char_console_type_info) -static void register_types(void) -{ - type_register_static(&char_console_type_info); -} -type_init(register_types); diff --git a/chardev/char-fd.c b/chardev/char-fd.c index c2d8101106..b263e285f0 100644 --- a/chardev/char-fd.c +++ b/chardev/char-fd.c @@ -161,10 +161,6 @@ static const TypeInfo char_fd_type_info = { .class_init = char_fd_class_init, .abstract = true, }; +TYPE_INFO(char_fd_type_info) -static void register_types(void) -{ - type_register_static(&char_fd_type_info); -} -type_init(register_types); diff --git a/chardev/char-mux.c b/chardev/char-mux.c index 6f980bb836..c3be4e40e5 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -394,10 +394,6 @@ static const TypeInfo char_mux_type_info = { .instance_size = sizeof(MuxChardev), .instance_finalize = char_mux_finalize, }; +TYPE_INFO(char_mux_type_info) -static void register_types(void) -{ - type_register_static(&char_mux_type_info); -} -type_init(register_types); diff --git a/chardev/char-null.c b/chardev/char-null.c index 1c6a2900f9..ce43ccdda6 100644 --- a/chardev/char-null.c +++ b/chardev/char-null.c @@ -47,10 +47,6 @@ static const TypeInfo char_null_type_info = { .instance_size = sizeof(Chardev), .class_init = char_null_class_init, }; +TYPE_INFO(char_null_type_info) -static void register_types(void) -{ - type_register_static(&char_null_type_info); -} -type_init(register_types); diff --git a/chardev/char-parallel.c b/chardev/char-parallel.c index 05e7efbd6c..dd60ef9898 100644 --- a/chardev/char-parallel.c +++ b/chardev/char-parallel.c @@ -308,12 +308,8 @@ static const TypeInfo char_parallel_type_info = { .instance_finalize = char_parallel_finalize, .class_init = char_parallel_class_init, }; +TYPE_INFO(char_parallel_type_info) -static void register_types(void) -{ - type_register_static(&char_parallel_type_info); -} -type_init(register_types); #endif diff --git a/chardev/char-pty.c b/chardev/char-pty.c index 1cc501a481..40d7bddba3 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -243,10 +243,6 @@ static const TypeInfo char_pty_type_info = { .instance_finalize = char_pty_finalize, .class_init = char_pty_class_init, }; +TYPE_INFO(char_pty_type_info) -static void register_types(void) -{ - type_register_static(&char_pty_type_info); -} -type_init(register_types); diff --git a/chardev/char-ringbuf.c b/chardev/char-ringbuf.c index 67397a8ce9..fe9881b85b 100644 --- a/chardev/char-ringbuf.c +++ b/chardev/char-ringbuf.c @@ -237,17 +237,13 @@ static const TypeInfo char_ringbuf_type_info = { .instance_size = sizeof(RingBufChardev), .instance_finalize = char_ringbuf_finalize, }; +TYPE_INFO(char_ringbuf_type_info) /* Bug-compatibility: */ static const TypeInfo char_memory_type_info = { .name = TYPE_CHARDEV_MEMORY, .parent = TYPE_CHARDEV_RINGBUF, }; +TYPE_INFO(char_memory_type_info) -static void register_types(void) -{ - type_register_static(&char_ringbuf_type_info); - type_register_static(&char_memory_type_info); -} -type_init(register_types); diff --git a/chardev/char-socket.c b/chardev/char-socket.c index ef62dbf3d7..8c4ff2effb 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -1510,10 +1510,6 @@ static const TypeInfo char_socket_type_info = { .instance_finalize = char_socket_finalize, .class_init = char_socket_class_init, }; +TYPE_INFO(char_socket_type_info) -static void register_types(void) -{ - type_register_static(&char_socket_type_info); -} -type_init(register_types); diff --git a/chardev/char-udp.c b/chardev/char-udp.c index bba4145f96..0d175b62e0 100644 --- a/chardev/char-udp.c +++ b/chardev/char-udp.c @@ -234,10 +234,6 @@ static const TypeInfo char_udp_type_info = { .instance_finalize = char_udp_finalize, .class_init = char_udp_class_init, }; +TYPE_INFO(char_udp_type_info) -static void register_types(void) -{ - type_register_static(&char_udp_type_info); -} -type_init(register_types); diff --git a/chardev/char-win-stdio.c b/chardev/char-win-stdio.c index 99afda353c..a6794d26d7 100644 --- a/chardev/char-win-stdio.c +++ b/chardev/char-win-stdio.c @@ -260,10 +260,6 @@ static const TypeInfo char_win_stdio_type_info = { .class_init = char_win_stdio_class_init, .abstract = true, }; +TYPE_INFO(char_win_stdio_type_info) -static void register_types(void) -{ - type_register_static(&char_win_stdio_type_info); -} -type_init(register_types); diff --git a/chardev/char-win.c b/chardev/char-win.c index d4fb44c4dc..f7965c1aca 100644 --- a/chardev/char-win.c +++ b/chardev/char-win.c @@ -235,10 +235,6 @@ static const TypeInfo char_win_type_info = { .class_init = char_win_class_init, .abstract = true, }; +TYPE_INFO(char_win_type_info) -static void register_types(void) -{ - type_register_static(&char_win_type_info); -} -type_init(register_types); diff --git a/chardev/char.c b/chardev/char.c index 77e7ec814f..9665aa5b20 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -304,6 +304,7 @@ static const TypeInfo char_type_info = { .class_size = sizeof(ChardevClass), .class_init = char_class_init, }; +TYPE_INFO(char_type_info) static bool qemu_chr_is_busy(Chardev *s) { @@ -1168,9 +1169,4 @@ void qemu_chr_cleanup(void) object_unparent(get_chardevs_root()); } -static void register_types(void) -{ - type_register_static(&char_type_info); -} -type_init(register_types); diff --git a/chardev/msmouse.c b/chardev/msmouse.c index 6d8f06fed4..680c772f6f 100644 --- a/chardev/msmouse.c +++ b/chardev/msmouse.c @@ -182,10 +182,6 @@ static const TypeInfo char_msmouse_type_info = { .instance_finalize = char_msmouse_finalize, .class_init = char_msmouse_class_init, }; +TYPE_INFO(char_msmouse_type_info) -static void register_types(void) -{ - type_register_static(&char_msmouse_type_info); -} -type_init(register_types); diff --git a/chardev/spice.c b/chardev/spice.c index bf7ea1e294..08555d6c43 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -383,6 +383,7 @@ static const TypeInfo char_spice_type_info = { .class_init = char_spice_class_init, .abstract = true, }; +TYPE_INFO(char_spice_type_info) static void char_spicevmc_class_init(ObjectClass *oc, void *data) { @@ -398,6 +399,7 @@ static const TypeInfo char_spicevmc_type_info = { .parent = TYPE_CHARDEV_SPICE, .class_init = char_spicevmc_class_init, }; +TYPE_INFO(char_spicevmc_type_info) static void char_spiceport_class_init(ObjectClass *oc, void *data) { @@ -413,12 +415,6 @@ static const TypeInfo char_spiceport_type_info = { .parent = TYPE_CHARDEV_SPICE, .class_init = char_spiceport_class_init, }; +TYPE_INFO(char_spiceport_type_info) -static void register_types(void) -{ - type_register_static(&char_spice_type_info); - type_register_static(&char_spicevmc_type_info); - type_register_static(&char_spiceport_type_info); -} -type_init(register_types); diff --git a/chardev/testdev.c b/chardev/testdev.c index 368a8c041e..0c0ddc17d7 100644 --- a/chardev/testdev.c +++ b/chardev/testdev.c @@ -121,10 +121,6 @@ static const TypeInfo char_testdev_type_info = { .instance_size = sizeof(TestdevChardev), .class_init = char_testdev_class_init, }; +TYPE_INFO(char_testdev_type_info) -static void register_types(void) -{ - type_register_static(&char_testdev_type_info); -} -type_init(register_types); diff --git a/chardev/wctablet.c b/chardev/wctablet.c index e9cb7ca710..95c7504002 100644 --- a/chardev/wctablet.c +++ b/chardev/wctablet.c @@ -356,10 +356,6 @@ static const TypeInfo wctablet_type_info = { .instance_finalize = wctablet_chr_finalize, .class_init = wctablet_chr_class_init, }; +TYPE_INFO(wctablet_type_info) -static void register_types(void) -{ - type_register_static(&wctablet_type_info); -} -type_init(register_types); diff --git a/crypto/secret.c b/crypto/secret.c index 281cb81f0f..c07011d388 100644 --- a/crypto/secret.c +++ b/crypto/secret.c @@ -153,13 +153,8 @@ static const TypeInfo qcrypto_secret_info = { { } } }; +TYPE_INFO(qcrypto_secret_info) -static void -qcrypto_secret_register_types(void) -{ - type_register_static(&qcrypto_secret_info); -} -type_init(qcrypto_secret_register_types); diff --git a/crypto/secret_common.c b/crypto/secret_common.c index b03d530867..80d7d75b4d 100644 --- a/crypto/secret_common.c +++ b/crypto/secret_common.c @@ -391,13 +391,8 @@ static const TypeInfo qcrypto_secret_info = { .class_init = qcrypto_secret_class_init, .abstract = true, }; +TYPE_INFO(qcrypto_secret_info) -static void -qcrypto_secret_register_types(void) -{ - type_register_static(&qcrypto_secret_info); -} -type_init(qcrypto_secret_register_types); diff --git a/crypto/secret_keyring.c b/crypto/secret_keyring.c index 8bfc58ebf4..821d2e421b 100644 --- a/crypto/secret_keyring.c +++ b/crypto/secret_keyring.c @@ -136,13 +136,8 @@ static const TypeInfo qcrypto_secret_info = { { } } }; +TYPE_INFO(qcrypto_secret_info) -static void -qcrypto_secret_register_types(void) -{ - type_register_static(&qcrypto_secret_info); -} -type_init(qcrypto_secret_register_types); diff --git a/crypto/tls-cipher-suites.c b/crypto/tls-cipher-suites.c index 0d305b684b..e92a380a24 100644 --- a/crypto/tls-cipher-suites.c +++ b/crypto/tls-cipher-suites.c @@ -117,10 +117,6 @@ static const TypeInfo qcrypto_tls_cipher_suites_info = { { } } }; +TYPE_INFO(qcrypto_tls_cipher_suites_info) -static void qcrypto_tls_cipher_suites_register_types(void) -{ - type_register_static(&qcrypto_tls_cipher_suites_info); -} -type_init(qcrypto_tls_cipher_suites_register_types); diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c index b68735f06f..bb3e6667b9 100644 --- a/crypto/tlscreds.c +++ b/crypto/tlscreds.c @@ -270,13 +270,8 @@ static const TypeInfo qcrypto_tls_creds_info = { .class_size = sizeof(QCryptoTLSCredsClass), .abstract = true, }; +TYPE_INFO(qcrypto_tls_creds_info) -static void -qcrypto_tls_creds_register_types(void) -{ - type_register_static(&qcrypto_tls_creds_info); -} -type_init(qcrypto_tls_creds_register_types); diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c index 30275b6847..16162e60b6 100644 --- a/crypto/tlscredsanon.c +++ b/crypto/tlscredsanon.c @@ -203,13 +203,8 @@ static const TypeInfo qcrypto_tls_creds_anon_info = { { } } }; +TYPE_INFO(qcrypto_tls_creds_anon_info) -static void -qcrypto_tls_creds_anon_register_types(void) -{ - type_register_static(&qcrypto_tls_creds_anon_info); -} -type_init(qcrypto_tls_creds_anon_register_types); diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c index e26807b899..ea890f5837 100644 --- a/crypto/tlscredspsk.c +++ b/crypto/tlscredspsk.c @@ -294,13 +294,8 @@ static const TypeInfo qcrypto_tls_creds_psk_info = { { } } }; +TYPE_INFO(qcrypto_tls_creds_psk_info) -static void -qcrypto_tls_creds_psk_register_types(void) -{ - type_register_static(&qcrypto_tls_creds_psk_info); -} -type_init(qcrypto_tls_creds_psk_register_types); diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c index dd7267ccdb..77f1beaf8b 100644 --- a/crypto/tlscredsx509.c +++ b/crypto/tlscredsx509.c @@ -829,13 +829,8 @@ static const TypeInfo qcrypto_tls_creds_x509_info = { { } } }; +TYPE_INFO(qcrypto_tls_creds_x509_info) -static void -qcrypto_tls_creds_x509_register_types(void) -{ - type_register_static(&qcrypto_tls_creds_x509_info); -} -type_init(qcrypto_tls_creds_x509_register_types); diff --git a/gdbstub.c b/gdbstub.c index f3a318cd7f..03d0fb9890 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -3308,6 +3308,7 @@ static const TypeInfo char_gdb_type_info = { .parent = TYPE_CHARDEV, .class_init = char_gdb_class_init, }; +TYPE_INFO(char_gdb_type_info) static int find_cpu_clusters(Object *child, void *opaque) { @@ -3440,10 +3441,5 @@ void gdbserver_cleanup(void) } } -static void register_types(void) -{ - type_register_static(&char_gdb_type_info); -} -type_init(register_types); #endif diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index 36f3aa9352..4d16e2033f 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -259,10 +259,6 @@ static const TypeInfo virtio_device_info = { .instance_size = sizeof(V9fsVirtioState), .class_init = virtio_9p_class_init, }; +TYPE_INFO(virtio_device_info) -static void virtio_9p_register_types(void) -{ - type_register_static(&virtio_device_info); -} -type_init(virtio_9p_register_types) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index b8abdefa1c..e766835af6 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -363,10 +363,6 @@ static const TypeInfo acpi_ged_info = { { } } }; +TYPE_INFO(acpi_ged_info) -static void acpi_ged_register_types(void) -{ - type_register_static(&acpi_ged_info); -} -type_init(acpi_ged_register_types) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 26bac4f16c..f27f6660f9 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -684,10 +684,6 @@ static const TypeInfo piix4_pm_info = { { } } }; +TYPE_INFO(piix4_pm_info) -static void piix4_pm_register_types(void) -{ - type_register_static(&piix4_pm_info); -} -type_init(piix4_pm_register_types) diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index 2df7623d74..ca62b6f161 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -237,13 +237,9 @@ static const TypeInfo vmgenid_device_info = { .instance_size = sizeof(VmGenIdState), .class_init = vmgenid_device_class_init, }; +TYPE_INFO(vmgenid_device_info) -static void vmgenid_register_types(void) -{ - type_register_static(&vmgenid_device_info); -} -type_init(vmgenid_register_types) GuidInfo *qmp_query_vm_generation_id(Error **errp) { diff --git a/hw/adc/stm32f2xx_adc.c b/hw/adc/stm32f2xx_adc.c index 01a0b14e69..647a47c706 100644 --- a/hw/adc/stm32f2xx_adc.c +++ b/hw/adc/stm32f2xx_adc.c @@ -299,10 +299,6 @@ static const TypeInfo stm32f2xx_adc_info = { .instance_init = stm32f2xx_adc_init, .class_init = stm32f2xx_adc_class_init, }; +TYPE_INFO(stm32f2xx_adc_info) -static void stm32f2xx_adc_register_types(void) -{ - type_register_static(&stm32f2xx_adc_info); -} -type_init(stm32f2xx_adc_register_types) diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index 29d44dfb06..637411c10b 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -940,6 +940,7 @@ static const TypeInfo typhoon_pcihost_info = { .parent = TYPE_PCI_HOST_BRIDGE, .instance_size = sizeof(TyphoonState), }; +TYPE_INFO(typhoon_pcihost_info) static void typhoon_iommu_memory_region_class_init(ObjectClass *klass, void *data) @@ -954,11 +955,6 @@ static const TypeInfo typhoon_iommu_memory_region_info = { .name = TYPE_TYPHOON_IOMMU_MEMORY_REGION, .class_init = typhoon_iommu_memory_region_class_init, }; +TYPE_INFO(typhoon_iommu_memory_region_info) -static void typhoon_register_types(void) -{ - type_register_static(&typhoon_pcihost_info); - type_register_static(&typhoon_iommu_memory_region_info); -} -type_init(typhoon_register_types) diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index e258463747..1dad8a226b 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -182,10 +182,6 @@ static const TypeInfo aw_a10_type_info = { .instance_init = aw_a10_init, .class_init = aw_a10_class_init, }; +TYPE_INFO(aw_a10_type_info) -static void aw_a10_register_types(void) -{ - type_register_static(&aw_a10_type_info); -} -type_init(aw_a10_register_types) diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c index 341abe6718..c59d2ffc3e 100644 --- a/hw/arm/allwinner-h3.c +++ b/hw/arm/allwinner-h3.c @@ -446,10 +446,6 @@ static const TypeInfo allwinner_h3_type_info = { .instance_init = allwinner_h3_init, .class_init = allwinner_h3_class_init, }; +TYPE_INFO(allwinner_h3_type_info) -static void allwinner_h3_register_types(void) -{ - type_register_static(&allwinner_h3_type_info); -} -type_init(allwinner_h3_register_types) diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index dcbff9bd8f..71ebfd6757 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -1167,12 +1167,12 @@ static const TypeInfo armsse_info = { { } } }; +TYPE_INFO(armsse_info) static void armsse_register_types(void) { int i; - type_register_static(&armsse_info); for (i = 0; i < ARRAY_SIZE(armsse_variants); i++) { TypeInfo ti = { diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index aa831d6653..684cdd5417 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -280,6 +280,7 @@ static const TypeInfo armv7m_info = { .instance_init = armv7m_instance_init, .class_init = armv7m_class_init, }; +TYPE_INFO(armv7m_info) static void armv7m_reset(void *opaque) { @@ -359,11 +360,6 @@ static const TypeInfo bitband_info = { .instance_init = bitband_init, .class_init = bitband_class_init, }; +TYPE_INFO(bitband_info) -static void armv7m_register_types(void) -{ - type_register_static(&bitband_info); - type_register_static(&armv7m_info); -} -type_init(armv7m_register_types) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index a9d7f53f6e..3d45e4ab7f 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -373,10 +373,6 @@ static const TypeInfo bcm2835_peripherals_type_info = { .instance_init = bcm2835_peripherals_init, .class_init = bcm2835_peripherals_class_init, }; +TYPE_INFO(bcm2835_peripherals_type_info) -static void bcm2835_peripherals_register_types(void) -{ - type_register_static(&bcm2835_peripherals_type_info); -} -type_init(bcm2835_peripherals_register_types) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index f15cc3b405..7ae9bbdbca 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -168,12 +168,12 @@ static const TypeInfo bcm283x_type_info = { .class_size = sizeof(BCM283XClass), .abstract = true, }; +TYPE_INFO(bcm283x_type_info) static void bcm2836_register_types(void) { int i; - type_register_static(&bcm283x_type_info); for (i = 0; i < ARRAY_SIZE(bcm283x_socs); i++) { TypeInfo ti = { .name = bcm283x_socs[i].name, diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 3e9816af80..0ee0934e81 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -1317,10 +1317,6 @@ static const TypeInfo arm_linux_boot_if_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(ARMLinuxBootIfClass), }; +TYPE_INFO(arm_linux_boot_if_info) -static void arm_linux_boot_register_types(void) -{ - type_register_static(&arm_linux_boot_if_info); -} -type_init(arm_linux_boot_register_types) diff --git a/hw/arm/collie.c b/hw/arm/collie.c index 4b35ef4bed..041bab40ef 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -85,9 +85,5 @@ static const TypeInfo collie_machine_typeinfo = { .class_init = collie_machine_class_init, .instance_size = sizeof(CollieMachineState), }; +TYPE_INFO(collie_machine_typeinfo) -static void collie_machine_register_types(void) -{ - type_register_static(&collie_machine_typeinfo); -} -type_init(collie_machine_register_types); diff --git a/hw/arm/digic.c b/hw/arm/digic.c index 614232165c..aae48a4f04 100644 --- a/hw/arm/digic.c +++ b/hw/arm/digic.c @@ -98,10 +98,6 @@ static const TypeInfo digic_type_info = { .instance_init = digic_init, .class_init = digic_class_init, }; +TYPE_INFO(digic_type_info) -static void digic_register_types(void) -{ - type_register_static(&digic_type_info); -} -type_init(digic_register_types) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 081bbff317..e42677ded7 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -502,10 +502,6 @@ static const TypeInfo exynos4210_info = { .instance_init = exynos4210_init, .class_init = exynos4210_class_init, }; +TYPE_INFO(exynos4210_info) -static void exynos4210_register_types(void) -{ - type_register_static(&exynos4210_info); -} -type_init(exynos4210_register_types) diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index 56b729141b..7761a0fe97 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm/exynos4_boards.c @@ -169,6 +169,7 @@ static const TypeInfo nuri_type = { .parent = TYPE_MACHINE, .class_init = nuri_class_init, }; +TYPE_INFO(nuri_type) static void smdkc210_class_init(ObjectClass *oc, void *data) { @@ -187,11 +188,6 @@ static const TypeInfo smdkc210_type = { .parent = TYPE_MACHINE, .class_init = smdkc210_class_init, }; +TYPE_INFO(smdkc210_type) -static void exynos4_machines_init(void) -{ - type_register_static(&nuri_type); - type_register_static(&smdkc210_type); -} -type_init(exynos4_machines_init) diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 08a98f828f..256681a31a 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -342,10 +342,6 @@ static const TypeInfo fsl_imx25_type_info = { .instance_init = fsl_imx25_init, .class_init = fsl_imx25_class_init, }; +TYPE_INFO(fsl_imx25_type_info) -static void fsl_imx25_register_types(void) -{ - type_register_static(&fsl_imx25_type_info); -} -type_init(fsl_imx25_register_types) diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 0983998bb4..6e8c780737 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -245,10 +245,6 @@ static const TypeInfo fsl_imx31_type_info = { .instance_init = fsl_imx31_init, .class_init = fsl_imx31_class_init, }; +TYPE_INFO(fsl_imx31_type_info) -static void fsl_imx31_register_types(void) -{ - type_register_static(&fsl_imx31_type_info); -} -type_init(fsl_imx31_register_types) diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 00dafe3f62..917642a97f 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -473,10 +473,6 @@ static const TypeInfo fsl_imx6_type_info = { .instance_init = fsl_imx6_init, .class_init = fsl_imx6_class_init, }; +TYPE_INFO(fsl_imx6_type_info) -static void fsl_imx6_register_types(void) -{ - type_register_static(&fsl_imx6_type_info); -} -type_init(fsl_imx6_register_types) diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index e0128d7316..39b5ab528f 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -631,9 +631,5 @@ static const TypeInfo fsl_imx6ul_type_info = { .instance_init = fsl_imx6ul_init, .class_init = fsl_imx6ul_class_init, }; +TYPE_INFO(fsl_imx6ul_type_info) -static void fsl_imx6ul_register_types(void) -{ - type_register_static(&fsl_imx6ul_type_info); -} -type_init(fsl_imx6ul_register_types) diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index 2ff2cab924..5b062dd294 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -577,9 +577,5 @@ static const TypeInfo fsl_imx7_type_info = { .instance_init = fsl_imx7_init, .class_init = fsl_imx7_class_init, }; +TYPE_INFO(fsl_imx7_type_info) -static void fsl_imx7_register_types(void) -{ - type_register_static(&fsl_imx7_type_info); -} -type_init(fsl_imx7_register_types) diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c index 3a4bc332c4..bb88fae49c 100644 --- a/hw/arm/gumstix.c +++ b/hw/arm/gumstix.c @@ -121,6 +121,7 @@ static const TypeInfo connex_type = { .parent = TYPE_MACHINE, .class_init = connex_class_init, }; +TYPE_INFO(connex_type) static void verdex_class_init(ObjectClass *oc, void *data) { @@ -137,11 +138,6 @@ static const TypeInfo verdex_type = { .parent = TYPE_MACHINE, .class_init = verdex_class_init, }; +TYPE_INFO(verdex_type) -static void gumstix_machine_init(void) -{ - type_register_static(&connex_type); - type_register_static(&verdex_type); -} -type_init(gumstix_machine_init) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index c96f2ab9cf..07dad406b4 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -213,13 +213,9 @@ static const TypeInfo highbank_regs_info = { .instance_init = highbank_regs_init, .class_init = highbank_regs_class_init, }; +TYPE_INFO(highbank_regs_info) -static void highbank_regs_register_types(void) -{ - type_register_static(&highbank_regs_info); -} -type_init(highbank_regs_register_types) static struct arm_boot_info highbank_binfo; @@ -434,6 +430,7 @@ static const TypeInfo highbank_type = { .parent = TYPE_MACHINE, .class_init = highbank_class_init, }; +TYPE_INFO(highbank_type) static void midway_class_init(ObjectClass *oc, void *data) { @@ -453,11 +450,6 @@ static const TypeInfo midway_type = { .parent = TYPE_MACHINE, .class_init = midway_class_init, }; +TYPE_INFO(midway_type) -static void calxeda_machines_init(void) -{ - type_register_static(&highbank_type); - type_register_static(&midway_type); -} -type_init(calxeda_machines_init) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index f304c2b4f0..1be8ed5228 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -706,6 +706,7 @@ static const TypeInfo core_info = { .instance_init = integratorcm_init, .class_init = core_class_init, }; +TYPE_INFO(core_info) static const TypeInfo icp_pic_info = { .name = TYPE_INTEGRATOR_PIC, @@ -714,6 +715,7 @@ static const TypeInfo icp_pic_info = { .instance_init = icp_pic_init, .class_init = icp_pic_class_init, }; +TYPE_INFO(icp_pic_info) static const TypeInfo icp_ctrl_regs_info = { .name = TYPE_ICP_CONTROL_REGS, @@ -722,12 +724,6 @@ static const TypeInfo icp_ctrl_regs_info = { .instance_init = icp_control_init, .class_init = icp_control_class_init, }; +TYPE_INFO(icp_ctrl_regs_info) -static void integratorcp_register_types(void) -{ - type_register_static(&icp_pic_info); - type_register_static(&core_info); - type_register_static(&icp_ctrl_regs_info); -} -type_init(integratorcp_register_types) diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c index a91acab1cb..92331aebf1 100644 --- a/hw/arm/microbit.c +++ b/hw/arm/microbit.c @@ -75,10 +75,6 @@ static const TypeInfo microbit_info = { .instance_size = sizeof(MicrobitMachineState), .class_init = microbit_machine_class_init, }; +TYPE_INFO(microbit_info) -static void microbit_machine_init(void) -{ - type_register_static(µbit_info); -} -type_init(microbit_machine_init); diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 28d9e8bfac..0a1819fd67 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -692,24 +692,20 @@ static const TypeInfo mps2tz_info = { { } }, }; +TYPE_INFO(mps2tz_info) static const TypeInfo mps2tz_an505_info = { .name = TYPE_MPS2TZ_AN505_MACHINE, .parent = TYPE_MPS2TZ_MACHINE, .class_init = mps2tz_an505_class_init, }; +TYPE_INFO(mps2tz_an505_info) static const TypeInfo mps2tz_an521_info = { .name = TYPE_MPS2TZ_AN521_MACHINE, .parent = TYPE_MPS2TZ_MACHINE, .class_init = mps2tz_an521_class_init, }; +TYPE_INFO(mps2tz_an521_info) -static void mps2tz_machine_init(void) -{ - type_register_static(&mps2tz_info); - type_register_static(&mps2tz_an505_info); - type_register_static(&mps2tz_an521_info); -} -type_init(mps2tz_machine_init); diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index 9f12934ca8..4ca6e1ce12 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -428,24 +428,20 @@ static const TypeInfo mps2_info = { .class_size = sizeof(MPS2MachineClass), .class_init = mps2_class_init, }; +TYPE_INFO(mps2_info) static const TypeInfo mps2_an385_info = { .name = TYPE_MPS2_AN385_MACHINE, .parent = TYPE_MPS2_MACHINE, .class_init = mps2_an385_class_init, }; +TYPE_INFO(mps2_an385_info) static const TypeInfo mps2_an511_info = { .name = TYPE_MPS2_AN511_MACHINE, .parent = TYPE_MPS2_MACHINE, .class_init = mps2_an511_class_init, }; +TYPE_INFO(mps2_an511_info) -static void mps2_machine_init(void) -{ - type_register_static(&mps2_info); - type_register_static(&mps2_an385_info); - type_register_static(&mps2_an511_info); -} -type_init(mps2_machine_init); diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c index d2c29e82d1..5e922b1942 100644 --- a/hw/arm/msf2-soc.c +++ b/hw/arm/msf2-soc.c @@ -234,10 +234,6 @@ static const TypeInfo m2sxxx_soc_info = { .instance_init = m2sxxx_soc_initfn, .class_init = m2sxxx_soc_class_init, }; +TYPE_INFO(m2sxxx_soc_info) -static void m2sxxx_soc_types(void) -{ - type_register_static(&m2sxxx_soc_info); -} -type_init(m2sxxx_soc_types) diff --git a/hw/arm/musca.c b/hw/arm/musca.c index 4bc737f93b..8afc118134 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -647,24 +647,20 @@ static const TypeInfo musca_info = { .class_size = sizeof(MuscaMachineClass), .class_init = musca_class_init, }; +TYPE_INFO(musca_info) static const TypeInfo musca_a_info = { .name = TYPE_MUSCA_A_MACHINE, .parent = TYPE_MUSCA_MACHINE, .class_init = musca_a_class_init, }; +TYPE_INFO(musca_a_info) static const TypeInfo musca_b1_info = { .name = TYPE_MUSCA_B1_MACHINE, .parent = TYPE_MUSCA_MACHINE, .class_init = musca_b1_class_init, }; +TYPE_INFO(musca_b1_info) -static void musca_machine_init(void) -{ - type_register_static(&musca_info); - type_register_static(&musca_a_info); - type_register_static(&musca_b1_info); -} -type_init(musca_machine_init); diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index c3b9780f35..9decd7abd1 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -447,6 +447,7 @@ static const TypeInfo mv88w8618_eth_info = { .instance_init = mv88w8618_eth_init, .class_init = mv88w8618_eth_class_init, }; +TYPE_INFO(mv88w8618_eth_info) /* LCD register offsets */ #define MP_LCD_IRQCTRL 0x180 @@ -678,6 +679,7 @@ static const TypeInfo musicpal_lcd_info = { .instance_init = musicpal_lcd_init, .class_init = musicpal_lcd_class_init, }; +TYPE_INFO(musicpal_lcd_info) /* PIC register offsets */ #define MP_PIC_STATUS 0x00 @@ -800,6 +802,7 @@ static const TypeInfo mv88w8618_pic_info = { .instance_init = mv88w8618_pic_init, .class_init = mv88w8618_pic_class_init, }; +TYPE_INFO(mv88w8618_pic_info) /* PIT register offsets */ #define MP_PIT_TIMER1_LENGTH 0x00 @@ -984,6 +987,7 @@ static const TypeInfo mv88w8618_pit_info = { .instance_init = mv88w8618_pit_init, .class_init = mv88w8618_pit_class_init, }; +TYPE_INFO(mv88w8618_pit_info) /* Flash config register offsets */ #define MP_FLASHCFG_CFGR0 0x04 @@ -1069,6 +1073,7 @@ static const TypeInfo mv88w8618_flashcfg_info = { .instance_init = mv88w8618_flashcfg_init, .class_init = mv88w8618_flashcfg_class_init, }; +TYPE_INFO(mv88w8618_flashcfg_info) /* Misc register offsets */ #define MP_MISC_BOARD_REVISION 0x18 @@ -1123,6 +1128,7 @@ static const TypeInfo musicpal_misc_info = { .instance_init = musicpal_misc_init, .instance_size = sizeof(MusicPalMiscState), }; +TYPE_INFO(musicpal_misc_info) /* WLAN register offsets */ #define MP_WLAN_MAGIC1 0x11c @@ -1411,6 +1417,7 @@ static const TypeInfo musicpal_gpio_info = { .instance_init = musicpal_gpio_init, .class_init = musicpal_gpio_class_init, }; +TYPE_INFO(musicpal_gpio_info) /* Keyboard codes & masks */ #define KEY_RELEASED 0x80 @@ -1570,6 +1577,7 @@ static const TypeInfo musicpal_key_info = { .instance_init = musicpal_key_init, .class_init = musicpal_key_class_init, }; +TYPE_INFO(musicpal_key_info) static struct arm_boot_info musicpal_binfo = { .loader_start = 0x0, @@ -1725,18 +1733,6 @@ static const TypeInfo mv88w8618_wlan_info = { .instance_size = sizeof(SysBusDevice), .class_init = mv88w8618_wlan_class_init, }; +TYPE_INFO(mv88w8618_wlan_info) -static void musicpal_register_types(void) -{ - type_register_static(&mv88w8618_pic_info); - type_register_static(&mv88w8618_pit_info); - type_register_static(&mv88w8618_flashcfg_info); - type_register_static(&mv88w8618_eth_info); - type_register_static(&mv88w8618_wlan_info); - type_register_static(&musicpal_lcd_info); - type_register_static(&musicpal_gpio_info); - type_register_static(&musicpal_key_info); - type_register_static(&musicpal_misc_info); -} -type_init(musicpal_register_types) diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c index e15981e019..aabb59330c 100644 --- a/hw/arm/nrf51_soc.c +++ b/hw/arm/nrf51_soc.c @@ -219,9 +219,5 @@ static const TypeInfo nrf51_soc_info = { .instance_init = nrf51_soc_init, .class_init = nrf51_soc_class_init, }; +TYPE_INFO(nrf51_soc_info) -static void nrf51_soc_types(void) -{ - type_register_static(&nrf51_soc_info); -} -type_init(nrf51_soc_types) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index e48092ca04..08e7a604c0 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -1441,6 +1441,7 @@ static const TypeInfo n800_type = { .parent = TYPE_MACHINE, .class_init = n800_class_init, }; +TYPE_INFO(n800_type) static void n810_class_init(ObjectClass *oc, void *data) { @@ -1461,11 +1462,6 @@ static const TypeInfo n810_type = { .parent = TYPE_MACHINE, .class_init = n810_class_init, }; +TYPE_INFO(n810_type) -static void nseries_machine_init(void) -{ - type_register_static(&n800_type); - type_register_static(&n810_type); -} -type_init(nseries_machine_init) diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index 57829b3744..f453c18067 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -229,6 +229,7 @@ static const TypeInfo sx1_machine_v2_type = { .parent = TYPE_MACHINE, .class_init = sx1_machine_v2_class_init, }; +TYPE_INFO(sx1_machine_v2_type) static void sx1_machine_v1_class_init(ObjectClass *oc, void *data) { @@ -247,11 +248,6 @@ static const TypeInfo sx1_machine_v1_type = { .parent = TYPE_MACHINE, .class_init = sx1_machine_v1_class_init, }; +TYPE_INFO(sx1_machine_v1_type) -static void sx1_machine_init(void) -{ - type_register_static(&sx1_machine_v1_type); - type_register_static(&sx1_machine_v2_type); -} -type_init(sx1_machine_init) diff --git a/hw/arm/palm.c b/hw/arm/palm.c index e7bc9ea4c6..7980d321ee 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -183,6 +183,7 @@ static const TypeInfo palm_misc_gpio_info = { * need to set up reset or vmstate, and has no realize method. */ }; +TYPE_INFO(palm_misc_gpio_info) static void palmte_gpio_setup(struct omap_mpu_state_s *cpu) { @@ -313,9 +314,4 @@ static void palmte_machine_init(MachineClass *mc) DEFINE_MACHINE("cheetah", palmte_machine_init) -static void palm_register_types(void) -{ - type_register_static(&palm_misc_gpio_info); -} -type_init(palm_register_types) diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 6203c4cfe0..391aeb6229 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -1237,6 +1237,7 @@ static const TypeInfo pxa2xx_rtc_sysbus_info = { .instance_init = pxa2xx_rtc_init, .class_init = pxa2xx_rtc_sysbus_class_init, }; +TYPE_INFO(pxa2xx_rtc_sysbus_info) /* I2C Interface */ @@ -1501,6 +1502,7 @@ static const TypeInfo pxa2xx_i2c_slave_info = { .instance_size = sizeof(PXA2xxI2CSlaveState), .class_init = pxa2xx_i2c_slave_class_init, }; +TYPE_INFO(pxa2xx_i2c_slave_info) PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base, qemu_irq irq, uint32_t region_size) @@ -1571,6 +1573,7 @@ static const TypeInfo pxa2xx_i2c_info = { .instance_init = pxa2xx_i2c_initfn, .class_init = pxa2xx_i2c_class_init, }; +TYPE_INFO(pxa2xx_i2c_info) /* PXA Inter-IC Sound Controller */ static void pxa2xx_i2s_reset(PXA2xxI2SState *i2s) @@ -2064,6 +2067,7 @@ static const TypeInfo pxa2xx_fir_info = { .class_init = pxa2xx_fir_class_init, .instance_init = pxa2xx_fir_instance_init, }; +TYPE_INFO(pxa2xx_fir_info) static PXA2xxFIrState *pxa2xx_fir_init(MemoryRegion *sysmem, hwaddr base, @@ -2360,14 +2364,6 @@ static const TypeInfo pxa2xx_ssp_info = { .instance_init = pxa2xx_ssp_init, .class_init = pxa2xx_ssp_class_init, }; +TYPE_INFO(pxa2xx_ssp_info) -static void pxa2xx_register_types(void) -{ - type_register_static(&pxa2xx_i2c_slave_info); - type_register_static(&pxa2xx_ssp_info); - type_register_static(&pxa2xx_i2c_info); - type_register_static(&pxa2xx_rtc_sysbus_info); - type_register_static(&pxa2xx_fir_info); -} -type_init(pxa2xx_register_types) diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c index d6d0d0b08e..a0f3592f17 100644 --- a/hw/arm/pxa2xx_gpio.c +++ b/hw/arm/pxa2xx_gpio.c @@ -361,10 +361,6 @@ static const TypeInfo pxa2xx_gpio_info = { .instance_init = pxa2xx_gpio_initfn, .class_init = pxa2xx_gpio_class_init, }; +TYPE_INFO(pxa2xx_gpio_info) -static void pxa2xx_gpio_register_types(void) -{ - type_register_static(&pxa2xx_gpio_info); -} -type_init(pxa2xx_gpio_register_types) diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index ceee6aa48d..bfc0dd8df6 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -330,10 +330,6 @@ static const TypeInfo pxa2xx_pic_info = { .instance_size = sizeof(PXA2xxPICState), .class_init = pxa2xx_pic_class_init, }; +TYPE_INFO(pxa2xx_pic_info) -static void pxa2xx_pic_register_types(void) -{ - type_register_static(&pxa2xx_pic_info); -} -type_init(pxa2xx_pic_register_types) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index c1ff172b13..493097b1c5 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -394,6 +394,7 @@ static const TypeInfo realview_eb_type = { .parent = TYPE_MACHINE, .class_init = realview_eb_class_init, }; +TYPE_INFO(realview_eb_type) static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) { @@ -412,6 +413,7 @@ static const TypeInfo realview_eb_mpcore_type = { .parent = TYPE_MACHINE, .class_init = realview_eb_mpcore_class_init, }; +TYPE_INFO(realview_eb_mpcore_type) static void realview_pb_a8_class_init(ObjectClass *oc, void *data) { @@ -428,6 +430,7 @@ static const TypeInfo realview_pb_a8_type = { .parent = TYPE_MACHINE, .class_init = realview_pb_a8_class_init, }; +TYPE_INFO(realview_pb_a8_type) static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) { @@ -445,13 +448,6 @@ static const TypeInfo realview_pbx_a9_type = { .parent = TYPE_MACHINE, .class_init = realview_pbx_a9_class_init, }; +TYPE_INFO(realview_pbx_a9_type) -static void realview_machine_init(void) -{ - type_register_static(&realview_eb_type); - type_register_static(&realview_eb_mpcore_type); - type_register_static(&realview_pb_a8_type); - type_register_static(&realview_pbx_a9_type); -} -type_init(realview_machine_init) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index f030a416fd..e6715ab638 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -797,10 +797,6 @@ static const TypeInfo sbsa_ref_info = { .class_init = sbsa_ref_class_init, .instance_size = sizeof(SBSAMachineState), }; +TYPE_INFO(sbsa_ref_info) -static void sbsa_ref_machine_init(void) -{ - type_register_static(&sbsa_ref_info); -} -type_init(sbsa_ref_machine_init); diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index e13a5f4a7c..265eed7b5b 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -477,11 +477,7 @@ static const TypeInfo smmu_base_info = { .class_init = smmu_base_class_init, .abstract = true, }; +TYPE_INFO(smmu_base_info) -static void smmu_base_register_types(void) -{ - type_register_static(&smmu_base_info); -} -type_init(smmu_base_register_types) diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 7ac8254aa6..9c762ecedd 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -1055,6 +1055,7 @@ static const TypeInfo spitz_common_info = { .class_size = sizeof(SpitzMachineClass), .class_init = spitz_common_class_init, }; +TYPE_INFO(spitz_common_info) static void akitapda_class_init(ObjectClass *oc, void *data) { @@ -1072,6 +1073,7 @@ static const TypeInfo akitapda_type = { .parent = TYPE_SPITZ_MACHINE, .class_init = akitapda_class_init, }; +TYPE_INFO(akitapda_type) static void spitzpda_class_init(ObjectClass *oc, void *data) { @@ -1089,6 +1091,7 @@ static const TypeInfo spitzpda_type = { .parent = TYPE_SPITZ_MACHINE, .class_init = spitzpda_class_init, }; +TYPE_INFO(spitzpda_type) static void borzoipda_class_init(ObjectClass *oc, void *data) { @@ -1106,6 +1109,7 @@ static const TypeInfo borzoipda_type = { .parent = TYPE_SPITZ_MACHINE, .class_init = borzoipda_class_init, }; +TYPE_INFO(borzoipda_type) static void terrierpda_class_init(ObjectClass *oc, void *data) { @@ -1123,17 +1127,9 @@ static const TypeInfo terrierpda_type = { .parent = TYPE_SPITZ_MACHINE, .class_init = terrierpda_class_init, }; +TYPE_INFO(terrierpda_type) -static void spitz_machine_init(void) -{ - type_register_static(&spitz_common_info); - type_register_static(&akitapda_type); - type_register_static(&spitzpda_type); - type_register_static(&borzoipda_type); - type_register_static(&terrierpda_type); -} -type_init(spitz_machine_init) static bool is_version_0(void *opaque, int version_id) { @@ -1175,6 +1171,7 @@ static const TypeInfo sl_nand_info = { .instance_init = sl_nand_init, .class_init = sl_nand_class_init, }; +TYPE_INFO(sl_nand_info) static VMStateDescription vmstate_spitz_kbd = { .name = "spitz-keyboard", @@ -1204,6 +1201,7 @@ static const TypeInfo spitz_keyboard_info = { .instance_init = spitz_keyboard_init, .class_init = spitz_keyboard_class_init, }; +TYPE_INFO(spitz_keyboard_info) static const VMStateDescription vmstate_corgi_ssp_regs = { .name = "corgi-ssp", @@ -1232,6 +1230,7 @@ static const TypeInfo corgi_ssp_info = { .instance_size = sizeof(CorgiSSPState), .class_init = corgi_ssp_class_init, }; +TYPE_INFO(corgi_ssp_info) static const VMStateDescription vmstate_spitz_lcdtg_regs = { .name = "spitz-lcdtg", @@ -1261,6 +1260,7 @@ static const TypeInfo spitz_lcdtg_info = { .instance_size = sizeof(SpitzLCDTG), .class_init = spitz_lcdtg_class_init, }; +TYPE_INFO(spitz_lcdtg_info) static const TypeInfo spitz_misc_gpio_info = { .name = TYPE_SPITZ_MISC_GPIO, @@ -1272,14 +1272,6 @@ static const TypeInfo spitz_misc_gpio_info = { * need to set up reset or vmstate, and does not have a realize method. */ }; +TYPE_INFO(spitz_misc_gpio_info) -static void spitz_register_types(void) -{ - type_register_static(&corgi_ssp_info); - type_register_static(&spitz_lcdtg_info); - type_register_static(&spitz_keyboard_info); - type_register_static(&sl_nand_info); - type_register_static(&spitz_misc_gpio_info); -} -type_init(spitz_register_types) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 5f9d080180..0bf2be0e27 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -1482,6 +1482,7 @@ static const TypeInfo lm3s811evb_type = { .parent = TYPE_MACHINE, .class_init = lm3s811evb_class_init, }; +TYPE_INFO(lm3s811evb_type) static void lm3s6965evb_class_init(ObjectClass *oc, void *data) { @@ -1498,14 +1499,9 @@ static const TypeInfo lm3s6965evb_type = { .parent = TYPE_MACHINE, .class_init = lm3s6965evb_class_init, }; +TYPE_INFO(lm3s6965evb_type) -static void stellaris_machine_init(void) -{ - type_register_static(&lm3s811evb_type); - type_register_static(&lm3s6965evb_type); -} -type_init(stellaris_machine_init) static void stellaris_i2c_class_init(ObjectClass *klass, void *data) { @@ -1521,6 +1517,7 @@ static const TypeInfo stellaris_i2c_info = { .instance_init = stellaris_i2c_init, .class_init = stellaris_i2c_class_init, }; +TYPE_INFO(stellaris_i2c_info) static void stellaris_gptm_class_init(ObjectClass *klass, void *data) { @@ -1537,6 +1534,7 @@ static const TypeInfo stellaris_gptm_info = { .instance_init = stellaris_gptm_init, .class_init = stellaris_gptm_class_init, }; +TYPE_INFO(stellaris_gptm_info) static void stellaris_adc_class_init(ObjectClass *klass, void *data) { @@ -1552,12 +1550,6 @@ static const TypeInfo stellaris_adc_info = { .instance_init = stellaris_adc_init, .class_init = stellaris_adc_class_init, }; +TYPE_INFO(stellaris_adc_info) -static void stellaris_register_types(void) -{ - type_register_static(&stellaris_i2c_info); - type_register_static(&stellaris_gptm_info); - type_register_static(&stellaris_adc_info); -} -type_init(stellaris_register_types) diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index a4f3344db2..38d2ea8b77 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -195,10 +195,6 @@ static const TypeInfo stm32f205_soc_info = { .instance_init = stm32f205_soc_initfn, .class_init = stm32f205_soc_class_init, }; +TYPE_INFO(stm32f205_soc_info) -static void stm32f205_soc_types(void) -{ - type_register_static(&stm32f205_soc_info); -} -type_init(stm32f205_soc_types) diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index cb04c11198..e24ff4c472 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -271,10 +271,6 @@ static const TypeInfo stm32f405_soc_info = { .instance_init = stm32f405_soc_initfn, .class_init = stm32f405_soc_class_init, }; +TYPE_INFO(stm32f405_soc_info) -static void stm32f405_soc_types(void) -{ - type_register_static(&stm32f405_soc_info); -} -type_init(stm32f405_soc_types) diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 2639b9ae55..5c1fb66b98 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -235,6 +235,7 @@ static const TypeInfo strongarm_pic_info = { .instance_init = strongarm_pic_initfn, .class_init = strongarm_pic_class_init, }; +TYPE_INFO(strongarm_pic_info) /* Real-Time Clock */ #define RTAR 0x00 /* RTC Alarm register */ @@ -466,6 +467,7 @@ static const TypeInfo strongarm_rtc_sysbus_info = { .instance_init = strongarm_rtc_init, .class_init = strongarm_rtc_sysbus_class_init, }; +TYPE_INFO(strongarm_rtc_sysbus_info) /* GPIO */ #define GPLR 0x00 @@ -708,6 +710,7 @@ static const TypeInfo strongarm_gpio_info = { .instance_init = strongarm_gpio_initfn, .class_init = strongarm_gpio_class_init, }; +TYPE_INFO(strongarm_gpio_info) /* Peripheral Pin Controller */ #define PPDR 0x00 @@ -878,6 +881,7 @@ static const TypeInfo strongarm_ppc_info = { .instance_init = strongarm_ppc_init, .class_init = strongarm_ppc_class_init, }; +TYPE_INFO(strongarm_ppc_info) /* UART Ports */ #define UTCR0 0x00 @@ -1345,6 +1349,7 @@ static const TypeInfo strongarm_uart_info = { .instance_init = strongarm_uart_init, .class_init = strongarm_uart_class_init, }; +TYPE_INFO(strongarm_uart_info) /* Synchronous Serial Ports */ @@ -1591,6 +1596,7 @@ static const TypeInfo strongarm_ssp_info = { .instance_init = strongarm_ssp_init, .class_init = strongarm_ssp_class_init, }; +TYPE_INFO(strongarm_ssp_info) /* Main CPU functions */ StrongARMState *sa1110_init(const char *cpu_type) @@ -1643,14 +1649,4 @@ StrongARMState *sa1110_init(const char *cpu_type) return s; } -static void strongarm_register_types(void) -{ - type_register_static(&strongarm_pic_info); - type_register_static(&strongarm_rtc_sysbus_info); - type_register_static(&strongarm_gpio_info); - type_register_static(&strongarm_ppc_info); - type_register_static(&strongarm_uart_info); - type_register_static(&strongarm_ssp_info); -} -type_init(strongarm_register_types) diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c index e29566f7b3..86a1a21adf 100644 --- a/hw/arm/tosa.c +++ b/hw/arm/tosa.c @@ -299,6 +299,7 @@ static const TypeInfo tosa_dac_info = { .instance_size = sizeof(TosaDACState), .class_init = tosa_dac_class_init, }; +TYPE_INFO(tosa_dac_info) static void tosa_ssp_class_init(ObjectClass *klass, void *data) { @@ -314,6 +315,7 @@ static const TypeInfo tosa_ssp_info = { .instance_size = sizeof(SSISlave), .class_init = tosa_ssp_class_init, }; +TYPE_INFO(tosa_ssp_info) static const TypeInfo tosa_misc_gpio_info = { .name = "tosa-misc-gpio", @@ -325,12 +327,6 @@ static const TypeInfo tosa_misc_gpio_info = { * need to set up reset or vmstate, and has no realize method. */ }; +TYPE_INFO(tosa_misc_gpio_info) -static void tosa_register_types(void) -{ - type_register_static(&tosa_dac_info); - type_register_static(&tosa_ssp_info); - type_register_static(&tosa_misc_gpio_info); -} -type_init(tosa_register_types) diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 9dc93182b6..c89fe65d97 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -404,6 +404,7 @@ static const TypeInfo versatilepb_type = { .parent = TYPE_MACHINE, .class_init = versatilepb_class_init, }; +TYPE_INFO(versatilepb_type) static void versatileab_class_init(ObjectClass *oc, void *data) { @@ -422,14 +423,9 @@ static const TypeInfo versatileab_type = { .parent = TYPE_MACHINE, .class_init = versatileab_class_init, }; +TYPE_INFO(versatileab_type) -static void versatile_machine_init(void) -{ - type_register_static(&versatilepb_type); - type_register_static(&versatileab_type); -} -type_init(versatile_machine_init) static void vpb_sic_class_init(ObjectClass *klass, void *data) { @@ -445,10 +441,6 @@ static const TypeInfo vpb_sic_info = { .instance_init = vpb_sic_init, .class_init = vpb_sic_class_init, }; +TYPE_INFO(vpb_sic_info) -static void versatilepb_register_types(void) -{ - type_register_static(&vpb_sic_info); -} -type_init(versatilepb_register_types) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 1dc971c34f..4efbe82cb3 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -822,6 +822,7 @@ static const TypeInfo vexpress_info = { .class_size = sizeof(VexpressMachineClass), .class_init = vexpress_class_init, }; +TYPE_INFO(vexpress_info) static const TypeInfo vexpress_a9_info = { .name = TYPE_VEXPRESS_A9_MACHINE, @@ -829,6 +830,7 @@ static const TypeInfo vexpress_a9_info = { .class_init = vexpress_a9_class_init, .instance_init = vexpress_a9_instance_init, }; +TYPE_INFO(vexpress_a9_info) static const TypeInfo vexpress_a15_info = { .name = TYPE_VEXPRESS_A15_MACHINE, @@ -836,12 +838,6 @@ static const TypeInfo vexpress_a15_info = { .class_init = vexpress_a15_class_init, .instance_init = vexpress_a15_instance_init, }; +TYPE_INFO(vexpress_a15_info) -static void vexpress_machine_init(void) -{ - type_register_static(&vexpress_info); - type_register_static(&vexpress_a9_info); - type_register_static(&vexpress_a15_info); -} -type_init(vexpress_machine_init); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ecfee362a1..5528121d37 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2539,12 +2539,8 @@ static const TypeInfo virt_machine_info = { { } }, }; +TYPE_INFO(virt_machine_info) -static void machvirt_machine_init(void) -{ - type_register_static(&virt_machine_info); -} -type_init(machvirt_machine_init); static void virt_machine_5_1_options(MachineClass *mc) { diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 32aa7323d9..0ba9e8c708 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -355,10 +355,6 @@ static const TypeInfo zynq_machine_type = { .class_init = zynq_machine_class_init, .instance_size = sizeof(ZynqMachineState), }; +TYPE_INFO(zynq_machine_type) -static void zynq_machine_register_types(void) -{ - type_register_static(&zynq_machine_type); -} -type_init(zynq_machine_register_types) diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 4b3152ee77..f55295a816 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -574,11 +574,7 @@ static const TypeInfo versal_virt_machine_init_typeinfo = { .instance_init = versal_virt_machine_instance_init, .instance_size = sizeof(VersalVirt), }; +TYPE_INFO(versal_virt_machine_init_typeinfo) -static void versal_virt_machine_init_register_types(void) -{ - type_register_static(&versal_virt_machine_init_typeinfo); -} -type_init(versal_virt_machine_init_register_types) diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index e3aa4bd1e5..7f3bc84962 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -378,10 +378,6 @@ static const TypeInfo versal_info = { .instance_init = versal_init, .class_init = versal_class_init, }; +TYPE_INFO(versal_info) -static void versal_register_types(void) -{ - type_register_static(&versal_info); -} -type_init(versal_register_types); diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 5997262459..6d1f38a99c 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -244,10 +244,6 @@ static const TypeInfo xlnx_zcu102_machine_init_typeinfo = { .instance_init = xlnx_zcu102_machine_instance_init, .instance_size = sizeof(XlnxZCU102), }; +TYPE_INFO(xlnx_zcu102_machine_init_typeinfo) -static void xlnx_zcu102_machine_init_register_types(void) -{ - type_register_static(&xlnx_zcu102_machine_init_typeinfo); -} -type_init(xlnx_zcu102_machine_init_register_types) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index c435b9d52a..9448e71059 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -637,10 +637,6 @@ static const TypeInfo xlnx_zynqmp_type_info = { .instance_init = xlnx_zynqmp_init, .class_init = xlnx_zynqmp_class_init, }; +TYPE_INFO(xlnx_zynqmp_type_info) -static void xlnx_zynqmp_register_types(void) -{ - type_register_static(&xlnx_zynqmp_type_info); -} -type_init(xlnx_zynqmp_register_types) diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c index 11a6328fc2..2f8f75845e 100644 --- a/hw/audio/cs4231.c +++ b/hw/audio/cs4231.c @@ -178,10 +178,6 @@ static const TypeInfo cs4231_info = { .instance_init = cs4231_init, .class_init = cs4231_class_init, }; +TYPE_INFO(cs4231_info) -static void cs4231_register_types(void) -{ - type_register_static(&cs4231_info); -} -type_init(cs4231_register_types) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index cbd92b72f2..b6ea5b3b75 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -901,6 +901,7 @@ static const TypeInfo hda_audio_info = { .class_init = hda_audio_base_class_init, .abstract = true, }; +TYPE_INFO(hda_audio_info) static void hda_audio_output_class_init(ObjectClass *klass, void *data) { @@ -917,6 +918,7 @@ static const TypeInfo hda_audio_output_info = { .instance_size = sizeof(HDAAudioState), .class_init = hda_audio_output_class_init, }; +TYPE_INFO(hda_audio_output_info) static void hda_audio_duplex_class_init(ObjectClass *klass, void *data) { @@ -933,6 +935,7 @@ static const TypeInfo hda_audio_duplex_info = { .instance_size = sizeof(HDAAudioState), .class_init = hda_audio_duplex_class_init, }; +TYPE_INFO(hda_audio_duplex_info) static void hda_audio_micro_class_init(ObjectClass *klass, void *data) { @@ -949,13 +952,6 @@ static const TypeInfo hda_audio_micro_info = { .instance_size = sizeof(HDAAudioState), .class_init = hda_audio_micro_class_init, }; +TYPE_INFO(hda_audio_micro_info) -static void hda_audio_register_types(void) -{ - type_register_static(&hda_audio_info); - type_register_static(&hda_audio_output_info); - type_register_static(&hda_audio_duplex_info); - type_register_static(&hda_audio_micro_info); -} -type_init(hda_audio_register_types) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index f6cea49686..ceae0b33af 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -46,6 +46,7 @@ static const TypeInfo hda_codec_bus_info = { .parent = TYPE_BUS, .instance_size = sizeof(HDACodecBus), }; +TYPE_INFO(hda_codec_bus_info) void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus, size_t bus_size, hda_codec_response_func response, @@ -1266,18 +1267,21 @@ static const TypeInfo intel_hda_info = { { }, }, }; +TYPE_INFO(intel_hda_info) static const TypeInfo intel_hda_info_ich6 = { .name = "intel-hda", .parent = TYPE_INTEL_HDA_GENERIC, .class_init = intel_hda_class_init_ich6, }; +TYPE_INFO(intel_hda_info_ich6) static const TypeInfo intel_hda_info_ich9 = { .name = "ich9-intel-hda", .parent = TYPE_INTEL_HDA_GENERIC, .class_init = intel_hda_class_init_ich9, }; +TYPE_INFO(intel_hda_info_ich9) static void hda_codec_device_class_init(ObjectClass *klass, void *data) { @@ -1297,6 +1301,7 @@ static const TypeInfo hda_codec_device_type_info = { .class_size = sizeof(HDACodecDeviceClass), .class_init = hda_codec_device_class_init, }; +TYPE_INFO(hda_codec_device_type_info) /* * create intel hda controller with codec attached to it, @@ -1319,11 +1324,6 @@ static int intel_hda_and_codec_init(PCIBus *bus) static void intel_hda_register_types(void) { - type_register_static(&hda_codec_bus_info); - type_register_static(&intel_hda_info); - type_register_static(&intel_hda_info_ich6); - type_register_static(&intel_hda_info_ich9); - type_register_static(&hda_codec_device_type_info); pci_register_soundhw("hda", "Intel HD Audio", intel_hda_and_codec_init); } diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c index 8dfacec693..1dcee64ef0 100644 --- a/hw/audio/marvell_88w8618.c +++ b/hw/audio/marvell_88w8618.c @@ -304,10 +304,6 @@ static const TypeInfo mv88w8618_audio_info = { .instance_init = mv88w8618_audio_init, .class_init = mv88w8618_audio_class_init, }; +TYPE_INFO(mv88w8618_audio_info) -static void mv88w8618_register_types(void) -{ - type_register_static(&mv88w8618_audio_info); -} -type_init(mv88w8618_register_types) diff --git a/hw/audio/milkymist-ac97.c b/hw/audio/milkymist-ac97.c index 0fa38adbe2..051dc3bfad 100644 --- a/hw/audio/milkymist-ac97.c +++ b/hw/audio/milkymist-ac97.c @@ -352,10 +352,6 @@ static const TypeInfo milkymist_ac97_info = { .instance_init = milkymist_ac97_init, .class_init = milkymist_ac97_class_init, }; +TYPE_INFO(milkymist_ac97_info) -static void milkymist_ac97_register_types(void) -{ - type_register_static(&milkymist_ac97_info); -} -type_init(milkymist_ac97_register_types) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index ea539e7605..ed7730fc18 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -244,6 +244,7 @@ static const TypeInfo pcspk_info = { .instance_init = pcspk_initfn, .class_init = pcspk_class_initfn, }; +TYPE_INFO(pcspk_info) static int pcspk_audio_init_soundhw(ISABus *bus) { @@ -256,7 +257,6 @@ static int pcspk_audio_init_soundhw(ISABus *bus) static void pcspk_register(void) { - type_register_static(&pcspk_info); isa_register_soundhw("pcspk", "PC speaker", pcspk_audio_init_soundhw); } type_init(pcspk_register) diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c index c3d3eab6ed..96748cb15a 100644 --- a/hw/audio/pl041.c +++ b/hw/audio/pl041.c @@ -650,10 +650,6 @@ static const TypeInfo pl041_device_info = { .instance_init = pl041_init, .class_init = pl041_device_class_init, }; +TYPE_INFO(pl041_device_info) -static void pl041_register_types(void) -{ - type_register_static(&pl041_device_info); -} -type_init(pl041_register_types) diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index 92b2902a10..d867442d29 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -726,10 +726,6 @@ static const TypeInfo wm8750_info = { .instance_size = sizeof(WM8750State), .class_init = wm8750_class_init, }; +TYPE_INFO(wm8750_info) -static void wm8750_register_types(void) -{ - type_register_static(&wm8750_info); -} -type_init(wm8750_register_types) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index e9ed3eef45..5e7013a752 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -80,6 +80,7 @@ static const TypeInfo floppy_bus_info = { .parent = TYPE_BUS, .instance_size = sizeof(FloppyBus), }; +TYPE_INFO(floppy_bus_info) static void floppy_bus_create(FDCtrl *fdc, FloppyBus *bus, DeviceState *dev) { @@ -620,6 +621,7 @@ static const TypeInfo floppy_drive_info = { .instance_size = sizeof(FloppyDrive), .class_init = floppy_drive_class_init, }; +TYPE_INFO(floppy_drive_info) /********************************************************/ /* Intel 82078 floppy disk controller emulation */ @@ -2940,6 +2942,7 @@ static const TypeInfo isa_fdc_info = { .class_init = isabus_fdc_class_init, .instance_init = isabus_fdc_instance_init, }; +TYPE_INFO(isa_fdc_info) static const VMStateDescription vmstate_sysbus_fdc ={ .name = "fdc", @@ -2980,6 +2983,7 @@ static const TypeInfo sysbus_fdc_info = { .instance_init = sysbus_fdc_initfn, .class_init = sysbus_fdc_class_init, }; +TYPE_INFO(sysbus_fdc_info) static Property sun4m_fdc_properties[] = { DEFINE_PROP_DRIVE("drive", FDCtrlSysBus, state.qdev_for_drives[0].blk), @@ -3006,6 +3010,7 @@ static const TypeInfo sun4m_fdc_info = { .instance_init = sun4m_fdc_initfn, .class_init = sun4m_fdc_class_init, }; +TYPE_INFO(sun4m_fdc_info) static void sysbus_fdc_common_class_init(ObjectClass *klass, void *data) { @@ -3024,15 +3029,6 @@ static const TypeInfo sysbus_fdc_type_info = { .abstract = true, .class_init = sysbus_fdc_common_class_init, }; +TYPE_INFO(sysbus_fdc_type_info) -static void fdc_register_types(void) -{ - type_register_static(&isa_fdc_info); - type_register_static(&sysbus_fdc_type_info); - type_register_static(&sysbus_fdc_info); - type_register_static(&sun4m_fdc_info); - type_register_static(&floppy_bus_info); - type_register_static(&floppy_drive_info); -} -type_init(fdc_register_types) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 8227088441..7f9492eee6 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -1407,12 +1407,12 @@ static const TypeInfo m25p80_info = { .class_size = sizeof(M25P80Class), .abstract = true, }; +TYPE_INFO(m25p80_info) static void m25p80_register_types(void) { int i; - type_register_static(&m25p80_info); for (i = 0; i < ARRAY_SIZE(known_devices); ++i) { TypeInfo ti = { .name = known_devices[i].part_name, diff --git a/hw/block/nand.c b/hw/block/nand.c index 654e0cb5d1..991a6e13e8 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -457,11 +457,8 @@ static const TypeInfo nand_info = { .instance_size = sizeof(NANDFlashState), .class_init = nand_class_init, }; +TYPE_INFO(nand_info) -static void nand_register_types(void) -{ - type_register_static(&nand_info); -} /* * Chip inputs are CLE, ALE, CE, WP, GND and eight I/O pins. Chip @@ -655,7 +652,6 @@ DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id) return dev; } -type_init(nand_register_types) #else diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 3426e17e65..a8fe997626 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1697,10 +1697,6 @@ static const TypeInfo nvme_info = { { } }, }; +TYPE_INFO(nvme_info) -static void nvme_register_types(void) -{ - type_register_static(&nvme_info); -} -type_init(nvme_register_types) diff --git a/hw/block/onenand.c b/hw/block/onenand.c index 898ac563a3..d2c4e140e9 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -854,11 +854,8 @@ static const TypeInfo onenand_info = { .instance_size = sizeof(OneNANDState), .class_init = onenand_class_init, }; +TYPE_INFO(onenand_info) -static void onenand_register_types(void) -{ - type_register_static(&onenand_info); -} void *onenand_raw_otp(DeviceState *onenand_device) { @@ -867,4 +864,3 @@ void *onenand_raw_otp(DeviceState *onenand_device) return s->otp; } -type_init(onenand_register_types) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 8ab1d66310..252a6e340b 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -940,13 +940,9 @@ static const TypeInfo pflash_cfi01_info = { .instance_size = sizeof(PFlashCFI01), .class_init = pflash_cfi01_class_init, }; +TYPE_INFO(pflash_cfi01_info) -static void pflash_cfi01_register_types(void) -{ - type_register_static(&pflash_cfi01_info); -} -type_init(pflash_cfi01_register_types) PFlashCFI01 *pflash_cfi01_register(hwaddr base, const char *name, diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index eb02fccfa5..4806761e9c 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -977,13 +977,9 @@ static const TypeInfo pflash_cfi02_info = { .instance_size = sizeof(PFlashCFI02), .class_init = pflash_cfi02_class_init, }; +TYPE_INFO(pflash_cfi02_info) -static void pflash_cfi02_register_types(void) -{ - type_register_static(&pflash_cfi02_info); -} -type_init(pflash_cfi02_register_types) PFlashCFI02 *pflash_cfi02_register(hwaddr base, const char *name, diff --git a/hw/block/swim.c b/hw/block/swim.c index 74f56e8f46..1c7edecd93 100644 --- a/hw/block/swim.c +++ b/hw/block/swim.c @@ -252,12 +252,14 @@ static const TypeInfo swim_drive_info = { .instance_size = sizeof(SWIMDrive), .class_init = swim_drive_class_init, }; +TYPE_INFO(swim_drive_info) static const TypeInfo swim_bus_info = { .name = TYPE_SWIM_BUS, .parent = TYPE_BUS, .instance_size = sizeof(SWIMBus), }; +TYPE_INFO(swim_bus_info) static void iwmctrl_write(void *opaque, hwaddr reg, uint64_t value, unsigned size) @@ -481,12 +483,6 @@ static const TypeInfo sysbus_swim_info = { .instance_init = sysbus_swim_init, .class_init = sysbus_swim_class_init, }; +TYPE_INFO(sysbus_swim_info) -static void swim_register_types(void) -{ - type_register_static(&sysbus_swim_info); - type_register_static(&swim_bus_info); - type_register_static(&swim_drive_info); -} -type_init(swim_register_types) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index a00b854736..f8490ece8f 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -561,10 +561,6 @@ static const TypeInfo vhost_user_blk_info = { .instance_init = vhost_user_blk_instance_init, .class_init = vhost_user_blk_class_init, }; +TYPE_INFO(vhost_user_blk_info) -static void virtio_register_types(void) -{ - type_register_static(&vhost_user_blk_info); -} -type_init(virtio_register_types) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 413783693c..aedc9dbeec 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1327,10 +1327,6 @@ static const TypeInfo virtio_blk_info = { .instance_init = virtio_blk_instance_init, .class_init = virtio_blk_class_init, }; +TYPE_INFO(virtio_blk_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_blk_info); -} -type_init(virtio_register_types) diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 8a7a3f5452..055b55dcf6 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -555,6 +555,7 @@ static const TypeInfo xen_block_type_info = { .class_size = sizeof(XenBlockDeviceClass), .class_init = xen_block_class_init, }; +TYPE_INFO(xen_block_type_info) static void xen_disk_unrealize(XenBlockDevice *blockdev) { @@ -594,6 +595,7 @@ static const TypeInfo xen_disk_type_info = { .instance_size = sizeof(XenDiskDevice), .class_init = xen_disk_class_init, }; +TYPE_INFO(xen_disk_type_info) static void xen_cdrom_unrealize(XenBlockDevice *blockdev) { @@ -641,15 +643,9 @@ static const TypeInfo xen_cdrom_type_info = { .instance_size = sizeof(XenCDRomDevice), .class_init = xen_cdrom_class_init, }; +TYPE_INFO(xen_cdrom_type_info) -static void xen_block_register_types(void) -{ - type_register_static(&xen_block_type_info); - type_register_static(&xen_disk_type_info); - type_register_static(&xen_cdrom_type_info); -} -type_init(xen_block_register_types) static void xen_block_blockdev_del(const char *node_name, Error **errp) { diff --git a/hw/char/avr_usart.c b/hw/char/avr_usart.c index fbe2a112b7..da605c9f96 100644 --- a/hw/char/avr_usart.c +++ b/hw/char/avr_usart.c @@ -311,10 +311,6 @@ static const TypeInfo avr_usart_info = { .instance_init = avr_usart_init, .class_init = avr_usart_class_init, }; +TYPE_INFO(avr_usart_info) -static void avr_usart_register_types(void) -{ - type_register_static(&avr_usart_info); -} -type_init(avr_usart_register_types) diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c index ee3dd40e3c..7f19205355 100644 --- a/hw/char/bcm2835_aux.c +++ b/hw/char/bcm2835_aux.c @@ -309,10 +309,6 @@ static const TypeInfo bcm2835_aux_info = { .instance_init = bcm2835_aux_init, .class_init = bcm2835_aux_class_init, }; +TYPE_INFO(bcm2835_aux_info) -static void bcm2835_aux_register_types(void) -{ - type_register_static(&bcm2835_aux_info); -} -type_init(bcm2835_aux_register_types) diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index e196906c92..cdc8b9c71d 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -613,10 +613,6 @@ static const TypeInfo cadence_uart_info = { .instance_init = cadence_uart_init, .class_init = cadence_uart_class_init, }; +TYPE_INFO(cadence_uart_info) -static void cadence_uart_register_types(void) -{ - type_register_static(&cadence_uart_info); -} -type_init(cadence_uart_register_types) diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c index 626b68f2ec..2b5e10a5e9 100644 --- a/hw/char/cmsdk-apb-uart.c +++ b/hw/char/cmsdk-apb-uart.c @@ -399,10 +399,6 @@ static const TypeInfo cmsdk_apb_uart_info = { .instance_init = cmsdk_apb_uart_init, .class_init = cmsdk_apb_uart_class_init, }; +TYPE_INFO(cmsdk_apb_uart_info) -static void cmsdk_apb_uart_register_types(void) -{ - type_register_static(&cmsdk_apb_uart_info); -} -type_init(cmsdk_apb_uart_register_types); diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index c8d938efb5..7c29b9cbcf 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -135,10 +135,6 @@ static const TypeInfo debugcon_isa_info = { .instance_size = sizeof(ISADebugconState), .class_init = debugcon_isa_class_initfn, }; +TYPE_INFO(debugcon_isa_info) -static void debugcon_register_types(void) -{ - type_register_static(&debugcon_isa_info); -} -type_init(debugcon_register_types) diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c index e130cb4692..c86059ed0b 100644 --- a/hw/char/digic-uart.c +++ b/hw/char/digic-uart.c @@ -193,10 +193,6 @@ static const TypeInfo digic_uart_info = { .instance_init = digic_uart_init, .class_init = digic_uart_class_init, }; +TYPE_INFO(digic_uart_info) -static void digic_uart_register_types(void) -{ - type_register_static(&digic_uart_info); -} -type_init(digic_uart_register_types) diff --git a/hw/char/escc.c b/hw/char/escc.c index 7d16ee8688..da8e089407 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -876,10 +876,6 @@ static const TypeInfo escc_info = { .instance_init = escc_init1, .class_init = escc_class_init, }; +TYPE_INFO(escc_info) -static void escc_register_types(void) -{ - type_register_static(&escc_info); -} -type_init(escc_register_types) diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c index 947bdb649a..5b70c85b9b 100644 --- a/hw/char/etraxfs_ser.c +++ b/hw/char/etraxfs_ser.c @@ -255,10 +255,6 @@ static const TypeInfo etraxfs_ser_info = { .instance_init = etraxfs_ser_init, .class_init = etraxfs_ser_class_init, }; +TYPE_INFO(etraxfs_ser_info) -static void etraxfs_serial_register_types(void) -{ - type_register_static(&etraxfs_ser_info); -} -type_init(etraxfs_serial_register_types) diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index 9c8ab3a77d..a59826a3df 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -723,10 +723,6 @@ static const TypeInfo exynos4210_uart_info = { .instance_init = exynos4210_uart_init, .class_init = exynos4210_uart_class_init, }; +TYPE_INFO(exynos4210_uart_info) -static void exynos4210_uart_register(void) -{ - type_register_static(&exynos4210_uart_info); -} -type_init(exynos4210_uart_register) diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index 16d0feac59..581111ce75 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -294,10 +294,6 @@ static const TypeInfo grlib_apbuart_info = { .instance_size = sizeof(UART), .class_init = grlib_apbuart_class_init, }; +TYPE_INFO(grlib_apbuart_info) -static void grlib_apbuart_register_types(void) -{ - type_register_static(&grlib_apbuart_info); -} -type_init(grlib_apbuart_register_types) diff --git a/hw/char/ibex_uart.c b/hw/char/ibex_uart.c index cc49a35013..f88f69f98c 100644 --- a/hw/char/ibex_uart.c +++ b/hw/char/ibex_uart.c @@ -507,10 +507,6 @@ static const TypeInfo ibex_uart_info = { .instance_init = ibex_uart_init, .class_init = ibex_uart_class_init, }; +TYPE_INFO(ibex_uart_info) -static void ibex_uart_register_types(void) -{ - type_register_static(&ibex_uart_info); -} -type_init(ibex_uart_register_types) diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 731b8fc64c..17abb067ea 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -382,10 +382,6 @@ static const TypeInfo imx_serial_info = { .instance_init = imx_serial_init, .class_init = imx_serial_class_init, }; +TYPE_INFO(imx_serial_info) -static void imx_serial_register_types(void) -{ - type_register_static(&imx_serial_info); -} -type_init(imx_serial_register_types) diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index d7c497b939..b94ebf2791 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -598,10 +598,6 @@ static const TypeInfo ipoctal_info = { .instance_size = sizeof(IPOctalState), .class_init = ipoctal_class_init, }; +TYPE_INFO(ipoctal_info) -static void ipoctal_register_types(void) -{ - type_register_static(&ipoctal_info); -} -type_init(ipoctal_register_types) diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c index 3f34861233..bd4a778d38 100644 --- a/hw/char/lm32_juart.c +++ b/hw/char/lm32_juart.c @@ -156,10 +156,6 @@ static const TypeInfo lm32_juart_info = { .instance_size = sizeof(LM32JuartState), .class_init = lm32_juart_class_init, }; +TYPE_INFO(lm32_juart_info) -static void lm32_juart_register_types(void) -{ - type_register_static(&lm32_juart_info); -} -type_init(lm32_juart_register_types) diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c index b0b1092889..266808790f 100644 --- a/hw/char/lm32_uart.c +++ b/hw/char/lm32_uart.c @@ -304,10 +304,6 @@ static const TypeInfo lm32_uart_info = { .instance_init = lm32_uart_init, .class_init = lm32_uart_class_init, }; +TYPE_INFO(lm32_uart_info) -static void lm32_uart_register_types(void) -{ - type_register_static(&lm32_uart_info); -} -type_init(lm32_uart_register_types) diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index 8d1b7f2bca..ec41736980 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -332,13 +332,9 @@ static const TypeInfo mcf_uart_info = { .instance_init = mcf_uart_instance_init, .class_init = mcf_uart_class_init, }; +TYPE_INFO(mcf_uart_info) -static void mcf_uart_register(void) -{ - type_register_static(&mcf_uart_info); -} -type_init(mcf_uart_register) void *mcf_uart_init(qemu_irq irq, Chardev *chrdrv) { diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c index 1439efb42a..d3cb7c9140 100644 --- a/hw/char/milkymist-uart.c +++ b/hw/char/milkymist-uart.c @@ -249,10 +249,6 @@ static const TypeInfo milkymist_uart_info = { .instance_init = milkymist_uart_init, .class_init = milkymist_uart_class_init, }; +TYPE_INFO(milkymist_uart_info) -static void milkymist_uart_register_types(void) -{ - type_register_static(&milkymist_uart_info); -} -type_init(milkymist_uart_register_types) diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c index d1fef77acd..0715f8b019 100644 --- a/hw/char/nrf51_uart.c +++ b/hw/char/nrf51_uart.c @@ -325,10 +325,6 @@ static const TypeInfo nrf51_uart_info = { .instance_init = nrf51_uart_init, .class_init = nrf51_uart_class_init }; +TYPE_INFO(nrf51_uart_info) -static void nrf51_uart_register_types(void) -{ - type_register_static(&nrf51_uart_info); -} -type_init(nrf51_uart_register_types) diff --git a/hw/char/parallel.c b/hw/char/parallel.c index c0f34bf924..8f09384066 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -659,10 +659,6 @@ static const TypeInfo parallel_isa_info = { .instance_size = sizeof(ISAParallelState), .class_init = parallel_isa_class_initfn, }; +TYPE_INFO(parallel_isa_info) -static void parallel_register_types(void) -{ - type_register_static(¶llel_isa_info); -} -type_init(parallel_register_types) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 13e784f9d9..422c9e660a 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -366,6 +366,7 @@ static const TypeInfo pl011_arm_info = { .instance_init = pl011_init, .class_init = pl011_class_init, }; +TYPE_INFO(pl011_arm_info) static void pl011_luminary_init(Object *obj) { @@ -379,11 +380,6 @@ static const TypeInfo pl011_luminary_info = { .parent = TYPE_PL011, .instance_init = pl011_luminary_init, }; +TYPE_INFO(pl011_luminary_info) -static void pl011_register_types(void) -{ - type_register_static(&pl011_arm_info); - type_register_static(&pl011_luminary_info); -} -type_init(pl011_register_types) diff --git a/hw/char/renesas_sci.c b/hw/char/renesas_sci.c index 5d7c6e6523..041557a4f1 100644 --- a/hw/char/renesas_sci.c +++ b/hw/char/renesas_sci.c @@ -341,10 +341,6 @@ static const TypeInfo rsci_info = { .instance_init = rsci_init, .class_init = rsci_class_init, }; +TYPE_INFO(rsci_info) -static void rsci_register_types(void) -{ - type_register_static(&rsci_info); -} -type_init(rsci_register_types) diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 2b5f37b6a2..0a277b8c37 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -361,10 +361,6 @@ static const TypeInfo sclp_console_info = { .class_init = console_class_init, .class_size = sizeof(SCLPEventClass), }; +TYPE_INFO(sclp_console_info) -static void register_types(void) -{ - type_register_static(&sclp_console_info); -} -type_init(register_types) diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 5c7664905e..2e960973e2 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -277,10 +277,6 @@ static const TypeInfo sclp_console_info = { .class_init = console_class_init, .class_size = sizeof(SCLPEventClass), }; +TYPE_INFO(sclp_console_info) -static void register_types(void) -{ - type_register_static(&sclp_console_info); -} -type_init(register_types) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index b4c65949cd..35a1ee3a30 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -146,13 +146,9 @@ static const TypeInfo serial_isa_info = { .instance_init = serial_isa_initfn, .class_init = serial_isa_class_initfn, }; +TYPE_INFO(serial_isa_info) -static void serial_register_types(void) -{ - type_register_static(&serial_isa_info); -} -type_init(serial_register_types) static void serial_isa_init(ISABus *bus, int index, Chardev *chr) { diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 2cf3e44177..591c625b1d 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -199,6 +199,7 @@ static const TypeInfo multi_2x_serial_pci_info = { { }, }, }; +TYPE_INFO(multi_2x_serial_pci_info) static const TypeInfo multi_4x_serial_pci_info = { .name = "pci-serial-4x", @@ -211,11 +212,6 @@ static const TypeInfo multi_4x_serial_pci_info = { { }, }, }; +TYPE_INFO(multi_4x_serial_pci_info) -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) diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index cd56924a43..02264f8b73 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -119,10 +119,6 @@ static const TypeInfo serial_pci_info = { { }, }, }; +TYPE_INFO(serial_pci_info) -static void serial_pci_register_types(void) -{ - type_register_static(&serial_pci_info); -} -type_init(serial_pci_register_types) diff --git a/hw/char/serial.c b/hw/char/serial.c index 2386479492..a40d967d70 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1024,6 +1024,7 @@ static const TypeInfo serial_io_info = { .instance_init = serial_io_instance_init, .class_init = serial_io_class_init, }; +TYPE_INFO(serial_io_info) static Property serial_properties[] = { DEFINE_PROP_CHR("chardev", SerialState, chr), @@ -1048,6 +1049,7 @@ static const TypeInfo serial_info = { .instance_size = sizeof(SerialState), .class_init = serial_class_init, }; +TYPE_INFO(serial_info) /* Memory mapped interface */ static uint64_t serial_mm_read(void *opaque, hwaddr addr, @@ -1174,12 +1176,6 @@ static const TypeInfo serial_mm_info = { .instance_size = sizeof(SerialMM), .class_init = serial_mm_class_init, }; +TYPE_INFO(serial_mm_info) -static void serial_register_types(void) -{ - type_register_static(&serial_info); - type_register_static(&serial_io_info); - type_register_static(&serial_mm_info); -} -type_init(serial_register_types) diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index 464a52342a..236dc2194a 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -203,6 +203,7 @@ static const TypeInfo spapr_vty_info = { .instance_size = sizeof(SpaprVioVty), .class_init = spapr_vty_class_init, }; +TYPE_INFO(spapr_vty_info) SpaprVioDevice *spapr_vty_get_default(SpaprVioBus *bus) { @@ -266,7 +267,6 @@ static void spapr_vty_register_types(void) { spapr_register_hypercall(H_PUT_TERM_CHAR, h_put_term_char); spapr_register_hypercall(H_GET_TERM_CHAR, h_get_term_char); - type_register_static(&spapr_vty_info); } type_init(spapr_vty_register_types) diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index 0d661be6d3..f66bdbf796 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -233,10 +233,6 @@ static const TypeInfo stm32f2xx_usart_info = { .instance_init = stm32f2xx_usart_init, .class_init = stm32f2xx_usart_class_init, }; +TYPE_INFO(stm32f2xx_usart_info) -static void stm32f2xx_usart_register_types(void) -{ - type_register_static(&stm32f2xx_usart_info); -} -type_init(stm32f2xx_usart_register_types) diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c index 2c47ebf007..6ba6052ac9 100644 --- a/hw/char/terminal3270.c +++ b/hw/char/terminal3270.c @@ -302,10 +302,6 @@ static const TypeInfo ccw_terminal_info = { .class_init = terminal_class_init, .class_size = sizeof(EmulatedCcw3270Class), }; +TYPE_INFO(ccw_terminal_info) -static void register_types(void) -{ - type_register_static(&ccw_terminal_info); -} -type_init(register_types) diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 4f46753ea3..0ac862df15 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -270,6 +270,7 @@ static const TypeInfo virtconsole_info = { .parent = TYPE_VIRTIO_CONSOLE_SERIAL_PORT, .class_init = virtconsole_class_init, }; +TYPE_INFO(virtconsole_info) static Property virtserialport_properties[] = { DEFINE_PROP_CHR("chardev", VirtConsole, chr), @@ -296,11 +297,6 @@ static const TypeInfo virtserialport_info = { .instance_size = sizeof(VirtConsole), .class_init = virtserialport_class_init, }; +TYPE_INFO(virtserialport_info) -static void virtconsole_register_types(void) -{ - type_register_static(&virtserialport_info); - type_register_static(&virtconsole_info); -} -type_init(virtconsole_register_types) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index f9a4428bd6..fdde8a8d69 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -859,6 +859,7 @@ static const TypeInfo virtser_bus_info = { .instance_size = sizeof(VirtIOSerialBus), .class_init = virtser_bus_class_init, }; +TYPE_INFO(virtser_bus_info) static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) { @@ -1121,6 +1122,7 @@ static const TypeInfo virtio_serial_port_type_info = { .class_size = sizeof(VirtIOSerialPortClass), .class_init = virtio_serial_port_class_init, }; +TYPE_INFO(virtio_serial_port_type_info) static void virtio_serial_device_unrealize(DeviceState *dev) { @@ -1205,12 +1207,6 @@ static const TypeInfo virtio_device_info = { { } } }; +TYPE_INFO(virtio_device_info) -static void virtio_serial_register_types(void) -{ - type_register_static(&virtser_bus_info); - type_register_static(&virtio_serial_port_type_info); - type_register_static(&virtio_device_info); -} -type_init(virtio_serial_register_types) diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index ae4ccd00c7..aad3fbc31e 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -247,10 +247,6 @@ static const TypeInfo xilinx_uartlite_info = { .instance_init = xilinx_uartlite_init, .class_init = xilinx_uartlite_class_init, }; +TYPE_INFO(xilinx_uartlite_info) -static void xilinx_uart_register_types(void) -{ - type_register_static(&xilinx_uartlite_info); -} -type_init(xilinx_uart_register_types) diff --git a/hw/core/bus.c b/hw/core/bus.c index 6b987b6946..76762e3ab3 100644 --- a/hw/core/bus.c +++ b/hw/core/bus.c @@ -325,10 +325,6 @@ static const TypeInfo bus_info = { { } }, }; +TYPE_INFO(bus_info) -static void bus_register_types(void) -{ - type_register_static(&bus_info); -} -type_init(bus_register_types) diff --git a/hw/core/clock.c b/hw/core/clock.c index 3c0daf7d4c..9ee9aeb932 100644 --- a/hw/core/clock.c +++ b/hw/core/clock.c @@ -121,10 +121,6 @@ static const TypeInfo clock_info = { .instance_init = clock_initfn, .instance_finalize = clock_finalizefn, }; +TYPE_INFO(clock_info) -static void clock_register_types(void) -{ - type_register_static(&clock_info); -} -type_init(clock_register_types) diff --git a/hw/core/cpu.c b/hw/core/cpu.c index 594441a150..df4d43bac4 100644 --- a/hw/core/cpu.c +++ b/hw/core/cpu.c @@ -449,10 +449,6 @@ static const TypeInfo cpu_type_info = { .class_size = sizeof(CPUClass), .class_init = cpu_class_init, }; +TYPE_INFO(cpu_type_info) -static void cpu_register_types(void) -{ - type_register_static(&cpu_type_info); -} -type_init(cpu_register_types) diff --git a/hw/core/fw-path-provider.c b/hw/core/fw-path-provider.c index 4840faefd1..7f9f7eff15 100644 --- a/hw/core/fw-path-provider.c +++ b/hw/core/fw-path-provider.c @@ -45,10 +45,6 @@ static const TypeInfo fw_path_provider_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(FWPathProviderClass), }; +TYPE_INFO(fw_path_provider_info) -static void fw_path_provider_register_types(void) -{ - type_register_static(&fw_path_provider_info); -} -type_init(fw_path_provider_register_types) diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index a242c076f6..e463b0dc18 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -212,10 +212,6 @@ static TypeInfo generic_loader_info = { .instance_size = sizeof(GenericLoaderState), .class_init = generic_loader_class_init, }; +TYPE_INFO(generic_loader_info) -static void generic_loader_register_type(void) -{ - type_register_static(&generic_loader_info); -} -type_init(generic_loader_register_type) diff --git a/hw/core/hotplug.c b/hw/core/hotplug.c index 17ac986685..6460ac5e8f 100644 --- a/hw/core/hotplug.c +++ b/hw/core/hotplug.c @@ -62,10 +62,6 @@ static const TypeInfo hotplug_handler_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(HotplugHandlerClass), }; +TYPE_INFO(hotplug_handler_info) -static void hotplug_handler_register_types(void) -{ - type_register_static(&hotplug_handler_info); -} -type_init(hotplug_handler_register_types) diff --git a/hw/core/irq.c b/hw/core/irq.c index fb3045b912..8aebc22cb2 100644 --- a/hw/core/irq.c +++ b/hw/core/irq.c @@ -136,10 +136,6 @@ static const TypeInfo irq_type_info = { .parent = TYPE_OBJECT, .instance_size = sizeof(struct IRQState), }; +TYPE_INFO(irq_type_info) -static void irq_register_types(void) -{ - type_register_static(&irq_type_info); -} -type_init(irq_register_types) diff --git a/hw/core/machine.c b/hw/core/machine.c index 8d1a90c6cf..f8fb5cf259 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1146,10 +1146,6 @@ static const TypeInfo machine_info = { .instance_init = machine_initfn, .instance_finalize = machine_finalize, }; +TYPE_INFO(machine_info) -static void machine_register_types(void) -{ - type_register_static(&machine_info); -} -type_init(machine_register_types) diff --git a/hw/core/nmi.c b/hw/core/nmi.c index 481c4b3c7e..e14906f74d 100644 --- a/hw/core/nmi.c +++ b/hw/core/nmi.c @@ -79,10 +79,6 @@ static const TypeInfo nmi_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(NMIClass), }; +TYPE_INFO(nmi_info) -static void nmi_register_types(void) -{ - type_register_static(&nmi_info); -} -type_init(nmi_register_types) diff --git a/hw/core/or-irq.c b/hw/core/or-irq.c index d8f3754e96..4ff195b3e2 100644 --- a/hw/core/or-irq.c +++ b/hw/core/or-irq.c @@ -140,10 +140,6 @@ static const TypeInfo or_irq_type_info = { .instance_init = or_irq_init, .class_init = or_irq_class_init, }; +TYPE_INFO(or_irq_type_info) -static void or_irq_register_types(void) -{ - type_register_static(&or_irq_type_info); -} -type_init(or_irq_register_types) diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c index 5037ca265e..5398bf92f5 100644 --- a/hw/core/platform-bus.c +++ b/hw/core/platform-bus.c @@ -221,10 +221,6 @@ static const TypeInfo platform_bus_info = { .instance_size = sizeof(PlatformBusDevice), .class_init = platform_bus_class_init, }; +TYPE_INFO(platform_bus_info) -static void platform_bus_register_types(void) -{ - type_register_static(&platform_bus_info); -} -type_init(platform_bus_register_types) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 96772a15bd..1b82b3fbf9 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -1251,10 +1251,6 @@ static const TypeInfo device_type_info = { { } } }; +TYPE_INFO(device_type_info) -static void qdev_register_types(void) -{ - type_register_static(&device_type_info); -} -type_init(qdev_register_types) diff --git a/hw/core/register.c b/hw/core/register.c index ddf91eb445..2b25f993ce 100644 --- a/hw/core/register.c +++ b/hw/core/register.c @@ -330,10 +330,6 @@ static const TypeInfo register_info = { .parent = TYPE_DEVICE, .class_init = register_class_init, }; +TYPE_INFO(register_info) -static void register_register_types(void) -{ - type_register_static(®ister_info); -} -type_init(register_register_types) diff --git a/hw/core/resettable.c b/hw/core/resettable.c index 96a99ce39e..88ba81de71 100644 --- a/hw/core/resettable.c +++ b/hw/core/resettable.c @@ -292,10 +292,6 @@ static const TypeInfo resettable_interface_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(ResettableClass), }; +TYPE_INFO(resettable_interface_info) -static void reset_register_types(void) -{ - type_register_static(&resettable_interface_info); -} -type_init(reset_register_types) diff --git a/hw/core/split-irq.c b/hw/core/split-irq.c index 3b90af2e8f..35653c5d4d 100644 --- a/hw/core/split-irq.c +++ b/hw/core/split-irq.c @@ -83,10 +83,6 @@ static const TypeInfo split_irq_type_info = { .instance_init = split_irq_init, .class_init = split_irq_class_init, }; +TYPE_INFO(split_irq_type_info) -static void split_irq_register_types(void) -{ - type_register_static(&split_irq_type_info); -} -type_init(split_irq_register_types) diff --git a/hw/core/stream.c b/hw/core/stream.c index a65ad1208d..c1bb12537e 100644 --- a/hw/core/stream.c +++ b/hw/core/stream.c @@ -24,11 +24,7 @@ static const TypeInfo stream_slave_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(StreamSlaveClass), }; +TYPE_INFO(stream_slave_info) -static void stream_slave_register_types(void) -{ - type_register_static(&stream_slave_info); -} -type_init(stream_slave_register_types) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 70239b7e7d..9e89bfd8d4 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -86,6 +86,7 @@ static const TypeInfo system_bus_info = { .instance_size = sizeof(BusState), .class_init = system_bus_class_init, }; +TYPE_INFO(system_bus_info) /* Check whether an IRQ source exists */ bool sysbus_has_irq(SysBusDevice *dev, int n) @@ -334,6 +335,7 @@ static const TypeInfo sysbus_device_type_info = { .class_size = sizeof(SysBusDeviceClass), .class_init = sysbus_device_class_init, }; +TYPE_INFO(sysbus_device_type_info) static BusState *main_system_bus; @@ -355,10 +357,4 @@ BusState *sysbus_get_default(void) return main_system_bus; } -static void sysbus_register_types(void) -{ - type_register_static(&system_bus_info); - type_register_static(&sysbus_device_type_info); -} -type_init(sysbus_register_types) diff --git a/hw/core/vmstate-if.c b/hw/core/vmstate-if.c index bf453620fe..3ad0c95df0 100644 --- a/hw/core/vmstate-if.c +++ b/hw/core/vmstate-if.c @@ -14,10 +14,6 @@ static const TypeInfo vmstate_if_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(VMStateIfClass), }; +TYPE_INFO(vmstate_if_info) -static void vmstate_register_types(void) -{ - type_register_static(&vmstate_if_info); -} -type_init(vmstate_register_types); diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c index c377be398d..78eb2a9517 100644 --- a/hw/cpu/a15mpcore.c +++ b/hw/cpu/a15mpcore.c @@ -171,10 +171,6 @@ static const TypeInfo a15mp_priv_info = { .instance_init = a15mp_priv_initfn, .class_init = a15mp_priv_class_init, }; +TYPE_INFO(a15mp_priv_info) -static void a15mp_register_types(void) -{ - type_register_static(&a15mp_priv_info); -} -type_init(a15mp_register_types) diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c index 351295e518..a21de66857 100644 --- a/hw/cpu/a9mpcore.c +++ b/hw/cpu/a9mpcore.c @@ -175,10 +175,6 @@ static const TypeInfo a9mp_priv_info = { .instance_init = a9mp_priv_initfn, .class_init = a9mp_priv_class_init, }; +TYPE_INFO(a9mp_priv_info) -static void a9mp_register_types(void) -{ - type_register_static(&a9mp_priv_info); -} -type_init(a9mp_register_types) diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c index 89c4e35143..55b0f0aaad 100644 --- a/hw/cpu/arm11mpcore.c +++ b/hw/cpu/arm11mpcore.c @@ -160,10 +160,6 @@ static const TypeInfo mpcore_priv_info = { .instance_init = mpcore_priv_initfn, .class_init = mpcore_priv_class_init, }; +TYPE_INFO(mpcore_priv_info) -static void arm11mpcore_register_types(void) -{ - type_register_static(&mpcore_priv_info); -} -type_init(arm11mpcore_register_types) diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c index e444b7c29d..016b320889 100644 --- a/hw/cpu/cluster.c +++ b/hw/cpu/cluster.c @@ -91,10 +91,6 @@ static const TypeInfo cpu_cluster_type_info = { .instance_size = sizeof(CPUClusterState), .class_init = cpu_cluster_class_init, }; +TYPE_INFO(cpu_cluster_type_info) -static void cpu_cluster_register_types(void) -{ - type_register_static(&cpu_cluster_type_info); -} -type_init(cpu_cluster_register_types) diff --git a/hw/cpu/core.c b/hw/cpu/core.c index 3a659291ea..2fc8b72a74 100644 --- a/hw/cpu/core.c +++ b/hw/cpu/core.c @@ -91,10 +91,6 @@ static const TypeInfo cpu_core_type_info = { .instance_size = sizeof(CPUCore), .instance_init = cpu_core_instance_init, }; +TYPE_INFO(cpu_core_type_info) -static void cpu_core_register_types(void) -{ - type_register_static(&cpu_core_type_info); -} -type_init(cpu_core_register_types) diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c index 96f4d2517a..0ae3019045 100644 --- a/hw/cpu/realview_mpcore.c +++ b/hw/cpu/realview_mpcore.c @@ -128,10 +128,6 @@ static const TypeInfo mpcore_rirq_info = { .instance_init = mpcore_rirq_init, .class_init = mpcore_rirq_class_init, }; +TYPE_INFO(mpcore_rirq_info) -static void realview_mpcore_register_types(void) -{ - type_register_static(&mpcore_rirq_info); -} -type_init(realview_mpcore_register_types) diff --git a/hw/display/ads7846.c b/hw/display/ads7846.c index 56bf82fe07..94bb9db052 100644 --- a/hw/display/ads7846.c +++ b/hw/display/ads7846.c @@ -174,10 +174,6 @@ static const TypeInfo ads7846_info = { .instance_size = sizeof(ADS7846State), .class_init = ads7846_class_init, }; +TYPE_INFO(ads7846_info) -static void ads7846_register_types(void) -{ - type_register_static(&ads7846_info); -} -type_init(ads7846_register_types) diff --git a/hw/display/artist.c b/hw/display/artist.c index 6261bfe65b..2e1b793a86 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -1434,10 +1434,6 @@ static const TypeInfo artist_info = { .instance_init = artist_initfn, .class_init = artist_class_init, }; +TYPE_INFO(artist_info) -static void artist_register_types(void) -{ - type_register_static(&artist_info); -} -type_init(artist_register_types) diff --git a/hw/display/ati.c b/hw/display/ati.c index 4c3ad8f47b..5ddd252f34 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -1043,10 +1043,6 @@ static const TypeInfo ati_vga_info = { { }, }, }; +TYPE_INFO(ati_vga_info) -static void ati_vga_register_types(void) -{ - type_register_static(&ati_vga_info); -} -type_init(ati_vga_register_types) diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c index 986c994522..e1f85fa948 100644 --- a/hw/display/bcm2835_fb.c +++ b/hw/display/bcm2835_fb.c @@ -461,10 +461,6 @@ static TypeInfo bcm2835_fb_info = { .class_init = bcm2835_fb_class_init, .instance_init = bcm2835_fb_init, }; +TYPE_INFO(bcm2835_fb_info) -static void bcm2835_fb_register_types(void) -{ - type_register_static(&bcm2835_fb_info); -} -type_init(bcm2835_fb_register_types) diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c index a8e8ab8325..86869778ed 100644 --- a/hw/display/bochs-display.c +++ b/hw/display/bochs-display.c @@ -381,10 +381,6 @@ static const TypeInfo bochs_display_type_info = { { }, }, }; +TYPE_INFO(bochs_display_type_info) -static void bochs_display_register_types(void) -{ - type_register_static(&bochs_display_type_info); -} -type_init(bochs_display_register_types) diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 7cbe6e56ff..0e7e260ccf 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -385,10 +385,6 @@ static const TypeInfo cg3_info = { .instance_init = cg3_initfn, .class_init = cg3_class_init, }; +TYPE_INFO(cg3_info) -static void cg3_register_types(void) -{ - type_register_static(&cg3_info); -} -type_init(cg3_register_types) diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index 212d6f5e61..fe4d8a4fb8 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -3028,10 +3028,6 @@ static const TypeInfo cirrus_vga_info = { { }, }, }; +TYPE_INFO(cirrus_vga_info) -static void cirrus_vga_register_types(void) -{ - type_register_static(&cirrus_vga_info); -} -type_init(cirrus_vga_register_types) diff --git a/hw/display/cirrus_vga_isa.c b/hw/display/cirrus_vga_isa.c index 825ba57298..4d0e54b0f2 100644 --- a/hw/display/cirrus_vga_isa.c +++ b/hw/display/cirrus_vga_isa.c @@ -90,10 +90,6 @@ static const TypeInfo isa_cirrus_vga_info = { .instance_size = sizeof(ISACirrusVGAState), .class_init = isa_cirrus_vga_class_init, }; +TYPE_INFO(isa_cirrus_vga_info) -static void cirrus_vga_isa_register_types(void) -{ - type_register_static(&isa_cirrus_vga_info); -} -type_init(cirrus_vga_isa_register_types) diff --git a/hw/display/dpcd.c b/hw/display/dpcd.c index 64463654a1..ff5b655f0e 100644 --- a/hw/display/dpcd.c +++ b/hw/display/dpcd.c @@ -156,10 +156,6 @@ static const TypeInfo dpcd_info = { .class_init = dpcd_class_init, .instance_init = dpcd_init, }; +TYPE_INFO(dpcd_info) -static void dpcd_register_types(void) -{ - type_register_static(&dpcd_info); -} -type_init(dpcd_register_types) diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c index 4b7286b7c9..bfd7f4fc6f 100644 --- a/hw/display/exynos4210_fimd.c +++ b/hw/display/exynos4210_fimd.c @@ -1961,10 +1961,6 @@ static const TypeInfo exynos4210_fimd_info = { .instance_init = exynos4210_fimd_init, .class_init = exynos4210_fimd_class_init, }; +TYPE_INFO(exynos4210_fimd_info) -static void exynos4210_fimd_register_types(void) -{ - type_register_static(&exynos4210_fimd_info); -} -type_init(exynos4210_fimd_register_types) diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index adcba96e34..33f2822445 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -536,10 +536,6 @@ static const TypeInfo g364fb_sysbus_info = { .instance_size = sizeof(G364SysBusState), .class_init = g364fb_sysbus_class_init, }; +TYPE_INFO(g364fb_sysbus_info) -static void g364fb_register_types(void) -{ - type_register_static(&g364fb_sysbus_info); -} -type_init(g364fb_register_types) diff --git a/hw/display/i2c-ddc.c b/hw/display/i2c-ddc.c index 13eb529fc1..5c5c255eb1 100644 --- a/hw/display/i2c-ddc.c +++ b/hw/display/i2c-ddc.c @@ -120,10 +120,6 @@ static TypeInfo i2c_ddc_info = { .instance_init = i2c_ddc_init, .class_init = i2c_ddc_class_init }; +TYPE_INFO(i2c_ddc_info) -static void ddc_register_devices(void) -{ - type_register_static(&i2c_ddc_info); -} -type_init(ddc_register_devices); diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 1d845597f9..1b1002e14a 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -310,10 +310,6 @@ static const TypeInfo jazz_led_info = { .instance_init = jazz_led_init, .class_init = jazz_led_class_init, }; +TYPE_INFO(jazz_led_info) -static void jazz_led_register(void) -{ - type_register_static(&jazz_led_info); -} -type_init(jazz_led_register); diff --git a/hw/display/macfb.c b/hw/display/macfb.c index b68faff4bb..1cac29e549 100644 --- a/hw/display/macfb.c +++ b/hw/display/macfb.c @@ -459,6 +459,7 @@ static TypeInfo macfb_sysbus_info = { .instance_size = sizeof(MacfbSysBusState), .class_init = macfb_sysbus_class_init, }; +TYPE_INFO(macfb_sysbus_info) static TypeInfo macfb_nubus_info = { .name = TYPE_NUBUS_MACFB, @@ -467,11 +468,6 @@ static TypeInfo macfb_nubus_info = { .class_init = macfb_nubus_class_init, .class_size = sizeof(MacfbNubusDeviceClass), }; +TYPE_INFO(macfb_nubus_info) -static void macfb_register_types(void) -{ - type_register_static(&macfb_sysbus_info); - type_register_static(&macfb_nubus_info); -} -type_init(macfb_register_types) diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index c34ef1a1bf..495b6c960f 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -495,13 +495,9 @@ static const TypeInfo milkymist_tmu2_info = { .instance_init = milkymist_tmu2_init, .class_init = milkymist_tmu2_class_init, }; +TYPE_INFO(milkymist_tmu2_info) -static void milkymist_tmu2_register_types(void) -{ - type_register_static(&milkymist_tmu2_info); -} -type_init(milkymist_tmu2_register_types) DeviceState *milkymist_tmu2_create(hwaddr base, qemu_irq irq) { diff --git a/hw/display/milkymist-vgafb.c b/hw/display/milkymist-vgafb.c index 6a6441e6ea..634bf4571a 100644 --- a/hw/display/milkymist-vgafb.c +++ b/hw/display/milkymist-vgafb.c @@ -352,10 +352,6 @@ static const TypeInfo milkymist_vgafb_info = { .instance_init = milkymist_vgafb_init, .class_init = milkymist_vgafb_class_init, }; +TYPE_INFO(milkymist_vgafb_info) -static void milkymist_vgafb_register_types(void) -{ - type_register_static(&milkymist_vgafb_info); -} -type_init(milkymist_vgafb_register_types) diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c index b0513a8fba..7839643757 100644 --- a/hw/display/next-fb.c +++ b/hw/display/next-fb.c @@ -137,10 +137,6 @@ static const TypeInfo nextfb_info = { .instance_size = sizeof(NeXTFbState), .class_init = nextfb_class_init, }; +TYPE_INFO(nextfb_info) -static void nextfb_register_types(void) -{ - type_register_static(&nextfb_info); -} -type_init(nextfb_register_types) diff --git a/hw/display/pl110.c b/hw/display/pl110.c index 4664fde3f2..41ae247666 100644 --- a/hw/display/pl110.c +++ b/hw/display/pl110.c @@ -546,24 +546,20 @@ static const TypeInfo pl110_info = { .instance_init = pl110_init, .class_init = pl110_class_init, }; +TYPE_INFO(pl110_info) static const TypeInfo pl110_versatile_info = { .name = "pl110_versatile", .parent = TYPE_PL110, .instance_init = pl110_versatile_init, }; +TYPE_INFO(pl110_versatile_info) static const TypeInfo pl111_info = { .name = "pl111", .parent = TYPE_PL110, .instance_init = pl111_init, }; +TYPE_INFO(pl111_info) -static void pl110_register_types(void) -{ - type_register_static(&pl110_info); - type_register_static(&pl110_versatile_info); - type_register_static(&pl111_info); -} -type_init(pl110_register_types) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 11871340e7..4b9f97f5aa 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -2503,6 +2503,7 @@ static const TypeInfo qxl_pci_type_info = { { }, }, }; +TYPE_INFO(qxl_pci_type_info) static void qxl_primary_class_init(ObjectClass *klass, void *data) { @@ -2521,6 +2522,7 @@ static const TypeInfo qxl_primary_info = { .parent = TYPE_PCI_QXL, .class_init = qxl_primary_class_init, }; +TYPE_INFO(qxl_primary_info) static void qxl_secondary_class_init(ObjectClass *klass, void *data) { @@ -2537,12 +2539,6 @@ static const TypeInfo qxl_secondary_info = { .parent = TYPE_PCI_QXL, .class_init = qxl_secondary_class_init, }; +TYPE_INFO(qxl_secondary_info) -static void qxl_register_types(void) -{ - type_register_static(&qxl_pci_type_info); - type_register_static(&qxl_primary_info); - type_register_static(&qxl_secondary_info); -} -type_init(qxl_register_types) diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c index b18db97eeb..28e25acc96 100644 --- a/hw/display/ramfb-standalone.c +++ b/hw/display/ramfb-standalone.c @@ -53,10 +53,6 @@ static const TypeInfo ramfb_info = { .instance_size = sizeof(RAMFBStandaloneState), .class_init = ramfb_class_initfn, }; +TYPE_INFO(ramfb_info) -static void ramfb_register_types(void) -{ - type_register_static(&ramfb_info); -} -type_init(ramfb_register_types) diff --git a/hw/display/sii9022.c b/hw/display/sii9022.c index 3b82a8567f..7d0a97da6c 100644 --- a/hw/display/sii9022.c +++ b/hw/display/sii9022.c @@ -183,10 +183,6 @@ static const TypeInfo sii9022_info = { .instance_size = sizeof(sii9022_state), .class_init = sii9022_class_init, }; +TYPE_INFO(sii9022_info) -static void sii9022_register_types(void) -{ - type_register_static(&sii9022_info); -} -type_init(sii9022_register_types) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 9cccc68c35..626f7393a0 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -2032,6 +2032,7 @@ static const TypeInfo sm501_sysbus_info = { .class_init = sm501_sysbus_class_init, .instance_init = sm501_sysbus_init, }; +TYPE_INFO(sm501_sysbus_info) #define TYPE_PCI_SM501 "sm501" #define PCI_SM501(obj) OBJECT_CHECK(SM501PCIState, (obj), TYPE_PCI_SM501) @@ -2112,11 +2113,6 @@ static const TypeInfo sm501_pci_info = { { }, }, }; +TYPE_INFO(sm501_pci_info) -static void sm501_register_types(void) -{ - type_register_static(&sm501_sysbus_info); - type_register_static(&sm501_pci_info); -} -type_init(sm501_register_types) diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c index 718378f6de..24e7fc1598 100644 --- a/hw/display/ssd0303.c +++ b/hw/display/ssd0303.c @@ -326,10 +326,6 @@ static const TypeInfo ssd0303_info = { .instance_size = sizeof(ssd0303_state), .class_init = ssd0303_class_init, }; +TYPE_INFO(ssd0303_info) -static void ssd0303_register_types(void) -{ - type_register_static(&ssd0303_info); -} -type_init(ssd0303_register_types) diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c index 32d27f008a..056cc0b094 100644 --- a/hw/display/ssd0323.c +++ b/hw/display/ssd0323.c @@ -377,10 +377,6 @@ static const TypeInfo ssd0323_info = { .instance_size = sizeof(ssd0323_state), .class_init = ssd0323_class_init, }; +TYPE_INFO(ssd0323_info) -static void ssd03232_register_types(void) -{ - type_register_static(&ssd0323_info); -} -type_init(ssd03232_register_types) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index 1fb45b1aab..0d05421868 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -902,10 +902,6 @@ static const TypeInfo tcx_info = { .instance_init = tcx_initfn, .class_init = tcx_class_init, }; +TYPE_INFO(tcx_info) -static void tcx_register_types(void) -{ - type_register_static(&tcx_info); -} -type_init(tcx_register_types) diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c index 3aaeeeca1e..1561f702b9 100644 --- a/hw/display/vga-isa.c +++ b/hw/display/vga-isa.c @@ -105,10 +105,6 @@ static const TypeInfo vga_isa_info = { .instance_size = sizeof(ISAVGAState), .class_init = vga_isa_class_initfn, }; +TYPE_INFO(vga_isa_info) -static void vga_isa_register_types(void) -{ - type_register_static(&vga_isa_info); -} -type_init(vga_isa_register_types) diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c index a640fd866d..5e8ddc9ac5 100644 --- a/hw/display/vga-pci.c +++ b/hw/display/vga-pci.c @@ -374,6 +374,7 @@ static const TypeInfo vga_pci_type_info = { { }, }, }; +TYPE_INFO(vga_pci_type_info) static void vga_class_init(ObjectClass *klass, void *data) { @@ -405,6 +406,7 @@ static const TypeInfo vga_info = { .instance_init = pci_std_vga_init, .class_init = vga_class_init, }; +TYPE_INFO(vga_info) static const TypeInfo secondary_info = { .name = "secondary-vga", @@ -412,12 +414,6 @@ static const TypeInfo secondary_info = { .instance_init = pci_secondary_vga_init, .class_init = secondary_class_init, }; +TYPE_INFO(secondary_info) -static void vga_register_types(void) -{ - type_register_static(&vga_pci_type_info); - type_register_static(&vga_info); - type_register_static(&secondary_info); -} -type_init(vga_register_types) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 4cdaee1bde..91f50165ba 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -599,10 +599,6 @@ static const TypeInfo vhost_user_gpu_info = { .instance_finalize = vhost_user_gpu_instance_finalize, .class_init = vhost_user_gpu_class_init, }; +TYPE_INFO(vhost_user_gpu_info) -static void vhost_user_gpu_register_types(void) -{ - type_register_static(&vhost_user_gpu_info); -} -type_init(vhost_user_gpu_register_types) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 7961308606..6cc4858daa 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -232,14 +232,9 @@ static const TypeInfo virtio_gpu_base_info = { .class_init = virtio_gpu_base_class_init, .abstract = true }; +TYPE_INFO(virtio_gpu_base_info) -static void -virtio_register_types(void) -{ - type_register_static(&virtio_gpu_base_info); -} -type_init(virtio_register_types) QEMU_BUILD_BUG_ON(sizeof(struct virtio_gpu_ctrl_hdr) != 24); QEMU_BUILD_BUG_ON(sizeof(struct virtio_gpu_update_cursor) != 56); diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c index 34d8e93f28..8a71ee4f7e 100644 --- a/hw/display/virtio-gpu-pci.c +++ b/hw/display/virtio-gpu-pci.c @@ -63,6 +63,7 @@ static const TypeInfo virtio_gpu_pci_base_info = { .class_init = virtio_gpu_pci_base_class_init, .abstract = true }; +TYPE_INFO(virtio_gpu_pci_base_info) #define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci" #define VIRTIO_GPU_PCI(obj) \ @@ -91,7 +92,6 @@ static const VirtioPCIDeviceTypeInfo virtio_gpu_pci_info = { static void virtio_gpu_pci_register_types(void) { - type_register_static(&virtio_gpu_pci_base_info); virtio_pci_types_register(&virtio_gpu_pci_info); } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 5f0dd7c150..790ea40637 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1263,10 +1263,6 @@ static const TypeInfo virtio_gpu_info = { .instance_size = sizeof(VirtIOGPU), .class_init = virtio_gpu_class_init, }; +TYPE_INFO(virtio_gpu_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_gpu_info); -} -type_init(virtio_register_types) diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index f533d7d1b4..e1342c2ea1 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -199,6 +199,7 @@ static TypeInfo virtio_vga_base_info = { .class_init = virtio_vga_base_class_init, .abstract = true, }; +TYPE_INFO(virtio_vga_base_info) #define TYPE_VIRTIO_VGA "virtio-vga" @@ -230,7 +231,6 @@ static VirtioPCIDeviceTypeInfo virtio_vga_info = { static void virtio_vga_register_types(void) { - type_register_static(&virtio_vga_base_info); virtio_pci_types_register(&virtio_vga_info); } diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 2579f6b218..487d29f5c0 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1357,10 +1357,6 @@ static const TypeInfo vmsvga_info = { { }, }, }; +TYPE_INFO(vmsvga_info) -static void vmsvga_register_types(void) -{ - type_register_static(&vmsvga_info); -} -type_init(vmsvga_register_types) diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index c56e6ec593..95accb9442 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1361,10 +1361,6 @@ static const TypeInfo xlnx_dp_info = { .instance_init = xlnx_dp_init, .class_init = xlnx_dp_class_init, }; +TYPE_INFO(xlnx_dp_info) -static void xlnx_dp_register_types(void) -{ - type_register_static(&xlnx_dp_info); -} -type_init(xlnx_dp_register_types) diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c index eb0002a2b9..f7478c3954 100644 --- a/hw/dma/bcm2835_dma.c +++ b/hw/dma/bcm2835_dma.c @@ -401,10 +401,6 @@ static TypeInfo bcm2835_dma_info = { .class_init = bcm2835_dma_class_init, .instance_init = bcm2835_dma_init, }; +TYPE_INFO(bcm2835_dma_info) -static void bcm2835_dma_register_types(void) -{ - type_register_static(&bcm2835_dma_info); -} -type_init(bcm2835_dma_register_types) diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c index 6977d85ef8..6c433137a0 100644 --- a/hw/dma/i82374.c +++ b/hw/dma/i82374.c @@ -158,10 +158,6 @@ static const TypeInfo i82374_info = { .instance_size = sizeof(I82374State), .class_init = i82374_class_init, }; +TYPE_INFO(i82374_info) -static void i82374_register_types(void) -{ - type_register_static(&i82374_info); -} -type_init(i82374_register_types) diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index db808029b0..bd3b225a77 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -626,13 +626,9 @@ static const TypeInfo i8257_info = { { } } }; +TYPE_INFO(i8257_info) -static void i8257_register_types(void) -{ - type_register_static(&i8257_info); -} -type_init(i8257_register_types) void i8257_dma_init(ISABus *bus, bool high_page_enable) { diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c index f1a586b1d7..823646a29a 100644 --- a/hw/dma/pl080.c +++ b/hw/dma/pl080.c @@ -432,19 +432,15 @@ static const TypeInfo pl080_info = { .instance_init = pl080_init, .class_init = pl080_class_init, }; +TYPE_INFO(pl080_info) static const TypeInfo pl081_info = { .name = TYPE_PL081, .parent = TYPE_PL080, .instance_init = pl081_init, }; +TYPE_INFO(pl081_info) /* The PL080 and PL081 are the same except for the number of channels they implement (8 and 2 respectively). */ -static void pl080_register_types(void) -{ - type_register_static(&pl080_info); - type_register_static(&pl081_info); -} -type_init(pl080_register_types) diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c index 0bd63a43f5..3288f31678 100644 --- a/hw/dma/pl330.c +++ b/hw/dma/pl330.c @@ -1674,10 +1674,6 @@ static const TypeInfo pl330_type_info = { .instance_size = sizeof(PL330State), .class_init = pl330_class_init, }; +TYPE_INFO(pl330_type_info) -static void pl330_register_types(void) -{ - type_register_static(&pl330_type_info); -} -type_init(pl330_register_types) diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c index 7fa979180f..225aa5146f 100644 --- a/hw/dma/puv3_dma.c +++ b/hw/dma/puv3_dma.c @@ -109,10 +109,6 @@ static const TypeInfo puv3_dma_info = { .instance_size = sizeof(PUV3DMAState), .class_init = puv3_dma_class_init, }; +TYPE_INFO(puv3_dma_info) -static void puv3_dma_register_type(void) -{ - type_register_static(&puv3_dma_info); -} -type_init(puv3_dma_register_type) diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c index 78b2849bcb..b2f1f1b236 100644 --- a/hw/dma/pxa2xx_dma.c +++ b/hw/dma/pxa2xx_dma.c @@ -581,10 +581,6 @@ static const TypeInfo pxa2xx_dma_info = { .instance_init = pxa2xx_dma_init, .class_init = pxa2xx_dma_class_init, }; +TYPE_INFO(pxa2xx_dma_info) -static void pxa2xx_dma_register_types(void) -{ - type_register_static(&pxa2xx_dma_info); -} -type_init(pxa2xx_dma_register_types) diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index 7eddc9a776..ccbda2ce82 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -718,6 +718,7 @@ static const TypeInfo rc4030_info = { .instance_init = rc4030_initfn, .class_init = rc4030_class_init, }; +TYPE_INFO(rc4030_info) static void rc4030_iommu_memory_region_class_init(ObjectClass *klass, void *data) @@ -732,14 +733,9 @@ static const TypeInfo rc4030_iommu_memory_region_info = { .name = TYPE_RC4030_IOMMU_MEMORY_REGION, .class_init = rc4030_iommu_memory_region_class_init, }; +TYPE_INFO(rc4030_iommu_memory_region_info) -static void rc4030_register_types(void) -{ - type_register_static(&rc4030_info); - type_register_static(&rc4030_iommu_memory_region_info); -} -type_init(rc4030_register_types) DeviceState *rc4030_init(rc4030_dma **dmas, IOMMUMemoryRegion **dma_mr) { diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c index bcd1626fbd..774669345b 100644 --- a/hw/dma/sparc32_dma.c +++ b/hw/dma/sparc32_dma.c @@ -286,6 +286,7 @@ static const TypeInfo sparc32_dma_device_info = { .instance_init = sparc32_dma_device_init, .class_init = sparc32_dma_device_class_init, }; +TYPE_INFO(sparc32_dma_device_info) static void sparc32_espdma_device_init(Object *obj) { @@ -327,6 +328,7 @@ static const TypeInfo sparc32_espdma_device_info = { .instance_init = sparc32_espdma_device_init, .class_init = sparc32_espdma_device_class_init, }; +TYPE_INFO(sparc32_espdma_device_info) static void sparc32_ledma_device_init(Object *obj) { @@ -365,6 +367,7 @@ static const TypeInfo sparc32_ledma_device_info = { .instance_init = sparc32_ledma_device_init, .class_init = sparc32_ledma_device_class_init, }; +TYPE_INFO(sparc32_ledma_device_info) static void sparc32_dma_realize(DeviceState *dev, Error **errp) { @@ -437,14 +440,7 @@ static const TypeInfo sparc32_dma_info = { .instance_init = sparc32_dma_init, .class_init = sparc32_dma_class_init, }; +TYPE_INFO(sparc32_dma_info) -static void sparc32_dma_register_types(void) -{ - type_register_static(&sparc32_dma_device_info); - type_register_static(&sparc32_espdma_device_info); - type_register_static(&sparc32_ledma_device_info); - type_register_static(&sparc32_dma_info); -} -type_init(sparc32_dma_register_types) diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index a4812e480a..4c5c0c994b 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -630,6 +630,7 @@ static const TypeInfo axidma_info = { .class_init = axidma_class_init, .instance_init = xilinx_axidma_init, }; +TYPE_INFO(axidma_info) static const TypeInfo xilinx_axidma_data_stream_info = { .name = TYPE_XILINX_AXI_DMA_DATA_STREAM, @@ -642,6 +643,7 @@ static const TypeInfo xilinx_axidma_data_stream_info = { { } } }; +TYPE_INFO(xilinx_axidma_data_stream_info) static const TypeInfo xilinx_axidma_control_stream_info = { .name = TYPE_XILINX_AXI_DMA_CONTROL_STREAM, @@ -654,12 +656,6 @@ static const TypeInfo xilinx_axidma_control_stream_info = { { } } }; +TYPE_INFO(xilinx_axidma_control_stream_info) -static void xilinx_axidma_register_types(void) -{ - type_register_static(&axidma_info); - type_register_static(&xilinx_axidma_data_stream_info); - type_register_static(&xilinx_axidma_control_stream_info); -} -type_init(xilinx_axidma_register_types) diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c index fa38a55634..6d7df3a589 100644 --- a/hw/dma/xlnx-zdma.c +++ b/hw/dma/xlnx-zdma.c @@ -838,10 +838,6 @@ static const TypeInfo zdma_info = { .class_init = zdma_class_init, .instance_init = zdma_init, }; +TYPE_INFO(zdma_info) -static void zdma_register_types(void) -{ - type_register_static(&zdma_info); -} -type_init(zdma_register_types) diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index e33112b6f0..4ee247d855 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -393,10 +393,6 @@ static const TypeInfo xlnx_zynq_devcfg_info = { .instance_init = xlnx_zynq_devcfg_init, .class_init = xlnx_zynq_devcfg_class_init, }; +TYPE_INFO(xlnx_zynq_devcfg_info) -static void xlnx_zynq_devcfg_register_types(void) -{ - type_register_static(&xlnx_zynq_devcfg_info); -} -type_init(xlnx_zynq_devcfg_register_types) diff --git a/hw/dma/xlnx_dpdma.c b/hw/dma/xlnx_dpdma.c index b40c897de2..c5b0864a08 100644 --- a/hw/dma/xlnx_dpdma.c +++ b/hw/dma/xlnx_dpdma.c @@ -608,11 +608,8 @@ static const TypeInfo xlnx_dpdma_info = { .instance_init = xlnx_dpdma_init, .class_init = xlnx_dpdma_class_init, }; +TYPE_INFO(xlnx_dpdma_info) -static void xlnx_dpdma_register_types(void) -{ - type_register_static(&xlnx_dpdma_info); -} size_t xlnx_dpdma_start_operation(XlnxDPDMAState *s, uint8_t channel, bool one_desc) @@ -787,4 +784,3 @@ void xlnx_dpdma_trigger_vsync_irq(XlnxDPDMAState *s) xlnx_dpdma_update_irq(s); } -type_init(xlnx_dpdma_register_types) diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c index 985a259e05..f00630e2ea 100644 --- a/hw/gpio/aspeed_gpio.c +++ b/hw/gpio/aspeed_gpio.c @@ -971,6 +971,7 @@ static const TypeInfo aspeed_gpio_info = { .class_init = aspeed_gpio_class_init, .abstract = true, }; +TYPE_INFO(aspeed_gpio_info) static const TypeInfo aspeed_gpio_ast2400_info = { .name = TYPE_ASPEED_GPIO "-ast2400", @@ -978,6 +979,7 @@ static const TypeInfo aspeed_gpio_ast2400_info = { .class_init = aspeed_gpio_ast2400_class_init, .instance_init = aspeed_gpio_init, }; +TYPE_INFO(aspeed_gpio_ast2400_info) static const TypeInfo aspeed_gpio_ast2500_info = { .name = TYPE_ASPEED_GPIO "-ast2500", @@ -985,6 +987,7 @@ static const TypeInfo aspeed_gpio_ast2500_info = { .class_init = aspeed_gpio_2500_class_init, .instance_init = aspeed_gpio_init, }; +TYPE_INFO(aspeed_gpio_ast2500_info) static const TypeInfo aspeed_gpio_ast2600_3_6v_info = { .name = TYPE_ASPEED_GPIO "-ast2600", @@ -992,6 +995,7 @@ static const TypeInfo aspeed_gpio_ast2600_3_6v_info = { .class_init = aspeed_gpio_ast2600_3_6v_class_init, .instance_init = aspeed_gpio_init, }; +TYPE_INFO(aspeed_gpio_ast2600_3_6v_info) static const TypeInfo aspeed_gpio_ast2600_1_8v_info = { .name = TYPE_ASPEED_GPIO "-ast2600-1_8v", @@ -999,14 +1003,6 @@ static const TypeInfo aspeed_gpio_ast2600_1_8v_info = { .class_init = aspeed_gpio_ast2600_1_8v_class_init, .instance_init = aspeed_gpio_init, }; +TYPE_INFO(aspeed_gpio_ast2600_1_8v_info) -static void aspeed_gpio_register_types(void) -{ - type_register_static(&aspeed_gpio_info); - type_register_static(&aspeed_gpio_ast2400_info); - type_register_static(&aspeed_gpio_ast2500_info); - type_register_static(&aspeed_gpio_ast2600_3_6v_info); - type_register_static(&aspeed_gpio_ast2600_1_8v_info); -} -type_init(aspeed_gpio_register_types); diff --git a/hw/gpio/bcm2835_gpio.c b/hw/gpio/bcm2835_gpio.c index abdddbc67c..2ea64a77e8 100644 --- a/hw/gpio/bcm2835_gpio.c +++ b/hw/gpio/bcm2835_gpio.c @@ -336,10 +336,6 @@ static const TypeInfo bcm2835_gpio_info = { .instance_init = bcm2835_gpio_init, .class_init = bcm2835_gpio_class_init, }; +TYPE_INFO(bcm2835_gpio_info) -static void bcm2835_gpio_register_types(void) -{ - type_register_static(&bcm2835_gpio_info); -} -type_init(bcm2835_gpio_register_types) diff --git a/hw/gpio/gpio_key.c b/hw/gpio/gpio_key.c index 46bbd42772..571b74a5e5 100644 --- a/hw/gpio/gpio_key.c +++ b/hw/gpio/gpio_key.c @@ -99,10 +99,6 @@ static const TypeInfo gpio_key_info = { .instance_size = sizeof(GPIOKEYState), .class_init = gpio_key_class_init, }; +TYPE_INFO(gpio_key_info) -static void gpio_key_register_types(void) -{ - type_register_static(&gpio_key_info); -} -type_init(gpio_key_register_types) diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c index 7a591804a9..df533846f7 100644 --- a/hw/gpio/imx_gpio.c +++ b/hw/gpio/imx_gpio.c @@ -346,10 +346,6 @@ static const TypeInfo imx_gpio_info = { .instance_size = sizeof(IMXGPIOState), .class_init = imx_gpio_class_init, }; +TYPE_INFO(imx_gpio_info) -static void imx_gpio_register_types(void) -{ - type_register_static(&imx_gpio_info); -} -type_init(imx_gpio_register_types) diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c index bebb4030d2..3a8e4ab1d5 100644 --- a/hw/gpio/max7310.c +++ b/hw/gpio/max7310.c @@ -215,10 +215,6 @@ static const TypeInfo max7310_info = { .instance_size = sizeof(MAX7310State), .class_init = max7310_class_init, }; +TYPE_INFO(max7310_info) -static void max7310_register_types(void) -{ - type_register_static(&max7310_info); -} -type_init(max7310_register_types) diff --git a/hw/gpio/mpc8xxx.c b/hw/gpio/mpc8xxx.c index 1d99667094..b1bdcc2851 100644 --- a/hw/gpio/mpc8xxx.c +++ b/hw/gpio/mpc8xxx.c @@ -214,10 +214,6 @@ static const TypeInfo mpc8xxx_gpio_info = { .instance_init = mpc8xxx_gpio_initfn, .class_init = mpc8xxx_gpio_class_init, }; +TYPE_INFO(mpc8xxx_gpio_info) -static void mpc8xxx_gpio_register_types(void) -{ - type_register_static(&mpc8xxx_gpio_info); -} -type_init(mpc8xxx_gpio_register_types) diff --git a/hw/gpio/nrf51_gpio.c b/hw/gpio/nrf51_gpio.c index b47fddf4ed..e59d975a0c 100644 --- a/hw/gpio/nrf51_gpio.c +++ b/hw/gpio/nrf51_gpio.c @@ -309,10 +309,6 @@ static const TypeInfo nrf51_gpio_info = { .instance_init = nrf51_gpio_init, .class_init = nrf51_gpio_class_init }; +TYPE_INFO(nrf51_gpio_info) -static void nrf51_gpio_register_types(void) -{ - type_register_static(&nrf51_gpio_info); -} -type_init(nrf51_gpio_register_types) diff --git a/hw/gpio/omap_gpio.c b/hw/gpio/omap_gpio.c index f662c4cb95..f8ab9a49df 100644 --- a/hw/gpio/omap_gpio.c +++ b/hw/gpio/omap_gpio.c @@ -767,6 +767,7 @@ static const TypeInfo omap_gpio_info = { .instance_init = omap_gpio_init, .class_init = omap_gpio_class_init, }; +TYPE_INFO(omap_gpio_info) void omap2_gpio_set_iclk(omap2_gpif *gpio, omap_clk clk) { @@ -801,11 +802,6 @@ static const TypeInfo omap2_gpio_info = { .instance_size = sizeof(struct omap2_gpif_s), .class_init = omap2_gpio_class_init, }; +TYPE_INFO(omap2_gpio_info) -static void omap_gpio_register_types(void) -{ - type_register_static(&omap_gpio_info); - type_register_static(&omap2_gpio_info); -} -type_init(omap_gpio_register_types) diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c index 6d3c36bc16..b6ef1c7340 100644 --- a/hw/gpio/pl061.c +++ b/hw/gpio/pl061.c @@ -385,17 +385,13 @@ static const TypeInfo pl061_info = { .instance_init = pl061_init, .class_init = pl061_class_init, }; +TYPE_INFO(pl061_info) static const TypeInfo pl061_luminary_info = { .name = "pl061_luminary", .parent = TYPE_PL061, .instance_init = pl061_luminary_init, }; +TYPE_INFO(pl061_luminary_info) -static void pl061_register_types(void) -{ - type_register_static(&pl061_info); - type_register_static(&pl061_luminary_info); -} -type_init(pl061_register_types) diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c index 7362b6715f..4c2edda889 100644 --- a/hw/gpio/puv3_gpio.c +++ b/hw/gpio/puv3_gpio.c @@ -144,10 +144,6 @@ static const TypeInfo puv3_gpio_info = { .instance_size = sizeof(PUV3GPIOState), .class_init = puv3_gpio_class_init, }; +TYPE_INFO(puv3_gpio_info) -static void puv3_gpio_register_type(void) -{ - type_register_static(&puv3_gpio_info); -} -type_init(puv3_gpio_register_type) diff --git a/hw/gpio/zaurus.c b/hw/gpio/zaurus.c index 258e926493..1100850a6c 100644 --- a/hw/gpio/zaurus.c +++ b/hw/gpio/zaurus.c @@ -255,13 +255,9 @@ static const TypeInfo scoop_sysbus_info = { .instance_init = scoop_init, .class_init = scoop_sysbus_class_init, }; +TYPE_INFO(scoop_sysbus_info) -static void scoop_register_types(void) -{ - type_register_static(&scoop_sysbus_info); -} -type_init(scoop_register_types) /* Write the bootloader parameters memory area. */ diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c index 7f0c6223a8..27faa97644 100644 --- a/hw/hppa/dino.c +++ b/hw/hppa/dino.c @@ -601,10 +601,6 @@ static const TypeInfo dino_pcihost_info = { .instance_size = sizeof(DinoState), .class_init = dino_pcihost_class_init, }; +TYPE_INFO(dino_pcihost_info) -static void dino_register_types(void) -{ - type_register_static(&dino_pcihost_info); -} -type_init(dino_register_types) diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c index 19974034f3..8a54923c26 100644 --- a/hw/hppa/lasi.c +++ b/hw/hppa/lasi.c @@ -359,10 +359,6 @@ static const TypeInfo lasi_pcihost_info = { .instance_size = sizeof(LasiState), .class_init = lasi_class_init, }; +TYPE_INFO(lasi_pcihost_info) -static void lasi_register_types(void) -{ - type_register_static(&lasi_pcihost_info); -} -type_init(lasi_register_types) diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index 844d00776d..07c9214bf1 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -159,13 +159,9 @@ static const TypeInfo synic_type_info = { .instance_size = sizeof(SynICState), .class_init = synic_class_init, }; +TYPE_INFO(synic_type_info) -static void synic_register_types(void) -{ - type_register_static(&synic_type_info); -} -type_init(synic_register_types) /* * KVM has its own message producers (SynIC timers). To guarantee diff --git a/hw/hyperv/hyperv_testdev.c b/hw/hyperv/hyperv_testdev.c index 88a5a63782..c83d0a9325 100644 --- a/hw/hyperv/hyperv_testdev.c +++ b/hw/hyperv/hyperv_testdev.c @@ -319,9 +319,5 @@ static const TypeInfo hv_test_dev_info = { .instance_size = sizeof(HypervTestDev), .class_init = hv_test_dev_class_init, }; +TYPE_INFO(hv_test_dev_info) -static void hv_test_dev_register_types(void) -{ - type_register_static(&hv_test_dev_info); -} -type_init(hv_test_dev_register_types); diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index 34392e892a..2014971dbc 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -2488,6 +2488,7 @@ static const TypeInfo vmbus_dev_type_info = { .class_init = vmbus_dev_class_init, .instance_init = vmbus_dev_instance_init, }; +TYPE_INFO(vmbus_dev_type_info) static void vmbus_realize(BusState *bus, Error **errp) { @@ -2700,6 +2701,7 @@ static const TypeInfo vmbus_type_info = { .instance_size = sizeof(VMBus), .class_init = vmbus_class_init, }; +TYPE_INFO(vmbus_type_info) static void vmbus_bridge_realize(DeviceState *dev, Error **errp) { @@ -2765,12 +2767,6 @@ static const TypeInfo vmbus_bridge_type_info = { .instance_size = sizeof(VMBusBridge), .class_init = vmbus_bridge_class_init, }; +TYPE_INFO(vmbus_bridge_type_info) -static void vmbus_register_types(void) -{ - type_register_static(&vmbus_bridge_type_info); - type_register_static(&vmbus_dev_type_info); - type_register_static(&vmbus_type_info); -} -type_init(vmbus_register_types) diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c index 518a3f5c6f..ecbbc22524 100644 --- a/hw/i2c/aspeed_i2c.c +++ b/hw/i2c/aspeed_i2c.c @@ -845,6 +845,7 @@ static const TypeInfo aspeed_i2c_info = { .class_size = sizeof(AspeedI2CClass), .abstract = true, }; +TYPE_INFO(aspeed_i2c_info) static qemu_irq aspeed_2400_i2c_bus_get_irq(AspeedI2CBus *bus) { @@ -880,6 +881,7 @@ static const TypeInfo aspeed_2400_i2c_info = { .parent = TYPE_ASPEED_I2C, .class_init = aspeed_2400_i2c_class_init, }; +TYPE_INFO(aspeed_2400_i2c_info) static qemu_irq aspeed_2500_i2c_bus_get_irq(AspeedI2CBus *bus) { @@ -914,6 +916,7 @@ static const TypeInfo aspeed_2500_i2c_info = { .parent = TYPE_ASPEED_I2C, .class_init = aspeed_2500_i2c_class_init, }; +TYPE_INFO(aspeed_2500_i2c_info) static qemu_irq aspeed_2600_i2c_bus_get_irq(AspeedI2CBus *bus) { @@ -947,16 +950,9 @@ static const TypeInfo aspeed_2600_i2c_info = { .parent = TYPE_ASPEED_I2C, .class_init = aspeed_2600_i2c_class_init, }; +TYPE_INFO(aspeed_2600_i2c_info) -static void aspeed_i2c_register_types(void) -{ - type_register_static(&aspeed_i2c_info); - type_register_static(&aspeed_2400_i2c_info); - type_register_static(&aspeed_2500_i2c_info); - type_register_static(&aspeed_2600_i2c_info); -} -type_init(aspeed_i2c_register_types) I2CBus *aspeed_i2c_get_bus(AspeedI2CState *s, int busnr) diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index b000952b98..566ccf0d74 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -216,10 +216,6 @@ static const TypeInfo gpio_i2c_info = { .instance_init = gpio_i2c_init, .class_init = gpio_i2c_class_init, }; +TYPE_INFO(gpio_i2c_info) -static void bitbang_i2c_register_types(void) -{ - type_register_static(&gpio_i2c_info); -} -type_init(bitbang_i2c_register_types) diff --git a/hw/i2c/core.c b/hw/i2c/core.c index 21ec52ac5a..81bfce2797 100644 --- a/hw/i2c/core.c +++ b/hw/i2c/core.c @@ -27,6 +27,7 @@ static const TypeInfo i2c_bus_info = { .parent = TYPE_BUS, .instance_size = sizeof(I2CBus), }; +TYPE_INFO(i2c_bus_info) static int i2c_bus_pre_save(void *opaque) { @@ -306,11 +307,6 @@ static const TypeInfo i2c_slave_type_info = { .class_size = sizeof(I2CSlaveClass), .class_init = i2c_slave_class_init, }; +TYPE_INFO(i2c_slave_type_info) -static void i2c_slave_register_types(void) -{ - type_register_static(&i2c_bus_info); - type_register_static(&i2c_slave_type_info); -} -type_init(i2c_slave_register_types) diff --git a/hw/i2c/exynos4210_i2c.c b/hw/i2c/exynos4210_i2c.c index a600f65560..3a803ebc8b 100644 --- a/hw/i2c/exynos4210_i2c.c +++ b/hw/i2c/exynos4210_i2c.c @@ -324,10 +324,6 @@ static const TypeInfo exynos4210_i2c_type_info = { .instance_init = exynos4210_i2c_init, .class_init = exynos4210_i2c_class_init, }; +TYPE_INFO(exynos4210_i2c_type_info) -static void exynos4210_i2c_register_types(void) -{ - type_register_static(&exynos4210_i2c_type_info); -} -type_init(exynos4210_i2c_register_types) diff --git a/hw/i2c/imx_i2c.c b/hw/i2c/imx_i2c.c index 2e02e1c4fa..a38eb18e33 100644 --- a/hw/i2c/imx_i2c.c +++ b/hw/i2c/imx_i2c.c @@ -324,10 +324,6 @@ static const TypeInfo imx_i2c_type_info = { .instance_size = sizeof(IMXI2CState), .class_init = imx_i2c_class_init, }; +TYPE_INFO(imx_i2c_type_info) -static void imx_i2c_register_types(void) -{ - type_register_static(&imx_i2c_type_info); -} -type_init(imx_i2c_register_types) diff --git a/hw/i2c/microbit_i2c.c b/hw/i2c/microbit_i2c.c index 8024739820..51eb28bf21 100644 --- a/hw/i2c/microbit_i2c.c +++ b/hw/i2c/microbit_i2c.c @@ -120,10 +120,6 @@ static const TypeInfo microbit_i2c_info = { .instance_size = sizeof(MicrobitI2CState), .class_init = microbit_i2c_class_init, }; +TYPE_INFO(microbit_i2c_info) -static void microbit_i2c_register_types(void) -{ - type_register_static(µbit_i2c_info); -} -type_init(microbit_i2c_register_types) diff --git a/hw/i2c/mpc_i2c.c b/hw/i2c/mpc_i2c.c index 9a724f3a3e..c65fb2775b 100644 --- a/hw/i2c/mpc_i2c.c +++ b/hw/i2c/mpc_i2c.c @@ -351,10 +351,6 @@ static const TypeInfo mpc_i2c_type_info = { .instance_size = sizeof(MPCI2CState), .class_init = mpc_i2c_class_init, }; +TYPE_INFO(mpc_i2c_type_info) -static void mpc_i2c_register_types(void) -{ - type_register_static(&mpc_i2c_type_info); -} -type_init(mpc_i2c_register_types) diff --git a/hw/i2c/omap_i2c.c b/hw/i2c/omap_i2c.c index e5d205dda5..ba7b7ee734 100644 --- a/hw/i2c/omap_i2c.c +++ b/hw/i2c/omap_i2c.c @@ -534,11 +534,8 @@ static const TypeInfo omap_i2c_info = { .instance_init = omap_i2c_init, .class_init = omap_i2c_class_init, }; +TYPE_INFO(omap_i2c_info) -static void omap_i2c_register_types(void) -{ - type_register_static(&omap_i2c_info); -} I2CBus *omap_i2c_bus(DeviceState *omap_i2c) { @@ -546,4 +543,3 @@ I2CBus *omap_i2c_bus(DeviceState *omap_i2c) return s->bus; } -type_init(omap_i2c_register_types) diff --git a/hw/i2c/ppc4xx_i2c.c b/hw/i2c/ppc4xx_i2c.c index c0a8e04567..49ca51516e 100644 --- a/hw/i2c/ppc4xx_i2c.c +++ b/hw/i2c/ppc4xx_i2c.c @@ -363,10 +363,6 @@ static const TypeInfo ppc4xx_i2c_type_info = { .instance_init = ppc4xx_i2c_init, .class_init = ppc4xx_i2c_class_init, }; +TYPE_INFO(ppc4xx_i2c_type_info) -static void ppc4xx_i2c_register_types(void) -{ - type_register_static(&ppc4xx_i2c_type_info); -} -type_init(ppc4xx_i2c_register_types) diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index b7def9eeb8..cc506b6d4a 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -157,13 +157,9 @@ static const TypeInfo smbus_eeprom_info = { .instance_size = sizeof(SMBusEEPROMDevice), .class_init = smbus_eeprom_class_initfn, }; +TYPE_INFO(smbus_eeprom_info) -static void smbus_eeprom_register_types(void) -{ - type_register_static(&smbus_eeprom_info); -} -type_init(smbus_eeprom_register_types) void smbus_eeprom_init_one(I2CBus *smbus, uint8_t address, uint8_t *eeprom_buf) { diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c index 48f1ff4191..37a41b5b77 100644 --- a/hw/i2c/smbus_ich9.c +++ b/hw/i2c/smbus_ich9.c @@ -146,10 +146,6 @@ static const TypeInfo ich9_smb_info = { { }, }, }; +TYPE_INFO(ich9_smb_info) -static void ich9_smb_register(void) -{ - type_register_static(&ich9_smb_info); -} -type_init(ich9_smb_register); diff --git a/hw/i2c/smbus_slave.c b/hw/i2c/smbus_slave.c index 5d10e27664..6a8b0846c7 100644 --- a/hw/i2c/smbus_slave.c +++ b/hw/i2c/smbus_slave.c @@ -228,10 +228,6 @@ static const TypeInfo smbus_device_type_info = { .class_size = sizeof(SMBusDeviceClass), .class_init = smbus_device_class_init, }; +TYPE_INFO(smbus_device_type_info) -static void smbus_device_register_types(void) -{ - type_register_static(&smbus_device_type_info); -} -type_init(smbus_device_register_types) diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c index da8cda2ec1..13ddddef90 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/versatile_i2c.c @@ -102,10 +102,6 @@ static const TypeInfo versatile_i2c_info = { .instance_size = sizeof(VersatileI2CState), .instance_init = versatile_i2c_init, }; +TYPE_INFO(versatile_i2c_info) -static void versatile_i2c_register_types(void) -{ - type_register_static(&versatile_i2c_info); -} -type_init(versatile_i2c_register_types) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 087f601666..54bc1acbac 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -1620,6 +1620,7 @@ static const TypeInfo amdvi = { .instance_init = amdvi_instance_init, .class_init = amdvi_class_init }; +TYPE_INFO(amdvi) static const TypeInfo amdviPCI = { .name = "AMDVI-PCI", @@ -1630,6 +1631,7 @@ static const TypeInfo amdviPCI = { { }, }, }; +TYPE_INFO(amdviPCI) static void amdvi_iommu_memory_region_class_init(ObjectClass *klass, void *data) { @@ -1644,12 +1646,6 @@ static const TypeInfo amdvi_iommu_memory_region_info = { .name = TYPE_AMD_IOMMU_MEMORY_REGION, .class_init = amdvi_iommu_memory_region_class_init, }; +TYPE_INFO(amdvi_iommu_memory_region_info) -static void amdviPCI_register_types(void) -{ - type_register_static(&amdviPCI); - type_register_static(&amdvi); - type_register_static(&amdvi_iommu_memory_region_info); -} -type_init(amdviPCI_register_types); diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 5284bb68b6..5e9101cd52 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3874,6 +3874,7 @@ static const TypeInfo vtd_info = { .instance_size = sizeof(IntelIOMMUState), .class_init = vtd_class_init, }; +TYPE_INFO(vtd_info) static void vtd_iommu_memory_region_class_init(ObjectClass *klass, void *data) @@ -3890,11 +3891,6 @@ static const TypeInfo vtd_iommu_memory_region_info = { .name = TYPE_INTEL_IOMMU_MEMORY_REGION, .class_init = vtd_iommu_memory_region_class_init, }; +TYPE_INFO(vtd_iommu_memory_region_info) -static void vtd_register_types(void) -{ - type_register_static(&vtd_info); - type_register_static(&vtd_iommu_memory_region_info); -} -type_init(vtd_register_types) diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c index 4eb2d77b87..06dd7f8c9a 100644 --- a/hw/i386/kvm/apic.c +++ b/hw/i386/kvm/apic.c @@ -257,10 +257,6 @@ static const TypeInfo kvm_apic_info = { .instance_size = sizeof(APICCommonState), .class_init = kvm_apic_class_init, }; +TYPE_INFO(kvm_apic_info) -static void kvm_apic_register_types(void) -{ - type_register_static(&kvm_apic_info); -} -type_init(kvm_apic_register_types) diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index 64283358f9..e9f57d0e2b 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -326,6 +326,7 @@ static const TypeInfo kvmclock_info = { .instance_size = sizeof(KVMClockState), .class_init = kvmclock_class_init, }; +TYPE_INFO(kvmclock_info) /* Note: Must be called after VCPU initialization. */ void kvmclock_create(void) @@ -339,9 +340,4 @@ void kvmclock_create(void) } } -static void kvmclock_register_types(void) -{ - type_register_static(&kvmclock_info); -} -type_init(kvmclock_register_types) diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index 876f5aa6fa..0f3d10d123 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -332,10 +332,6 @@ static const TypeInfo kvm_pit_info = { .class_init = kvm_pit_class_init, .class_size = sizeof(KVMPITClass), }; +TYPE_INFO(kvm_pit_info) -static void kvm_pit_register(void) -{ - type_register_static(&kvm_pit_info); -} -type_init(kvm_pit_register) diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c index e404fdcdac..f7844260d5 100644 --- a/hw/i386/kvm/i8259.c +++ b/hw/i386/kvm/i8259.c @@ -158,10 +158,6 @@ static const TypeInfo kvm_i8259_info = { .class_init = kvm_i8259_class_init, .class_size = sizeof(KVMPICClass), }; +TYPE_INFO(kvm_i8259_info) -static void kvm_pic_register_types(void) -{ - type_register_static(&kvm_i8259_info); -} -type_init(kvm_pic_register_types) diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c index 4ba8e47251..751cc5b6e0 100644 --- a/hw/i386/kvm/ioapic.c +++ b/hw/i386/kvm/ioapic.c @@ -158,10 +158,6 @@ static const TypeInfo kvm_ioapic_info = { .instance_size = sizeof(KVMIOAPICState), .class_init = kvm_ioapic_class_init, }; +TYPE_INFO(kvm_ioapic_info) -static void kvm_ioapic_register_types(void) -{ - type_register_static(&kvm_ioapic_info); -} -type_init(kvm_ioapic_register_types) diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index 51639202c2..a08519ee70 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -863,10 +863,6 @@ static const TypeInfo vapic_type = { .instance_size = sizeof(VAPICROMState), .class_init = vapic_class_init, }; +TYPE_INFO(vapic_type) -static void vapic_register(void) -{ - type_register_static(&vapic_type); -} -type_init(vapic_register); diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 81d0888930..a332e9b9e1 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -527,9 +527,5 @@ static const TypeInfo microvm_machine_info = { { } }, }; +TYPE_INFO(microvm_machine_info) -static void microvm_machine_init(void) -{ - type_register_static(µvm_machine_info); -} -type_init(microvm_machine_init); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 47c5ca3e34..e67ed86091 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2018,10 +2018,6 @@ static const TypeInfo pc_machine_info = { { } }, }; +TYPE_INFO(pc_machine_info) -static void pc_machine_register_types(void) -{ - type_register_static(&pc_machine_info); -} -type_init(pc_machine_register_types) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index b789e83f9a..a79ab9aa38 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -906,12 +906,8 @@ static TypeInfo isa_bridge_info = { { }, }, }; +TYPE_INFO(isa_bridge_info) -static void pt_graphics_register_types(void) -{ - type_register_static(&isa_bridge_info); -} -type_init(pt_graphics_register_types) void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id) { diff --git a/hw/i386/port92.c b/hw/i386/port92.c index 19866c44ef..cc41fb034f 100644 --- a/hw/i386/port92.c +++ b/hw/i386/port92.c @@ -117,10 +117,6 @@ static const TypeInfo port92_info = { .instance_init = port92_initfn, .class_init = port92_class_initfn, }; +TYPE_INFO(port92_info) -static void port92_register_types(void) -{ - type_register_static(&port92_info); -} -type_init(port92_register_types) diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c index ba5c987bd2..cea1924e69 100644 --- a/hw/i386/vmmouse.c +++ b/hw/i386/vmmouse.c @@ -316,10 +316,6 @@ static const TypeInfo vmmouse_info = { .instance_size = sizeof(VMMouseState), .class_init = vmmouse_class_initfn, }; +TYPE_INFO(vmmouse_info) -static void vmmouse_register_types(void) -{ - type_register_static(&vmmouse_info); -} -type_init(vmmouse_register_types) diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c index 89bda9108e..6379e14401 100644 --- a/hw/i386/vmport.c +++ b/hw/i386/vmport.c @@ -303,10 +303,6 @@ static const TypeInfo vmport_info = { .instance_size = sizeof(VMPortState), .class_init = vmport_class_initfn, }; +TYPE_INFO(vmport_info) -static void vmport_register_types(void) -{ - type_register_static(&vmport_info); -} -type_init(vmport_register_types) diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c index 4104060e68..ab1d4fb9e4 100644 --- a/hw/i386/x86-iommu.c +++ b/hw/i386/x86-iommu.c @@ -169,10 +169,6 @@ static const TypeInfo x86_iommu_info = { .class_size = sizeof(X86IOMMUClass), .abstract = true, }; +TYPE_INFO(x86_iommu_info) -static void x86_iommu_register_types(void) -{ - type_register_static(&x86_iommu_info); -} -type_init(x86_iommu_register_types) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 67bee1bcb8..cf77c1e4bb 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -965,10 +965,6 @@ static const TypeInfo x86_machine_info = { { } }, }; +TYPE_INFO(x86_machine_info) -static void x86_machine_register_types(void) -{ - type_register_static(&x86_machine_info); -} -type_init(x86_machine_register_types) diff --git a/hw/i386/xen/xen_apic.c b/hw/i386/xen/xen_apic.c index 7c7a60b166..9578463a48 100644 --- a/hw/i386/xen/xen_apic.c +++ b/hw/i386/xen/xen_apic.c @@ -94,10 +94,6 @@ static const TypeInfo xen_apic_info = { .instance_size = sizeof(APICCommonState), .class_init = xen_apic_class_init, }; +TYPE_INFO(xen_apic_info) -static void xen_apic_register_types(void) -{ - type_register_static(&xen_apic_info); -} -type_init(xen_apic_register_types) diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c index a1492fdecd..93de73323b 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -523,10 +523,6 @@ static const TypeInfo xen_platform_info = { { }, }, }; +TYPE_INFO(xen_platform_info) -static void xen_platform_register_types(void) -{ - type_register_static(&xen_platform_info); -} -type_init(xen_platform_register_types) diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c index ee2610c7a0..d62d26e0b6 100644 --- a/hw/i386/xen/xen_pvdevice.c +++ b/hw/i386/xen/xen_pvdevice.c @@ -145,10 +145,6 @@ static const TypeInfo xen_pv_type_info = { { }, }, }; +TYPE_INFO(xen_pv_type_info) -static void xen_pv_register_types(void) -{ - type_register_static(&xen_pv_type_info); -} -type_init(xen_pv_register_types) diff --git a/hw/ide/ahci-allwinner.c b/hw/ide/ahci-allwinner.c index 8536b9eb5a..b0aafa2b99 100644 --- a/hw/ide/ahci-allwinner.c +++ b/hw/ide/ahci-allwinner.c @@ -121,10 +121,6 @@ static const TypeInfo allwinner_ahci_info = { .instance_init = allwinner_ahci_init, .class_init = allwinner_ahci_class_init, }; +TYPE_INFO(allwinner_ahci_info) -static void sysbus_ahci_register_types(void) -{ - type_register_static(&allwinner_ahci_info); -} -type_init(sysbus_ahci_register_types) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 009120f88b..299a9bba56 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1808,13 +1808,9 @@ static const TypeInfo sysbus_ahci_info = { .instance_init = sysbus_ahci_init, .class_init = sysbus_ahci_class_init, }; +TYPE_INFO(sysbus_ahci_info) -static void sysbus_ahci_register_types(void) -{ - type_register_static(&sysbus_ahci_info); -} -type_init(sysbus_ahci_register_types) int32_t ahci_get_num_ports(PCIDevice *dev) { diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index c254631485..390a3dc679 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -342,10 +342,6 @@ static const TypeInfo cmd646_ide_info = { .parent = TYPE_PCI_IDE, .class_init = cmd646_ide_class_init, }; +TYPE_INFO(cmd646_ide_info) -static void cmd646_ide_register_types(void) -{ - type_register_static(&cmd646_ide_info); -} -type_init(cmd646_ide_register_types) diff --git a/hw/ide/ich.c b/hw/ide/ich.c index eff3188fff..f7fb430a3c 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -188,10 +188,6 @@ static const TypeInfo ich_ahci_info = { { }, }, }; +TYPE_INFO(ich_ahci_info) -static void ich_ahci_register_types(void) -{ - type_register_static(&ich_ahci_info); -} -type_init(ich_ahci_register_types) diff --git a/hw/ide/isa.c b/hw/ide/isa.c index f28c8fba6c..f63166f31d 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -128,10 +128,6 @@ static const TypeInfo isa_ide_info = { .instance_size = sizeof(ISAIDEState), .class_init = isa_ide_class_initfn, }; +TYPE_INFO(isa_ide_info) -static void isa_ide_register_types(void) -{ - type_register_static(&isa_ide_info); -} -type_init(isa_ide_register_types) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 62a599a075..4e74dafa03 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -486,11 +486,8 @@ static const TypeInfo macio_ide_type_info = { .instance_init = macio_ide_initfn, .class_init = macio_ide_class_init, }; +TYPE_INFO(macio_ide_type_info) -static void macio_ide_register_types(void) -{ - type_register_static(&macio_ide_type_info); -} /* hd_table must contain 2 block drivers */ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo **hd_table) @@ -510,4 +507,3 @@ void macio_ide_register_dma(MACIOIDEState *s) pmac_ide_transfer, pmac_ide_flush, s); } -type_init(macio_ide_register_types) diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index c4cc0a84eb..97483e5836 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -592,6 +592,7 @@ static const TypeInfo dscm1xxxx_type_info = { .parent = TYPE_MICRODRIVE, .class_init = dscm1xxxx_class_init, }; +TYPE_INFO(dscm1xxxx_type_info) static void microdrive_realize(DeviceState *dev, Error **errp) { @@ -632,11 +633,6 @@ static const TypeInfo microdrive_type_info = { .abstract = true, .class_init = microdrive_class_init, }; +TYPE_INFO(microdrive_type_info) -static void microdrive_register_types(void) -{ - type_register_static(µdrive_type_info); - type_register_static(&dscm1xxxx_type_info); -} -type_init(microdrive_register_types) diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c index d233bd8c01..83f0d4a583 100644 --- a/hw/ide/mmio.c +++ b/hw/ide/mmio.c @@ -165,11 +165,8 @@ static const TypeInfo mmio_ide_type_info = { .instance_init = mmio_ide_initfn, .class_init = mmio_ide_class_init, }; +TYPE_INFO(mmio_ide_type_info) -static void mmio_ide_register_types(void) -{ - type_register_static(&mmio_ide_type_info); -} void mmio_ide_init_drives(DeviceState *dev, DriveInfo *hd0, DriveInfo *hd1) { @@ -183,4 +180,3 @@ void mmio_ide_init_drives(DeviceState *dev, DriveInfo *hd0, DriveInfo *hd1) } } -type_init(mmio_ide_register_types) diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 5e85c4ad17..7b20224754 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -525,10 +525,6 @@ static const TypeInfo pci_ide_type_info = { { }, }, }; +TYPE_INFO(pci_ide_type_info) -static void pci_ide_register_types(void) -{ - type_register_static(&pci_ide_type_info); -} -type_init(pci_ide_register_types) diff --git a/hw/ide/piix.c b/hw/ide/piix.c index b402a93636..804c241c1f 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -229,12 +229,14 @@ static const TypeInfo piix3_ide_info = { .parent = TYPE_PCI_IDE, .class_init = piix3_ide_class_init, }; +TYPE_INFO(piix3_ide_info) static const TypeInfo piix3_ide_xen_info = { .name = "piix3-ide-xen", .parent = TYPE_PCI_IDE, .class_init = piix3_ide_class_init, }; +TYPE_INFO(piix3_ide_xen_info) /* NOTE: for the PIIX4, the IRQs and IOports are hardcoded */ static void piix4_ide_class_init(ObjectClass *klass, void *data) @@ -257,12 +259,6 @@ static const TypeInfo piix4_ide_info = { .parent = TYPE_PCI_IDE, .class_init = piix4_ide_class_init, }; +TYPE_INFO(piix4_ide_info) -static void piix_ide_register_types(void) -{ - type_register_static(&piix3_ide_info); - type_register_static(&piix3_ide_xen_info); - type_register_static(&piix4_ide_info); -} -type_init(piix_ide_register_types) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 27ff1f7f66..4e03200438 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -66,6 +66,7 @@ static const TypeInfo ide_bus_info = { .instance_size = sizeof(IDEBus), .class_init = ide_bus_class_init, }; +TYPE_INFO(ide_bus_info) void ide_bus_new(IDEBus *idebus, size_t idebus_size, DeviceState *dev, int bus_id, int max_units) @@ -330,6 +331,7 @@ static const TypeInfo ide_hd_info = { .instance_size = sizeof(IDEDrive), .class_init = ide_hd_class_init, }; +TYPE_INFO(ide_hd_info) static Property ide_cd_properties[] = { DEFINE_IDE_DEV_PROPERTIES(), @@ -353,6 +355,7 @@ static const TypeInfo ide_cd_info = { .instance_size = sizeof(IDEDrive), .class_init = ide_cd_class_init, }; +TYPE_INFO(ide_cd_info) static Property ide_drive_properties[] = { DEFINE_IDE_DEV_PROPERTIES(), @@ -376,6 +379,7 @@ static const TypeInfo ide_drive_info = { .instance_size = sizeof(IDEDrive), .class_init = ide_drive_class_init, }; +TYPE_INFO(ide_drive_info) static void ide_device_class_init(ObjectClass *klass, void *data) { @@ -395,14 +399,6 @@ static const TypeInfo ide_device_type_info = { .class_init = ide_device_class_init, .instance_init = ide_dev_instance_init, }; +TYPE_INFO(ide_device_type_info) -static void ide_register_types(void) -{ - type_register_static(&ide_bus_info); - type_register_static(&ide_hd_info); - type_register_static(&ide_cd_info); - type_register_static(&ide_drive_info); - type_register_static(&ide_device_type_info); -} -type_init(ide_register_types) diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c index 94d2b57f95..68279530fd 100644 --- a/hw/ide/sii3112.c +++ b/hw/ide/sii3112.c @@ -313,10 +313,6 @@ static const TypeInfo sii3112_pci_info = { .instance_size = sizeof(SiI3112PCIState), .class_init = sii3112_pci_class_init, }; +TYPE_INFO(sii3112_pci_info) -static void sii3112_register_types(void) -{ - type_register_static(&sii3112_pci_info); -} -type_init(sii3112_register_types) diff --git a/hw/ide/via.c b/hw/ide/via.c index be09912b33..00a995acd7 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -231,10 +231,6 @@ static const TypeInfo via_ide_info = { .parent = TYPE_PCI_IDE, .class_init = via_ide_class_init, }; +TYPE_INFO(via_ide_info) -static void via_ide_register_types(void) -{ - type_register_static(&via_ide_info); -} -type_init(via_ide_register_types) diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c index 3cfb6a7a20..4f0f546581 100644 --- a/hw/input/adb-kbd.c +++ b/hw/input/adb-kbd.c @@ -402,10 +402,6 @@ static const TypeInfo adb_kbd_type_info = { .class_init = adb_kbd_class_init, .class_size = sizeof(ADBKeyboardClass), }; +TYPE_INFO(adb_kbd_type_info) -static void adb_kbd_register_types(void) -{ - type_register_static(&adb_kbd_type_info); -} -type_init(adb_kbd_register_types) diff --git a/hw/input/adb-mouse.c b/hw/input/adb-mouse.c index 577a38ff2e..c0c8dead39 100644 --- a/hw/input/adb-mouse.c +++ b/hw/input/adb-mouse.c @@ -273,10 +273,6 @@ static const TypeInfo adb_mouse_type_info = { .class_init = adb_mouse_class_init, .class_size = sizeof(ADBMouseClass), }; +TYPE_INFO(adb_mouse_type_info) -static void adb_mouse_register_types(void) -{ - type_register_static(&adb_mouse_type_info); -} -type_init(adb_mouse_register_types) diff --git a/hw/input/adb.c b/hw/input/adb.c index 013fcc9c54..3afbe59217 100644 --- a/hw/input/adb.c +++ b/hw/input/adb.c @@ -274,6 +274,7 @@ static const TypeInfo adb_bus_type_info = { .instance_size = sizeof(ADBBusState), .class_init = adb_bus_class_init, }; +TYPE_INFO(adb_bus_type_info) const VMStateDescription vmstate_adb_device = { .name = "adb_device", @@ -313,11 +314,6 @@ static const TypeInfo adb_device_type_info = { .abstract = true, .class_init = adb_device_class_init, }; +TYPE_INFO(adb_device_type_info) -static void adb_register_types(void) -{ - type_register_static(&adb_bus_type_info); - type_register_static(&adb_device_type_info); -} -type_init(adb_register_types) diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c index aa629ddbf1..ffe68b081a 100644 --- a/hw/input/lm832x.c +++ b/hw/input/lm832x.c @@ -518,10 +518,6 @@ static const TypeInfo lm8323_info = { .instance_size = sizeof(LM823KbdState), .class_init = lm8323_class_init, }; +TYPE_INFO(lm8323_info) -static void lm832x_register_types(void) -{ - type_register_static(&lm8323_info); -} -type_init(lm832x_register_types) diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c index 3e0a7eb0bd..73ee7edbd0 100644 --- a/hw/input/milkymist-softusb.c +++ b/hw/input/milkymist-softusb.c @@ -311,10 +311,6 @@ static const TypeInfo milkymist_softusb_info = { .instance_size = sizeof(MilkymistSoftUsbState), .class_init = milkymist_softusb_class_init, }; +TYPE_INFO(milkymist_softusb_info) -static void milkymist_softusb_register_types(void) -{ - type_register_static(&milkymist_softusb_info); -} -type_init(milkymist_softusb_register_types) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 29d633ca94..5b186cc3d0 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -608,10 +608,6 @@ static const TypeInfo i8042_info = { .instance_init = i8042_initfn, .class_init = i8042_class_initfn, }; +TYPE_INFO(i8042_info) -static void i8042_register_types(void) -{ - type_register_static(&i8042_info); -} -type_init(i8042_register_types) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 1123037b38..b018e708a6 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -176,12 +176,14 @@ static const TypeInfo pl050_kbd_info = { .parent = TYPE_PL050, .instance_init = pl050_keyboard_init, }; +TYPE_INFO(pl050_kbd_info) static const TypeInfo pl050_mouse_info = { .name = "pl050_mouse", .parent = TYPE_PL050, .instance_init = pl050_mouse_init, }; +TYPE_INFO(pl050_mouse_info) static void pl050_class_init(ObjectClass *oc, void *data) { @@ -198,12 +200,6 @@ static const TypeInfo pl050_type_info = { .abstract = true, .class_init = pl050_class_init, }; +TYPE_INFO(pl050_type_info) -static void pl050_register_types(void) -{ - type_register_static(&pl050_type_info); - type_register_static(&pl050_kbd_info); - type_register_static(&pl050_mouse_info); -} -type_init(pl050_register_types) diff --git a/hw/input/vhost-user-input.c b/hw/input/vhost-user-input.c index 63984a8ba7..32318bf1ca 100644 --- a/hw/input/vhost-user-input.c +++ b/hw/input/vhost-user-input.c @@ -119,10 +119,6 @@ static const TypeInfo vhost_input_info = { .instance_finalize = vhost_input_finalize, .class_init = vhost_input_class_init, }; +TYPE_INFO(vhost_input_info) -static void vhost_input_register_types(void) -{ - type_register_static(&vhost_input_info); -} -type_init(vhost_input_register_types) diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c index a7a244a95d..70e27e2c64 100644 --- a/hw/input/virtio-input-hid.c +++ b/hw/input/virtio-input-hid.c @@ -235,6 +235,7 @@ static const TypeInfo virtio_input_hid_info = { .class_init = virtio_input_hid_class_init, .abstract = true, }; +TYPE_INFO(virtio_input_hid_info) /* ----------------------------------------------------------------- */ @@ -291,6 +292,7 @@ static const TypeInfo virtio_keyboard_info = { .instance_size = sizeof(VirtIOInputHID), .instance_init = virtio_keyboard_init, }; +TYPE_INFO(virtio_keyboard_info) /* ----------------------------------------------------------------- */ @@ -384,6 +386,7 @@ static const TypeInfo virtio_mouse_info = { .instance_init = virtio_mouse_init, .class_init = virtio_mouse_class_init, }; +TYPE_INFO(virtio_mouse_info) /* ----------------------------------------------------------------- */ @@ -508,15 +511,8 @@ static const TypeInfo virtio_tablet_info = { .instance_init = virtio_tablet_init, .class_init = virtio_tablet_class_init, }; +TYPE_INFO(virtio_tablet_info) /* ----------------------------------------------------------------- */ -static void virtio_register_types(void) -{ - type_register_static(&virtio_input_hid_info); - type_register_static(&virtio_keyboard_info); - type_register_static(&virtio_mouse_info); - type_register_static(&virtio_tablet_info); -} -type_init(virtio_register_types) diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c index 85daf73f1a..aa4d17a903 100644 --- a/hw/input/virtio-input-host.c +++ b/hw/input/virtio-input-host.c @@ -246,12 +246,8 @@ static const TypeInfo virtio_input_host_info = { .instance_init = virtio_input_host_init, .class_init = virtio_input_host_class_init, }; +TYPE_INFO(virtio_input_host_info) /* ----------------------------------------------------------------- */ -static void virtio_register_types(void) -{ - type_register_static(&virtio_input_host_info); -} -type_init(virtio_register_types) diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c index 54bcb46c74..044d1599e4 100644 --- a/hw/input/virtio-input.c +++ b/hw/input/virtio-input.c @@ -332,12 +332,8 @@ static const TypeInfo virtio_input_info = { .abstract = true, .instance_finalize = virtio_input_finalize, }; +TYPE_INFO(virtio_input_info) /* ----------------------------------------------------------------- */ -static void virtio_register_types(void) -{ - type_register_static(&virtio_input_info); -} -type_init(virtio_register_types) diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c index 8cca124807..63ad2de08f 100644 --- a/hw/intc/allwinner-a10-pic.c +++ b/hw/intc/allwinner-a10-pic.c @@ -206,10 +206,6 @@ static const TypeInfo aw_a10_pic_info = { .instance_init = aw_a10_pic_init, .class_init = aw_a10_pic_class_init, }; +TYPE_INFO(aw_a10_pic_info) -static void aw_a10_register_types(void) -{ - type_register_static(&aw_a10_pic_info); -} -type_init(aw_a10_register_types); diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 38aabd60cd..770e14fc3e 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -913,10 +913,6 @@ static const TypeInfo apic_info = { .parent = TYPE_APIC_COMMON, .class_init = apic_class_init, }; +TYPE_INFO(apic_info) -static void apic_register_types(void) -{ - type_register_static(&apic_info); -} -type_init(apic_register_types) diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 81addd6390..a4851ba64a 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -488,10 +488,6 @@ static const TypeInfo apic_common_type = { .class_init = apic_common_class_init, .abstract = true, }; +TYPE_INFO(apic_common_type) -static void apic_common_register_types(void) -{ - type_register_static(&apic_common_type); -} -type_init(apic_common_register_types) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index c60dc6b5e6..cf16727da2 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -2134,10 +2134,6 @@ static const TypeInfo arm_gic_info = { .class_init = arm_gic_class_init, .class_size = sizeof(ARMGICClass), }; +TYPE_INFO(arm_gic_info) -static void arm_gic_register_types(void) -{ - type_register_static(&arm_gic_info); -} -type_init(arm_gic_register_types) diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index 7b44d5625b..fef492f476 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -385,10 +385,6 @@ static const TypeInfo arm_gic_common_type = { { }, }, }; +TYPE_INFO(arm_gic_common_type) -static void register_types(void) -{ - type_register_static(&arm_gic_common_type); -} -type_init(register_types) diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c index 07b95143c9..b0379ea4c5 100644 --- a/hw/intc/arm_gic_kvm.c +++ b/hw/intc/arm_gic_kvm.c @@ -613,10 +613,6 @@ static const TypeInfo kvm_arm_gic_info = { .class_init = kvm_arm_gic_class_init, .class_size = sizeof(KVMARMGICClass), }; +TYPE_INFO(kvm_arm_gic_info) -static void kvm_arm_gic_register_types(void) -{ - type_register_static(&kvm_arm_gic_info); -} -type_init(kvm_arm_gic_register_types) diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c index 0b7e2b4f84..d129a8c9f1 100644 --- a/hw/intc/arm_gicv2m.c +++ b/hw/intc/arm_gicv2m.c @@ -190,10 +190,6 @@ static const TypeInfo gicv2m_info = { .instance_init = gicv2m_init, .class_init = gicv2m_class_init, }; +TYPE_INFO(gicv2m_info) -static void gicv2m_register_types(void) -{ - type_register_static(&gicv2m_info); -} -type_init(gicv2m_register_types) diff --git a/hw/intc/arm_gicv3.c b/hw/intc/arm_gicv3.c index 66eaa97198..17f169087d 100644 --- a/hw/intc/arm_gicv3.c +++ b/hw/intc/arm_gicv3.c @@ -406,10 +406,6 @@ static const TypeInfo arm_gicv3_info = { .class_init = arm_gicv3_class_init, .class_size = sizeof(ARMGICv3Class), }; +TYPE_INFO(arm_gicv3_info) -static void arm_gicv3_register_types(void) -{ - type_register_static(&arm_gicv3_info); -} -type_init(arm_gicv3_register_types) diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 58ef65f589..3cb906125a 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -525,10 +525,6 @@ static const TypeInfo arm_gicv3_common_type = { { }, }, }; +TYPE_INFO(arm_gicv3_common_type) -static void register_types(void) -{ - type_register_static(&arm_gicv3_common_type); -} -type_init(register_types) diff --git a/hw/intc/arm_gicv3_its_common.c b/hw/intc/arm_gicv3_its_common.c index 66c4c6a188..05e385222d 100644 --- a/hw/intc/arm_gicv3_its_common.c +++ b/hw/intc/arm_gicv3_its_common.c @@ -149,10 +149,6 @@ static const TypeInfo gicv3_its_common_info = { .class_init = gicv3_its_common_class_init, .abstract = true, }; +TYPE_INFO(gicv3_its_common_info) -static void gicv3_its_common_register_types(void) -{ - type_register_static(&gicv3_its_common_info); -} -type_init(gicv3_its_common_register_types) diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c index 46835ed085..ddd3a5a665 100644 --- a/hw/intc/arm_gicv3_its_kvm.c +++ b/hw/intc/arm_gicv3_its_kvm.c @@ -257,10 +257,6 @@ static const TypeInfo kvm_arm_its_info = { .class_init = kvm_arm_its_class_init, .class_size = sizeof(KVMARMITSClass), }; +TYPE_INFO(kvm_arm_its_info) -static void kvm_arm_its_register_types(void) -{ - type_register_static(&kvm_arm_its_info); -} -type_init(kvm_arm_its_register_types) diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index eddd07c743..30d09d307e 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -889,10 +889,6 @@ static const TypeInfo kvm_arm_gicv3_info = { .class_init = kvm_arm_gicv3_class_init, .class_size = sizeof(KVMARMGICv3Class), }; +TYPE_INFO(kvm_arm_gicv3_info) -static void kvm_arm_gicv3_register_types(void) -{ - type_register_static(&kvm_arm_gicv3_info); -} -type_init(kvm_arm_gicv3_register_types) diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 277a98b87b..819a77ceb4 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -2775,10 +2775,6 @@ static const TypeInfo armv7m_nvic_info = { .class_init = armv7m_nvic_class_init, .class_size = sizeof(SysBusDeviceClass), }; +TYPE_INFO(armv7m_nvic_info) -static void armv7m_nvic_register_types(void) -{ - type_register_static(&armv7m_nvic_info); -} -type_init(armv7m_nvic_register_types) diff --git a/hw/intc/aspeed_vic.c b/hw/intc/aspeed_vic.c index 5ba06c5262..e60d23bc34 100644 --- a/hw/intc/aspeed_vic.c +++ b/hw/intc/aspeed_vic.c @@ -354,10 +354,6 @@ static const TypeInfo aspeed_vic_info = { .instance_size = sizeof(AspeedVICState), .class_init = aspeed_vic_class_init, }; +TYPE_INFO(aspeed_vic_info) -static void aspeed_vic_register_types(void) -{ - type_register_static(&aspeed_vic_info); -} -type_init(aspeed_vic_register_types); diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c index 53ab8f5881..4a0b62a356 100644 --- a/hw/intc/bcm2835_ic.c +++ b/hw/intc/bcm2835_ic.c @@ -232,10 +232,6 @@ static TypeInfo bcm2835_ic_info = { .class_init = bcm2835_ic_class_init, .instance_init = bcm2835_ic_init, }; +TYPE_INFO(bcm2835_ic_info) -static void bcm2835_ic_register_types(void) -{ - type_register_static(&bcm2835_ic_info); -} -type_init(bcm2835_ic_register_types) diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c index 53dba0080c..7c9568f5ff 100644 --- a/hw/intc/bcm2836_control.c +++ b/hw/intc/bcm2836_control.c @@ -399,10 +399,6 @@ static TypeInfo bcm2836_control_info = { .class_init = bcm2836_control_class_init, .instance_init = bcm2836_control_init, }; +TYPE_INFO(bcm2836_control_info) -static void bcm2836_control_register_types(void) -{ - type_register_static(&bcm2836_control_info); -} -type_init(bcm2836_control_register_types) diff --git a/hw/intc/etraxfs_pic.c b/hw/intc/etraxfs_pic.c index 12988c7aa9..d77d65ed38 100644 --- a/hw/intc/etraxfs_pic.c +++ b/hw/intc/etraxfs_pic.c @@ -162,10 +162,6 @@ static const TypeInfo etraxfs_pic_info = { .instance_size = sizeof(struct etrax_pic), .instance_init = etraxfs_pic_init, }; +TYPE_INFO(etraxfs_pic_info) -static void etraxfs_pic_register_types(void) -{ - type_register_static(&etraxfs_pic_info); -} -type_init(etraxfs_pic_register_types) diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c index b8561e4180..d0365915af 100644 --- a/hw/intc/exynos4210_combiner.c +++ b/hw/intc/exynos4210_combiner.c @@ -453,10 +453,6 @@ static const TypeInfo exynos4210_combiner_info = { .instance_init = exynos4210_combiner_init, .class_init = exynos4210_combiner_class_init, }; +TYPE_INFO(exynos4210_combiner_info) -static void exynos4210_combiner_register_types(void) -{ - type_register_static(&exynos4210_combiner_info); -} -type_init(exynos4210_combiner_register_types) diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index 0aa3b843a9..a01ab137eb 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -366,13 +366,9 @@ static const TypeInfo exynos4210_gic_info = { .instance_size = sizeof(Exynos4210GicState), .class_init = exynos4210_gic_class_init, }; +TYPE_INFO(exynos4210_gic_info) -static void exynos4210_gic_register_types(void) -{ - type_register_static(&exynos4210_gic_info); -} -type_init(exynos4210_gic_register_types) /* IRQ OR Gate struct. * @@ -474,10 +470,6 @@ static const TypeInfo exynos4210_irq_gate_info = { .instance_init = exynos4210_irq_gate_init, .class_init = exynos4210_irq_gate_class_init, }; +TYPE_INFO(exynos4210_irq_gate_info) -static void exynos4210_irq_gate_register_types(void) -{ - type_register_static(&exynos4210_irq_gate_info); -} -type_init(exynos4210_irq_gate_register_types) diff --git a/hw/intc/grlib_irqmp.c b/hw/intc/grlib_irqmp.c index 794c643af2..1a3c846cee 100644 --- a/hw/intc/grlib_irqmp.c +++ b/hw/intc/grlib_irqmp.c @@ -350,10 +350,6 @@ static const TypeInfo grlib_irqmp_info = { .instance_init = grlib_irqmp_init, .class_init = grlib_irqmp_class_init, }; +TYPE_INFO(grlib_irqmp_info) -static void grlib_irqmp_register_types(void) -{ - type_register_static(&grlib_irqmp_info); -} -type_init(grlib_irqmp_register_types) diff --git a/hw/intc/heathrow_pic.c b/hw/intc/heathrow_pic.c index cb97c315da..8faa8a5582 100644 --- a/hw/intc/heathrow_pic.c +++ b/hw/intc/heathrow_pic.c @@ -201,10 +201,6 @@ static const TypeInfo heathrow_type_info = { .instance_init = heathrow_init, .class_init = heathrow_class_init, }; +TYPE_INFO(heathrow_type_info) -static void heathrow_register_types(void) -{ - type_register_static(&heathrow_type_info); -} -type_init(heathrow_register_types) diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index 51b27f6a34..a213683f44 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -455,10 +455,6 @@ static const TypeInfo i8259_info = { .class_init = i8259_class_init, .class_size = sizeof(PICClass), }; +TYPE_INFO(i8259_info) -static void pic_register_types(void) -{ - type_register_static(&i8259_info); -} -type_init(pic_register_types) diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c index d90b40fe4c..a859ec4783 100644 --- a/hw/intc/i8259_common.c +++ b/hw/intc/i8259_common.c @@ -210,10 +210,6 @@ static const TypeInfo pic_common_type = { { } }, }; +TYPE_INFO(pic_common_type) -static void pic_common_register_types(void) -{ - type_register_static(&pic_common_type); -} -type_init(pic_common_register_types) diff --git a/hw/intc/ibex_plic.c b/hw/intc/ibex_plic.c index 41079518c6..381658d827 100644 --- a/hw/intc/ibex_plic.c +++ b/hw/intc/ibex_plic.c @@ -252,10 +252,6 @@ static const TypeInfo ibex_plic_info = { .instance_init = ibex_plic_init, .class_init = ibex_plic_class_init, }; +TYPE_INFO(ibex_plic_info) -static void ibex_plic_register_types(void) -{ - type_register_static(&ibex_plic_info); -} -type_init(ibex_plic_register_types) diff --git a/hw/intc/imx_avic.c b/hw/intc/imx_avic.c index 63fc602a1a..805da5e2f2 100644 --- a/hw/intc/imx_avic.c +++ b/hw/intc/imx_avic.c @@ -357,10 +357,6 @@ static const TypeInfo imx_avic_info = { .instance_init = imx_avic_init, .class_init = imx_avic_class_init, }; +TYPE_INFO(imx_avic_info) -static void imx_avic_register_types(void) -{ - type_register_static(&imx_avic_info); -} -type_init(imx_avic_register_types) diff --git a/hw/intc/imx_gpcv2.c b/hw/intc/imx_gpcv2.c index 17007a4078..b04fa35211 100644 --- a/hw/intc/imx_gpcv2.c +++ b/hw/intc/imx_gpcv2.c @@ -119,9 +119,5 @@ static const TypeInfo imx_gpcv2_info = { .instance_init = imx_gpcv2_init, .class_init = imx_gpcv2_class_init, }; +TYPE_INFO(imx_gpcv2_info) -static void imx_gpcv2_register_type(void) -{ - type_register_static(&imx_gpcv2_info); -} -type_init(imx_gpcv2_register_type) diff --git a/hw/intc/intc.c b/hw/intc/intc.c index 2e1e29e753..c526f90672 100644 --- a/hw/intc/intc.c +++ b/hw/intc/intc.c @@ -31,11 +31,7 @@ static const TypeInfo intctrl_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(InterruptStatsProviderClass), }; +TYPE_INFO(intctrl_info) -static void intc_register_types(void) -{ - type_register_static(&intctrl_info); -} -type_init(intc_register_types) diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index bca71b5934..4e865aac74 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -505,10 +505,6 @@ static const TypeInfo ioapic_info = { .instance_size = sizeof(IOAPICCommonState), .class_init = ioapic_class_init, }; +TYPE_INFO(ioapic_info) -static void ioapic_register_types(void) -{ - type_register_static(&ioapic_info); -} -type_init(ioapic_register_types) diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c index 5538b5b86e..98a20fddf7 100644 --- a/hw/intc/ioapic_common.c +++ b/hw/intc/ioapic_common.c @@ -215,10 +215,6 @@ static const TypeInfo ioapic_common_type = { { } }, }; +TYPE_INFO(ioapic_common_type) -static void ioapic_common_register_types(void) -{ - type_register_static(&ioapic_common_type); -} -type_init(ioapic_common_register_types) diff --git a/hw/intc/lm32_pic.c b/hw/intc/lm32_pic.c index 36de670c9e..2f609dc93f 100644 --- a/hw/intc/lm32_pic.c +++ b/hw/intc/lm32_pic.c @@ -186,10 +186,6 @@ static const TypeInfo lm32_pic_info = { { } }, }; +TYPE_INFO(lm32_pic_info) -static void lm32_pic_register_types(void) -{ - type_register_static(&lm32_pic_info); -} -type_init(lm32_pic_register_types) diff --git a/hw/intc/loongson_liointc.c b/hw/intc/loongson_liointc.c index 23ca51cc2e..10e4c7278b 100644 --- a/hw/intc/loongson_liointc.c +++ b/hw/intc/loongson_liointc.c @@ -233,10 +233,6 @@ static const TypeInfo loongson_liointc_info = { .instance_size = sizeof(struct loongson_liointc), .instance_init = loongson_liointc_init, }; +TYPE_INFO(loongson_liointc_info) -static void loongson_liointc_register_types(void) -{ - type_register_static(&loongson_liointc_info); -} -type_init(loongson_liointc_register_types) diff --git a/hw/intc/mips_gic.c b/hw/intc/mips_gic.c index bda4549925..1d2efed60a 100644 --- a/hw/intc/mips_gic.c +++ b/hw/intc/mips_gic.c @@ -459,10 +459,6 @@ static const TypeInfo mips_gic_info = { .instance_init = mips_gic_init, .class_init = mips_gic_class_init, }; +TYPE_INFO(mips_gic_info) -static void mips_gic_register_types(void) -{ - type_register_static(&mips_gic_info); -} -type_init(mips_gic_register_types) diff --git a/hw/intc/nios2_iic.c b/hw/intc/nios2_iic.c index 1a5df8c89a..43abcd95aa 100644 --- a/hw/intc/nios2_iic.c +++ b/hw/intc/nios2_iic.c @@ -86,10 +86,6 @@ static TypeInfo altera_iic_info = { .instance_init = altera_iic_init, .class_init = altera_iic_class_init, }; +TYPE_INFO(altera_iic_info) -static void altera_iic_register(void) -{ - type_register_static(&altera_iic_info); -} -type_init(altera_iic_register) diff --git a/hw/intc/omap_intc.c b/hw/intc/omap_intc.c index b8a1d1fd7d..6f6a490db9 100644 --- a/hw/intc/omap_intc.c +++ b/hw/intc/omap_intc.c @@ -419,6 +419,7 @@ static const TypeInfo omap_intc_info = { .instance_init = omap_intc_init, .class_init = omap_intc_class_init, }; +TYPE_INFO(omap_intc_info) static uint64_t omap2_inth_read(void *opaque, hwaddr addr, unsigned size) @@ -672,6 +673,7 @@ static const TypeInfo omap2_intc_info = { .instance_init = omap2_intc_init, .class_init = omap2_intc_class_init, }; +TYPE_INFO(omap2_intc_info) static const TypeInfo omap_intc_type_info = { .name = TYPE_OMAP_INTC, @@ -679,12 +681,6 @@ static const TypeInfo omap_intc_type_info = { .instance_size = sizeof(struct omap_intr_handler_s), .abstract = true, }; +TYPE_INFO(omap_intc_type_info) -static void omap_intc_register_types(void) -{ - type_register_static(&omap_intc_type_info); - type_register_static(&omap_intc_info); - type_register_static(&omap2_intc_info); -} -type_init(omap_intc_register_types) diff --git a/hw/intc/ompic.c b/hw/intc/ompic.c index c354427a61..d01b593cc4 100644 --- a/hw/intc/ompic.c +++ b/hw/intc/ompic.c @@ -173,10 +173,6 @@ static const TypeInfo or1k_ompic_info = { .instance_init = or1k_ompic_init, .class_init = or1k_ompic_class_init, }; +TYPE_INFO(or1k_ompic_info) -static void or1k_ompic_register_types(void) -{ - type_register_static(&or1k_ompic_info); -} -type_init(or1k_ompic_register_types) diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c index 65970e1b37..1d86d5b6b1 100644 --- a/hw/intc/openpic.c +++ b/hw/intc/openpic.c @@ -1641,10 +1641,6 @@ static const TypeInfo openpic_info = { .instance_init = openpic_init, .class_init = openpic_class_init, }; +TYPE_INFO(openpic_info) -static void openpic_register_types(void) -{ - type_register_static(&openpic_info); -} -type_init(openpic_register_types) diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c index e4bf47d885..f0add3e3ee 100644 --- a/hw/intc/openpic_kvm.c +++ b/hw/intc/openpic_kvm.c @@ -286,10 +286,6 @@ static const TypeInfo kvm_openpic_info = { .instance_init = kvm_openpic_init, .class_init = kvm_openpic_class_init, }; +TYPE_INFO(kvm_openpic_info) -static void kvm_openpic_register_types(void) -{ - type_register_static(&kvm_openpic_info); -} -type_init(kvm_openpic_register_types) diff --git a/hw/intc/pl190.c b/hw/intc/pl190.c index e3bd3dd121..5b237c0920 100644 --- a/hw/intc/pl190.c +++ b/hw/intc/pl190.c @@ -287,10 +287,6 @@ static const TypeInfo pl190_info = { .instance_init = pl190_init, .class_init = pl190_class_init, }; +TYPE_INFO(pl190_info) -static void pl190_register_types(void) -{ - type_register_static(&pl190_info); -} -type_init(pl190_register_types) diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index 5f69626b3a..e333c85162 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -1975,10 +1975,6 @@ static const TypeInfo pnv_xive_info = { { } } }; +TYPE_INFO(pnv_xive_info) -static void pnv_xive_register_types(void) -{ - type_register_static(&pnv_xive_info); -} -type_init(pnv_xive_register_types) diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c index 090d4839d1..3f43aea812 100644 --- a/hw/intc/puv3_intc.c +++ b/hw/intc/puv3_intc.c @@ -137,10 +137,6 @@ static const TypeInfo puv3_intc_info = { .instance_size = sizeof(PUV3INTCState), .class_init = puv3_intc_class_init, }; +TYPE_INFO(puv3_intc_info) -static void puv3_intc_register_type(void) -{ - type_register_static(&puv3_intc_info); -} -type_init(puv3_intc_register_type) diff --git a/hw/intc/realview_gic.c b/hw/intc/realview_gic.c index 9b12116b2a..e85422f40d 100644 --- a/hw/intc/realview_gic.c +++ b/hw/intc/realview_gic.c @@ -77,10 +77,6 @@ static const TypeInfo realview_gic_info = { .instance_init = realview_gic_init, .class_init = realview_gic_class_init, }; +TYPE_INFO(realview_gic_info) -static void realview_gic_register_types(void) -{ - type_register_static(&realview_gic_info); -} -type_init(realview_gic_register_types) diff --git a/hw/intc/rx_icu.c b/hw/intc/rx_icu.c index df4b6a8d22..2e47e6e099 100644 --- a/hw/intc/rx_icu.c +++ b/hw/intc/rx_icu.c @@ -388,10 +388,6 @@ static const TypeInfo rxicu_info = { .instance_finalize = rxicu_fini, .class_init = rxicu_class_init, }; +TYPE_INFO(rxicu_info) -static void rxicu_register_types(void) -{ - type_register_static(&rxicu_info); -} -type_init(rxicu_register_types) diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c index aacdb1bbc2..d9a51ddb2a 100644 --- a/hw/intc/s390_flic.c +++ b/hw/intc/s390_flic.c @@ -438,6 +438,7 @@ static const TypeInfo qemu_s390_flic_info = { .instance_init = qemu_s390_flic_instance_init, .class_init = qemu_s390_flic_class_init, }; +TYPE_INFO(qemu_s390_flic_info) static const TypeInfo s390_flic_common_info = { @@ -447,14 +448,9 @@ static const TypeInfo s390_flic_common_info = { .class_init = s390_flic_class_init, .class_size = sizeof(S390FLICStateClass), }; +TYPE_INFO(s390_flic_common_info) -static void qemu_s390_flic_register_types(void) -{ - type_register_static(&s390_flic_common_info); - type_register_static(&qemu_s390_flic_info); -} -type_init(qemu_s390_flic_register_types) static bool adapter_info_so_needed(void *opaque) { diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index dbd4e682ce..a48adef68d 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -672,10 +672,6 @@ static const TypeInfo kvm_s390_flic_info = { .class_size = sizeof(KVMS390FLICStateClass), .class_init = kvm_s390_flic_class_init, }; +TYPE_INFO(kvm_s390_flic_info) -static void kvm_s390_flic_register_types(void) -{ - type_register_static(&kvm_s390_flic_info); -} -type_init(kvm_s390_flic_register_types) diff --git a/hw/intc/slavio_intctl.c b/hw/intc/slavio_intctl.c index c4cf9096eb..65aea84cf3 100644 --- a/hw/intc/slavio_intctl.c +++ b/hw/intc/slavio_intctl.c @@ -466,10 +466,6 @@ static const TypeInfo slavio_intctl_info = { { } }, }; +TYPE_INFO(slavio_intctl_info) -static void slavio_intctl_register_types(void) -{ - type_register_static(&slavio_intctl_info); -} -type_init(slavio_intctl_register_types) diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 89c8cd9667..202783388c 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -802,13 +802,9 @@ static const TypeInfo spapr_xive_info = { { } }, }; +TYPE_INFO(spapr_xive_info) -static void spapr_xive_register_types(void) -{ - type_register_static(&spapr_xive_info); -} -type_init(spapr_xive_register_types) /* * XIVE hcalls diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 68f9d44feb..12cae926cc 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -373,6 +373,7 @@ static const TypeInfo icp_info = { .class_init = icp_class_init, .class_size = sizeof(ICPStateClass), }; +TYPE_INFO(icp_info) Object *icp_create(Object *cpu, const char *type, XICSFabric *xi, Error **errp) { @@ -707,12 +708,14 @@ static const TypeInfo ics_info = { .class_init = ics_class_init, .class_size = sizeof(ICSStateClass), }; +TYPE_INFO(ics_info) static const TypeInfo xics_fabric_info = { .name = TYPE_XICS_FABRIC, .parent = TYPE_INTERFACE, .class_size = sizeof(XICSFabricClass), }; +TYPE_INFO(xics_fabric_info) /* * Exported functions @@ -742,11 +745,4 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool lsi) } } -static void xics_register_types(void) -{ - type_register_static(&ics_info); - type_register_static(&icp_info); - type_register_static(&xics_fabric_info); -} -type_init(xics_register_types) diff --git a/hw/intc/xics_pnv.c b/hw/intc/xics_pnv.c index 35f3811264..dd7cb00a16 100644 --- a/hw/intc/xics_pnv.c +++ b/hw/intc/xics_pnv.c @@ -193,10 +193,6 @@ static const TypeInfo pnv_icp_info = { .class_init = pnv_icp_class_init, .class_size = sizeof(ICPStateClass), }; +TYPE_INFO(pnv_icp_info) -static void pnv_icp_register_types(void) -{ - type_register_static(&pnv_icp_info); -} -type_init(pnv_icp_register_types) diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c index 8ae4f41459..01a9481b9a 100644 --- a/hw/intc/xics_spapr.c +++ b/hw/intc/xics_spapr.c @@ -468,10 +468,6 @@ static const TypeInfo ics_spapr_info = { { } }, }; +TYPE_INFO(ics_spapr_info) -static void xics_spapr_register_types(void) -{ - type_register_static(&ics_spapr_info); -} -type_init(xics_spapr_register_types) diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c index 3e65e68619..4efd6297ca 100644 --- a/hw/intc/xilinx_intc.c +++ b/hw/intc/xilinx_intc.c @@ -195,10 +195,6 @@ static const TypeInfo xilinx_intc_info = { .instance_init = xilinx_intc_init, .class_init = xilinx_intc_class_init, }; +TYPE_INFO(xilinx_intc_info) -static void xilinx_intc_register_types(void) -{ - type_register_static(&xilinx_intc_info); -} -type_init(xilinx_intc_register_types) diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 9a162431e0..c61a7b5b28 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -754,6 +754,7 @@ static const TypeInfo xive_tctx_info = { .instance_size = sizeof(XiveTCTX), .class_init = xive_tctx_class_init, }; +TYPE_INFO(xive_tctx_info) Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp) { @@ -1201,6 +1202,7 @@ static const TypeInfo xive_source_info = { .instance_size = sizeof(XiveSource), .class_init = xive_source_class_init, }; +TYPE_INFO(xive_source_info) /* * XiveEND helpers @@ -1748,6 +1750,7 @@ static const TypeInfo xive_router_info = { { } } }; +TYPE_INFO(xive_router_info) void xive_eas_pic_print_info(XiveEAS *eas, uint32_t lisn, Monitor *mon) { @@ -1907,6 +1910,7 @@ static const TypeInfo xive_end_source_info = { .instance_size = sizeof(XiveENDSource), .class_init = xive_end_source_class_init, }; +TYPE_INFO(xive_end_source_info) /* * XIVE Notifier @@ -1916,6 +1920,7 @@ static const TypeInfo xive_notifier_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(XiveNotifierClass), }; +TYPE_INFO(xive_notifier_info) /* * XIVE Presenter @@ -1925,6 +1930,7 @@ static const TypeInfo xive_presenter_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(XivePresenterClass), }; +TYPE_INFO(xive_presenter_info) /* * XIVE Fabric @@ -1934,16 +1940,6 @@ static const TypeInfo xive_fabric_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(XiveFabricClass), }; +TYPE_INFO(xive_fabric_info) -static void xive_register_types(void) -{ - type_register_static(&xive_fabric_info); - type_register_static(&xive_source_info); - type_register_static(&xive_notifier_info); - type_register_static(&xive_presenter_info); - type_register_static(&xive_router_info); - type_register_static(&xive_end_source_info); - type_register_static(&xive_tctx_info); -} -type_init(xive_register_types) diff --git a/hw/intc/xlnx-pmu-iomod-intc.c b/hw/intc/xlnx-pmu-iomod-intc.c index acaa1c3e6f..bc1f431407 100644 --- a/hw/intc/xlnx-pmu-iomod-intc.c +++ b/hw/intc/xlnx-pmu-iomod-intc.c @@ -549,10 +549,6 @@ static const TypeInfo xlnx_pmu_io_intc_info = { .class_init = xlnx_pmu_io_intc_class_init, .instance_init = xlnx_pmu_io_intc_init, }; +TYPE_INFO(xlnx_pmu_io_intc_info) -static void xlnx_pmu_io_intc_register_types(void) -{ - type_register_static(&xlnx_pmu_io_intc_info); -} -type_init(xlnx_pmu_io_intc_register_types) diff --git a/hw/intc/xlnx-zynqmp-ipi.c b/hw/intc/xlnx-zynqmp-ipi.c index adc1179014..3895061f87 100644 --- a/hw/intc/xlnx-zynqmp-ipi.c +++ b/hw/intc/xlnx-zynqmp-ipi.c @@ -371,10 +371,6 @@ static const TypeInfo xlnx_zynqmp_ipi_info = { .class_init = xlnx_zynqmp_ipi_class_init, .instance_init = xlnx_zynqmp_ipi_init, }; +TYPE_INFO(xlnx_zynqmp_ipi_info) -static void xlnx_zynqmp_ipi_register_types(void) -{ - type_register_static(&xlnx_zynqmp_ipi_info); -} -type_init(xlnx_zynqmp_ipi_register_types) diff --git a/hw/ipack/ipack.c b/hw/ipack/ipack.c index f19ecaeb1c..9cb74e3d32 100644 --- a/hw/ipack/ipack.c +++ b/hw/ipack/ipack.c @@ -107,17 +107,13 @@ static const TypeInfo ipack_device_info = { .class_init = ipack_device_class_init, .abstract = true, }; +TYPE_INFO(ipack_device_info) static const TypeInfo ipack_bus_info = { .name = TYPE_IPACK_BUS, .parent = TYPE_BUS, .instance_size = sizeof(IPackBus), }; +TYPE_INFO(ipack_bus_info) -static void ipack_register_types(void) -{ - type_register_static(&ipack_device_info); - type_register_static(&ipack_bus_info); -} -type_init(ipack_register_types) diff --git a/hw/ipack/tpci200.c b/hw/ipack/tpci200.c index f931d4df62..292836b379 100644 --- a/hw/ipack/tpci200.c +++ b/hw/ipack/tpci200.c @@ -655,10 +655,6 @@ static const TypeInfo tpci200_info = { { }, }, }; +TYPE_INFO(tpci200_info) -static void tpci200_register_types(void) -{ - type_register_static(&tpci200_info); -} -type_init(tpci200_register_types) diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c index 8d35c9fdd6..aa5428e7e9 100644 --- a/hw/ipmi/ipmi.c +++ b/hw/ipmi/ipmi.c @@ -91,6 +91,7 @@ static TypeInfo ipmi_interface_type_info = { .class_size = sizeof(IPMIInterfaceClass), .class_init = ipmi_interface_class_init, }; +TYPE_INFO(ipmi_interface_type_info) static void isa_ipmi_bmc_check(const Object *obj, const char *name, Object *val, Error **errp) @@ -128,11 +129,6 @@ static TypeInfo ipmi_bmc_type_info = { .class_size = sizeof(IPMIBmcClass), .class_init = bmc_class_init, }; +TYPE_INFO(ipmi_bmc_type_info) -static void ipmi_register_types(void) -{ - type_register_static(&ipmi_interface_type_info); - type_register_static(&ipmi_bmc_type_info); -} -type_init(ipmi_register_types) diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c index f78e92d3d5..caa4d75915 100644 --- a/hw/ipmi/ipmi_bmc_sim.c +++ b/hw/ipmi/ipmi_bmc_sim.c @@ -2222,10 +2222,6 @@ static const TypeInfo ipmi_sim_type = { .instance_size = sizeof(IPMIBmcSim), .class_init = ipmi_sim_class_init, }; +TYPE_INFO(ipmi_sim_type) -static void ipmi_sim_register_types(void) -{ - type_register_static(&ipmi_sim_type); -} -type_init(ipmi_sim_register_types) diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c index c8dc0a09dc..389b4ece7f 100644 --- a/hw/ipmi/isa_ipmi_bt.c +++ b/hw/ipmi/isa_ipmi_bt.c @@ -165,10 +165,6 @@ static const TypeInfo isa_ipmi_bt_info = { { } } }; +TYPE_INFO(isa_ipmi_bt_info) -static void ipmi_register_types(void) -{ - type_register_static(&isa_ipmi_bt_info); -} -type_init(ipmi_register_types) diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c index 4b421c33f4..465aba5ac8 100644 --- a/hw/ipmi/isa_ipmi_kcs.c +++ b/hw/ipmi/isa_ipmi_kcs.c @@ -172,10 +172,6 @@ static const TypeInfo isa_ipmi_kcs_info = { { } } }; +TYPE_INFO(isa_ipmi_kcs_info) -static void ipmi_register_types(void) -{ - type_register_static(&isa_ipmi_kcs_info); -} -type_init(ipmi_register_types) diff --git a/hw/ipmi/pci_ipmi_bt.c b/hw/ipmi/pci_ipmi_bt.c index ba9cf016b5..4d20d36ed1 100644 --- a/hw/ipmi/pci_ipmi_bt.c +++ b/hw/ipmi/pci_ipmi_bt.c @@ -139,10 +139,6 @@ static const TypeInfo pci_ipmi_bt_info = { { } } }; +TYPE_INFO(pci_ipmi_bt_info) -static void pci_ipmi_bt_register_types(void) -{ - type_register_static(&pci_ipmi_bt_info); -} -type_init(pci_ipmi_bt_register_types) diff --git a/hw/ipmi/pci_ipmi_kcs.c b/hw/ipmi/pci_ipmi_kcs.c index 99f46152f4..f3f4cee8f5 100644 --- a/hw/ipmi/pci_ipmi_kcs.c +++ b/hw/ipmi/pci_ipmi_kcs.c @@ -139,10 +139,6 @@ static const TypeInfo pci_ipmi_kcs_info = { { } } }; +TYPE_INFO(pci_ipmi_kcs_info) -static void pci_ipmi_kcs_register_types(void) -{ - type_register_static(&pci_ipmi_kcs_info); -} -type_init(pci_ipmi_kcs_register_types) diff --git a/hw/ipmi/smbus_ipmi.c b/hw/ipmi/smbus_ipmi.c index f1a0148755..dbfe949890 100644 --- a/hw/ipmi/smbus_ipmi.c +++ b/hw/ipmi/smbus_ipmi.c @@ -375,10 +375,6 @@ static const TypeInfo smbus_ipmi_info = { { } } }; +TYPE_INFO(smbus_ipmi_info) -static void smbus_ipmi_register_types(void) -{ - type_register_static(&smbus_ipmi_info); -} -type_init(smbus_ipmi_register_types) diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c index 75a2da2881..2341e13bc3 100644 --- a/hw/isa/i82378.c +++ b/hw/isa/i82378.c @@ -142,10 +142,6 @@ static const TypeInfo i82378_type_info = { { }, }, }; +TYPE_INFO(i82378_type_info) -static void i82378_register_types(void) -{ - type_register_static(&i82378_type_info); -} -type_init(i82378_register_types) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 58fde178f9..6a52f350a5 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -45,6 +45,7 @@ static const TypeInfo isa_dma_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(IsaDmaClass), }; +TYPE_INFO(isa_dma_info) static const TypeInfo isa_bus_info = { .name = TYPE_ISA_BUS, @@ -52,6 +53,7 @@ static const TypeInfo isa_bus_info = { .instance_size = sizeof(ISABus), .class_init = isa_bus_class_init, }; +TYPE_INFO(isa_bus_info) ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space, MemoryRegion *address_space_io, Error **errp) @@ -248,6 +250,7 @@ static const TypeInfo isabus_bridge_info = { .instance_size = sizeof(SysBusDevice), .class_init = isabus_bridge_class_init, }; +TYPE_INFO(isabus_bridge_info) static void isa_device_class_init(ObjectClass *klass, void *data) { @@ -264,14 +267,8 @@ static const TypeInfo isa_device_type_info = { .class_size = sizeof(ISADeviceClass), .class_init = isa_device_class_init, }; +TYPE_INFO(isa_device_type_info) -static void isabus_register_types(void) -{ - type_register_static(&isa_dma_info); - type_register_static(&isa_bus_info); - type_register_static(&isabus_bridge_info); - type_register_static(&isa_device_type_info); -} static char *isabus_get_fw_dev_path(DeviceState *dev) { @@ -305,4 +302,3 @@ MemoryRegion *isa_address_space_io(ISADevice *dev) return isabus->address_space_io; } -type_init(isabus_register_types) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index e2e47d8fd9..803cf27f6b 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -185,6 +185,7 @@ static const TypeInfo isa_superio_type_info = { .class_size = sizeof(ISASuperIOClass), .class_init = isa_superio_class_init, }; +TYPE_INFO(isa_superio_type_info) /* SMS FDC37M817 Super I/O */ static void fdc37m81x_class_init(ObjectClass *klass, void *data) @@ -203,11 +204,6 @@ static const TypeInfo fdc37m81x_type_info = { .instance_size = sizeof(ISASuperIODevice), .class_init = fdc37m81x_class_init, }; +TYPE_INFO(fdc37m81x_type_info) -static void isa_superio_register_types(void) -{ - type_register_static(&isa_superio_type_info); - type_register_static(&fdc37m81x_type_info); -} -type_init(isa_superio_register_types) diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index cd6e169d47..6011ae073f 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -802,10 +802,6 @@ static const TypeInfo ich9_lpc_info = { { } } }; +TYPE_INFO(ich9_lpc_info) -static void ich9_lpc_register(void) -{ - type_register_static(&ich9_lpc_info); -} -type_init(ich9_lpc_register); diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 0cacbbc91b..db22a75e28 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -378,10 +378,6 @@ static const TypeInfo pc87312_type_info = { .class_init = pc87312_class_init, /* FIXME use a qdev drive property instead of drive_get() */ }; +TYPE_INFO(pc87312_type_info) -static void pc87312_register_types(void) -{ - type_register_static(&pc87312_type_info); -} -type_init(pc87312_register_types) diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 1a5267e19f..568d73c488 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -322,6 +322,7 @@ static const TypeInfo piix3_pci_type_info = { { }, }, }; +TYPE_INFO(piix3_pci_type_info) static void piix3_class_init(ObjectClass *klass, void *data) { @@ -335,6 +336,7 @@ static const TypeInfo piix3_info = { .parent = TYPE_PIIX3_PCI_DEVICE, .class_init = piix3_class_init, }; +TYPE_INFO(piix3_info) static void piix3_xen_class_init(ObjectClass *klass, void *data) { @@ -348,15 +350,9 @@ static const TypeInfo piix3_xen_info = { .parent = TYPE_PIIX3_PCI_DEVICE, .class_init = piix3_xen_class_init, }; +TYPE_INFO(piix3_xen_info) -static void piix3_register_types(void) -{ - type_register_static(&piix3_pci_type_info); - type_register_static(&piix3_info); - type_register_static(&piix3_xen_info); -} -type_init(piix3_register_types) /* * Return the global irq number corresponding to a given device irq diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index ac044afa95..705c5c5567 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -228,13 +228,9 @@ static const TypeInfo piix4_info = { { }, }, }; +TYPE_INFO(piix4_info) -static void piix4_register_types(void) -{ - type_register_static(&piix4_info); -} -type_init(piix4_register_types) DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) { diff --git a/hw/isa/smc37c669-superio.c b/hw/isa/smc37c669-superio.c index 18287741cb..f26769ba6d 100644 --- a/hw/isa/smc37c669-superio.c +++ b/hw/isa/smc37c669-superio.c @@ -107,10 +107,6 @@ static const TypeInfo smc37c669_type_info = { .class_size = sizeof(ISASuperIOClass), .class_init = smc37c669_class_init, }; +TYPE_INFO(smc37c669_type_info) -static void smc37c669_register_types(void) -{ - type_register_static(&smc37c669_type_info); -} -type_init(smc37c669_register_types) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 18160ca445..2b68111629 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -305,6 +305,7 @@ static const TypeInfo via_ac97_info = { { }, }, }; +TYPE_INFO(via_ac97_info) static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp) { @@ -349,6 +350,7 @@ static const TypeInfo via_mc97_info = { { }, }, }; +TYPE_INFO(via_mc97_info) /* vt82c686 pm init */ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp) @@ -431,6 +433,7 @@ static const TypeInfo via_pm_info = { { }, }, }; +TYPE_INFO(via_pm_info) static const VMStateDescription vmstate_via = { .name = "vt82c686b", @@ -519,6 +522,7 @@ static const TypeInfo via_info = { { }, }, }; +TYPE_INFO(via_info) static void vt82c686b_superio_class_init(ObjectClass *klass, void *data) { @@ -537,14 +541,6 @@ static const TypeInfo via_superio_info = { .class_size = sizeof(ISASuperIOClass), .class_init = vt82c686b_superio_class_init, }; +TYPE_INFO(via_superio_info) -static void vt82c686b_register_types(void) -{ - type_register_static(&via_ac97_info); - type_register_static(&via_mc97_info); - type_register_static(&via_pm_info); - type_register_static(&via_superio_info); - type_register_static(&via_info); -} -type_init(vt82c686b_register_types) diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index b842f74344..1541d53b5e 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -306,6 +306,7 @@ static const TypeInfo lm32_evr_type = { .parent = TYPE_MACHINE, .class_init = lm32_evr_class_init, }; +TYPE_INFO(lm32_evr_type) static void lm32_uclinux_class_init(ObjectClass *oc, void *data) { @@ -323,11 +324,6 @@ static const TypeInfo lm32_uclinux_type = { .parent = TYPE_MACHINE, .class_init = lm32_uclinux_class_init, }; +TYPE_INFO(lm32_uclinux_type) -static void lm32_machine_init(void) -{ - type_register_static(&lm32_evr_type); - type_register_static(&lm32_uclinux_type); -} -type_init(lm32_machine_init) diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c index e01e2e111b..e6e9d7c03e 100644 --- a/hw/m68k/mcf_intc.c +++ b/hw/m68k/mcf_intc.c @@ -190,13 +190,9 @@ static const TypeInfo mcf_intc_gate_info = { .instance_init = mcf_intc_instance_init, .class_init = mcf_intc_class_init, }; +TYPE_INFO(mcf_intc_gate_info) -static void mcf_intc_register_types(void) -{ - type_register_static(&mcf_intc_gate_info); -} -type_init(mcf_intc_register_types) qemu_irq *mcf_intc_init(MemoryRegion *sysmem, hwaddr base, diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index d3f25cd6d7..e839765cb7 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -975,10 +975,6 @@ static const TypeInfo next_typeinfo = { .class_init = next_machine_class_init, .instance_size = sizeof(NeXTState), }; +TYPE_INFO(next_typeinfo) -static void next_register_type(void) -{ - type_register_static(&next_typeinfo); -} -type_init(next_register_type) diff --git a/hw/m68k/next-kbd.c b/hw/m68k/next-kbd.c index 2dff87be15..fc000ae694 100644 --- a/hw/m68k/next-kbd.c +++ b/hw/m68k/next-kbd.c @@ -282,10 +282,6 @@ static const TypeInfo nextkbd_info = { .instance_size = sizeof(NextKBDState), .class_init = nextkbd_class_init, }; +TYPE_INFO(nextkbd_info) -static void nextkbd_register_types(void) -{ - type_register_static(&nextkbd_info); -} -type_init(nextkbd_register_types) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 1ca482ad81..35dfb8d858 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -445,10 +445,6 @@ static const TypeInfo q800_machine_typeinfo = { .parent = TYPE_MACHINE, .class_init = q800_machine_class_init, }; +TYPE_INFO(q800_machine_typeinfo) -static void q800_machine_register_types(void) -{ - type_register_static(&q800_machine_typeinfo); -} -type_init(q800_machine_register_types) diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index 4bc9cf0917..cc5b67da8b 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -337,10 +337,6 @@ static const TypeInfo memory_device_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(MemoryDeviceClass), }; +TYPE_INFO(memory_device_info) -static void memory_device_register_types(void) -{ - type_register_static(&memory_device_info); -} -type_init(memory_device_register_types) diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c index e1574bc07c..dff6e553de 100644 --- a/hw/mem/nvdimm.c +++ b/hw/mem/nvdimm.c @@ -247,10 +247,6 @@ static TypeInfo nvdimm_info = { .instance_init = nvdimm_init, .instance_finalize = nvdimm_finalize, }; +TYPE_INFO(nvdimm_info) -static void nvdimm_register_types(void) -{ - type_register_static(&nvdimm_info); -} -type_init(nvdimm_register_types) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index c30351070b..58657be673 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -296,10 +296,6 @@ static TypeInfo pc_dimm_info = { { } }, }; +TYPE_INFO(pc_dimm_info) -static void pc_dimm_register_types(void) -{ - type_register_static(&pc_dimm_info); -} -type_init(pc_dimm_register_types) diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c index 5f994547f7..e025070a9b 100644 --- a/hw/microblaze/xlnx-zynqmp-pmu.c +++ b/hw/microblaze/xlnx-zynqmp-pmu.c @@ -135,13 +135,9 @@ static const TypeInfo xlnx_zynqmp_pmu_soc_type_info = { .instance_init = xlnx_zynqmp_pmu_soc_init, .class_init = xlnx_zynqmp_pmu_soc_class_init, }; +TYPE_INFO(xlnx_zynqmp_pmu_soc_type_info) -static void xlnx_zynqmp_pmu_soc_register_types(void) -{ - type_register_static(&xlnx_zynqmp_pmu_soc_type_info); -} -type_init(xlnx_zynqmp_pmu_soc_register_types) /* Define the PMU Machine */ diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 766458c015..55deb9c74a 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -253,12 +253,8 @@ static const TypeInfo boston_device = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(BostonState), }; +TYPE_INFO(boston_device) -static void boston_register_types(void) -{ - type_register_static(&boston_device); -} -type_init(boston_register_types) static void gen_firmware(uint32_t *p, hwaddr kernel_entry, hwaddr fdt_addr, bool is_64b) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 615e1a1ad2..d1a3b59638 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -186,10 +186,6 @@ static const TypeInfo mips_cps_info = { .instance_init = mips_cps_init, .class_init = mips_cps_class_init, }; +TYPE_INFO(mips_cps_info) -static void mips_cps_register_types(void) -{ - type_register_static(&mips_cps_info); -} -type_init(mips_cps_register_types) diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index 756ac9ae12..1a69c18e38 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -1264,6 +1264,7 @@ static const TypeInfo gt64120_pci_info = { { }, }, }; +TYPE_INFO(gt64120_pci_info) static void gt64120_class_init(ObjectClass *klass, void *data) { @@ -1280,11 +1281,6 @@ static const TypeInfo gt64120_info = { .instance_size = sizeof(GT64120State), .class_init = gt64120_class_init, }; +TYPE_INFO(gt64120_info) -static void gt64120_pci_register_types(void) -{ - type_register_static(>64120_info); - type_register_static(>64120_pci_info); -} -type_init(gt64120_pci_register_types) diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 82a6e3220e..acac5ab567 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -401,6 +401,7 @@ static const TypeInfo mips_magnum_type = { .parent = TYPE_MACHINE, .class_init = mips_magnum_class_init, }; +TYPE_INFO(mips_magnum_type) static void mips_pica61_class_init(ObjectClass *oc, void *data) { @@ -418,11 +419,6 @@ static const TypeInfo mips_pica61_type = { .parent = TYPE_MACHINE, .class_init = mips_pica61_class_init, }; +TYPE_INFO(mips_pica61_type) -static void mips_jazz_machine_init(void) -{ - type_register_static(&mips_magnum_type); - type_register_static(&mips_pica61_type); -} -type_init(mips_jazz_machine_init) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index a59e20c81c..1c16bc6c0c 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1425,6 +1425,7 @@ static const TypeInfo mips_malta_device = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MaltaState), }; +TYPE_INFO(mips_malta_device) static void mips_malta_machine_init(MachineClass *mc) { @@ -1443,9 +1444,4 @@ static void mips_malta_machine_init(MachineClass *mc) DEFINE_MACHINE("malta", mips_malta_machine_init) -static void mips_malta_register_types(void) -{ - type_register_static(&mips_malta_device); -} -type_init(mips_malta_register_types) diff --git a/hw/misc/a9scu.c b/hw/misc/a9scu.c index 324371a1c0..3d68782cd5 100644 --- a/hw/misc/a9scu.c +++ b/hw/misc/a9scu.c @@ -147,10 +147,6 @@ static const TypeInfo a9_scu_info = { .instance_init = a9_scu_init, .class_init = a9_scu_class_init, }; +TYPE_INFO(a9_scu_info) -static void a9mp_register_types(void) -{ - type_register_static(&a9_scu_info); -} -type_init(a9mp_register_types) diff --git a/hw/misc/allwinner-cpucfg.c b/hw/misc/allwinner-cpucfg.c index bbd33a7dac..36327860bf 100644 --- a/hw/misc/allwinner-cpucfg.c +++ b/hw/misc/allwinner-cpucfg.c @@ -273,10 +273,6 @@ static const TypeInfo allwinner_cpucfg_info = { .instance_size = sizeof(AwCpuCfgState), .class_init = allwinner_cpucfg_class_init, }; +TYPE_INFO(allwinner_cpucfg_info) -static void allwinner_cpucfg_register(void) -{ - type_register_static(&allwinner_cpucfg_info); -} -type_init(allwinner_cpucfg_register) diff --git a/hw/misc/allwinner-h3-ccu.c b/hw/misc/allwinner-h3-ccu.c index 18d1074545..0ac0efcd18 100644 --- a/hw/misc/allwinner-h3-ccu.c +++ b/hw/misc/allwinner-h3-ccu.c @@ -233,10 +233,6 @@ static const TypeInfo allwinner_h3_ccu_info = { .instance_size = sizeof(AwH3ClockCtlState), .class_init = allwinner_h3_ccu_class_init, }; +TYPE_INFO(allwinner_h3_ccu_info) -static void allwinner_h3_ccu_register(void) -{ - type_register_static(&allwinner_h3_ccu_info); -} -type_init(allwinner_h3_ccu_register) diff --git a/hw/misc/allwinner-h3-dramc.c b/hw/misc/allwinner-h3-dramc.c index 1d37cf422c..015f5c71dd 100644 --- a/hw/misc/allwinner-h3-dramc.c +++ b/hw/misc/allwinner-h3-dramc.c @@ -349,10 +349,6 @@ static const TypeInfo allwinner_h3_dramc_info = { .instance_size = sizeof(AwH3DramCtlState), .class_init = allwinner_h3_dramc_class_init, }; +TYPE_INFO(allwinner_h3_dramc_info) -static void allwinner_h3_dramc_register(void) -{ - type_register_static(&allwinner_h3_dramc_info); -} -type_init(allwinner_h3_dramc_register) diff --git a/hw/misc/allwinner-h3-sysctrl.c b/hw/misc/allwinner-h3-sysctrl.c index 1d07efa880..3f404ab0e7 100644 --- a/hw/misc/allwinner-h3-sysctrl.c +++ b/hw/misc/allwinner-h3-sysctrl.c @@ -131,10 +131,6 @@ static const TypeInfo allwinner_h3_sysctrl_info = { .instance_size = sizeof(AwH3SysCtrlState), .class_init = allwinner_h3_sysctrl_class_init, }; +TYPE_INFO(allwinner_h3_sysctrl_info) -static void allwinner_h3_sysctrl_register(void) -{ - type_register_static(&allwinner_h3_sysctrl_info); -} -type_init(allwinner_h3_sysctrl_register) diff --git a/hw/misc/allwinner-sid.c b/hw/misc/allwinner-sid.c index 196380c33a..a0c870552a 100644 --- a/hw/misc/allwinner-sid.c +++ b/hw/misc/allwinner-sid.c @@ -159,10 +159,6 @@ static const TypeInfo allwinner_sid_info = { .instance_size = sizeof(AwSidState), .class_init = allwinner_sid_class_init, }; +TYPE_INFO(allwinner_sid_info) -static void allwinner_sid_register(void) -{ - type_register_static(&allwinner_sid_info); -} -type_init(allwinner_sid_register) diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c index 1c4addb201..8eebd48f81 100644 --- a/hw/misc/applesmc.c +++ b/hw/misc/applesmc.c @@ -363,10 +363,6 @@ static const TypeInfo applesmc_isa_info = { .instance_size = sizeof(AppleSMCState), .class_init = qdev_applesmc_class_init, }; +TYPE_INFO(applesmc_isa_info) -static void applesmc_register_types(void) -{ - type_register_static(&applesmc_isa_info); -} -type_init(applesmc_register_types) diff --git a/hw/misc/arm11scu.c b/hw/misc/arm11scu.c index 17c36a0545..a6d171b708 100644 --- a/hw/misc/arm11scu.c +++ b/hw/misc/arm11scu.c @@ -95,10 +95,6 @@ static const TypeInfo arm11_scu_type_info = { .instance_init = arm11_scu_init, .class_init = arm11_scu_class_init, }; +TYPE_INFO(arm11_scu_type_info) -static void arm11_scu_register_types(void) -{ - type_register_static(&arm11_scu_type_info); -} -type_init(arm11_scu_register_types) diff --git a/hw/misc/arm_integrator_debug.c b/hw/misc/arm_integrator_debug.c index 3e23201ae6..71b1c3c117 100644 --- a/hw/misc/arm_integrator_debug.c +++ b/hw/misc/arm_integrator_debug.c @@ -91,10 +91,6 @@ static const TypeInfo intdbg_info = { .instance_size = sizeof(IntegratorDebugState), .instance_init = intdbg_control_init, }; +TYPE_INFO(intdbg_info) -static void intdbg_register_types(void) -{ - type_register_static(&intdbg_info); -} -type_init(intdbg_register_types) diff --git a/hw/misc/arm_l2x0.c b/hw/misc/arm_l2x0.c index 2066c97f5f..d395a9f354 100644 --- a/hw/misc/arm_l2x0.c +++ b/hw/misc/arm_l2x0.c @@ -193,10 +193,6 @@ static const TypeInfo l2x0_info = { .instance_init = l2x0_priv_init, .class_init = l2x0_class_init, }; +TYPE_INFO(l2x0_info) -static void l2x0_register_types(void) -{ - type_register_static(&l2x0_info); -} -type_init(l2x0_register_types) diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c index a474bbdd19..3f3d61ebb1 100644 --- a/hw/misc/arm_sysctl.c +++ b/hw/misc/arm_sysctl.c @@ -653,10 +653,6 @@ static const TypeInfo arm_sysctl_info = { .instance_finalize = arm_sysctl_finalize, .class_init = arm_sysctl_class_init, }; +TYPE_INFO(arm_sysctl_info) -static void arm_sysctl_register_types(void) -{ - type_register_static(&arm_sysctl_info); -} -type_init(arm_sysctl_register_types) diff --git a/hw/misc/armsse-cpuid.c b/hw/misc/armsse-cpuid.c index d58138dc28..d191ab1bda 100644 --- a/hw/misc/armsse-cpuid.c +++ b/hw/misc/armsse-cpuid.c @@ -126,10 +126,6 @@ static const TypeInfo armsse_cpuid_info = { .instance_init = armsse_cpuid_init, .class_init = armsse_cpuid_class_init, }; +TYPE_INFO(armsse_cpuid_info) -static void armsse_cpuid_register_types(void) -{ - type_register_static(&armsse_cpuid_info); -} -type_init(armsse_cpuid_register_types); diff --git a/hw/misc/armsse-mhu.c b/hw/misc/armsse-mhu.c index a45d97fada..4083d7e1d2 100644 --- a/hw/misc/armsse-mhu.c +++ b/hw/misc/armsse-mhu.c @@ -191,10 +191,6 @@ static const TypeInfo armsse_mhu_info = { .instance_init = armsse_mhu_init, .class_init = armsse_mhu_class_init, }; +TYPE_INFO(armsse_mhu_info) -static void armsse_mhu_register_types(void) -{ - type_register_static(&armsse_mhu_info); -} -type_init(armsse_mhu_register_types); diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c index ec4fef900e..4dfc480e46 100644 --- a/hw/misc/aspeed_scu.c +++ b/hw/misc/aspeed_scu.c @@ -501,6 +501,7 @@ static const TypeInfo aspeed_scu_info = { .class_size = sizeof(AspeedSCUClass), .abstract = true, }; +TYPE_INFO(aspeed_scu_info) static void aspeed_2400_scu_class_init(ObjectClass *klass, void *data) { @@ -521,6 +522,7 @@ static const TypeInfo aspeed_2400_scu_info = { .instance_size = sizeof(AspeedSCUState), .class_init = aspeed_2400_scu_class_init, }; +TYPE_INFO(aspeed_2400_scu_info) static void aspeed_2500_scu_class_init(ObjectClass *klass, void *data) { @@ -541,6 +543,7 @@ static const TypeInfo aspeed_2500_scu_info = { .instance_size = sizeof(AspeedSCUState), .class_init = aspeed_2500_scu_class_init, }; +TYPE_INFO(aspeed_2500_scu_info) static uint64_t aspeed_ast2600_scu_read(void *opaque, hwaddr offset, unsigned size) @@ -696,13 +699,6 @@ static const TypeInfo aspeed_2600_scu_info = { .instance_size = sizeof(AspeedSCUState), .class_init = aspeed_2600_scu_class_init, }; +TYPE_INFO(aspeed_2600_scu_info) -static void aspeed_scu_register_types(void) -{ - type_register_static(&aspeed_scu_info); - type_register_static(&aspeed_2400_scu_info); - type_register_static(&aspeed_2500_scu_info); - type_register_static(&aspeed_2600_scu_info); -} -type_init(aspeed_scu_register_types); diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 855848b7d2..77365b46e3 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -297,6 +297,7 @@ static const TypeInfo aspeed_sdmc_info = { .class_size = sizeof(AspeedSDMCClass), .abstract = true, }; +TYPE_INFO(aspeed_sdmc_info) static uint32_t aspeed_2400_sdmc_compute_conf(AspeedSDMCState *s, uint32_t data) { @@ -353,6 +354,7 @@ static const TypeInfo aspeed_2400_sdmc_info = { .parent = TYPE_ASPEED_SDMC, .class_init = aspeed_2400_sdmc_class_init, }; +TYPE_INFO(aspeed_2400_sdmc_info) static uint32_t aspeed_2500_sdmc_compute_conf(AspeedSDMCState *s, uint32_t data) { @@ -420,6 +422,7 @@ static const TypeInfo aspeed_2500_sdmc_info = { .parent = TYPE_ASPEED_SDMC, .class_init = aspeed_2500_sdmc_class_init, }; +TYPE_INFO(aspeed_2500_sdmc_info) static uint32_t aspeed_2600_sdmc_compute_conf(AspeedSDMCState *s, uint32_t data) { @@ -497,13 +500,6 @@ static const TypeInfo aspeed_2600_sdmc_info = { .parent = TYPE_ASPEED_SDMC, .class_init = aspeed_2600_sdmc_class_init, }; +TYPE_INFO(aspeed_2600_sdmc_info) -static void aspeed_sdmc_register_types(void) -{ - type_register_static(&aspeed_sdmc_info); - type_register_static(&aspeed_2400_sdmc_info); - type_register_static(&aspeed_2500_sdmc_info); - type_register_static(&aspeed_2600_sdmc_info); -} -type_init(aspeed_sdmc_register_types); diff --git a/hw/misc/aspeed_xdma.c b/hw/misc/aspeed_xdma.c index dca5585a75..82d864fe68 100644 --- a/hw/misc/aspeed_xdma.c +++ b/hw/misc/aspeed_xdma.c @@ -159,9 +159,5 @@ static const TypeInfo aspeed_xdma_info = { .instance_size = sizeof(AspeedXDMAState), .class_init = aspeed_xdma_class_init, }; +TYPE_INFO(aspeed_xdma_info) -static void aspeed_xdma_register_type(void) -{ - type_register_static(&aspeed_xdma_info); -} -type_init(aspeed_xdma_register_type); diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index da361baa32..a4ed045ce9 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -214,6 +214,7 @@ static const TypeInfo aux_bus_info = { .instance_size = sizeof(AUXBus), .class_init = aux_bus_class_init }; +TYPE_INFO(aux_bus_info) /* aux-i2c implementation (internal not public) */ struct AUXTOI2CState { @@ -253,6 +254,7 @@ static const TypeInfo aux_to_i2c_type_info = { .instance_size = sizeof(AUXTOI2CState), .instance_init = aux_bridge_init }; +TYPE_INFO(aux_to_i2c_type_info) /* aux-slave implementation */ static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent) @@ -294,12 +296,6 @@ static const TypeInfo aux_slave_type_info = { .abstract = true, .class_init = aux_slave_class_init, }; +TYPE_INFO(aux_slave_type_info) -static void aux_register_types(void) -{ - type_register_static(&aux_bus_info); - type_register_static(&aux_slave_type_info); - type_register_static(&aux_to_i2c_type_info); -} -type_init(aux_register_types) diff --git a/hw/misc/avr_power.c b/hw/misc/avr_power.c index a5412f2cfe..ca413fd5a5 100644 --- a/hw/misc/avr_power.c +++ b/hw/misc/avr_power.c @@ -104,10 +104,6 @@ static const TypeInfo avr_mask_info = { .class_init = avr_mask_class_init, .instance_init = avr_mask_init, }; +TYPE_INFO(avr_mask_info) -static void avr_mask_register_types(void) -{ - type_register_static(&avr_mask_info); -} -type_init(avr_mask_register_types) diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c index 9f73cbd5e4..eabe45eb96 100644 --- a/hw/misc/bcm2835_mbox.c +++ b/hw/misc/bcm2835_mbox.c @@ -331,10 +331,6 @@ static TypeInfo bcm2835_mbox_info = { .class_init = bcm2835_mbox_class_init, .instance_init = bcm2835_mbox_init, }; +TYPE_INFO(bcm2835_mbox_info) -static void bcm2835_mbox_register_types(void) -{ - type_register_static(&bcm2835_mbox_info); -} -type_init(bcm2835_mbox_register_types) diff --git a/hw/misc/bcm2835_mphi.c b/hw/misc/bcm2835_mphi.c index 0428e10ba5..7bf8156e69 100644 --- a/hw/misc/bcm2835_mphi.c +++ b/hw/misc/bcm2835_mphi.c @@ -182,10 +182,6 @@ static const TypeInfo bcm2835_mphi_type_info = { .instance_init = mphi_init, .class_init = mphi_class_init, }; +TYPE_INFO(bcm2835_mphi_type_info) -static void bcm2835_mphi_register_types(void) -{ - type_register_static(&bcm2835_mphi_type_info); -} -type_init(bcm2835_mphi_register_types) diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index 73941bdae9..7b5375f264 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -427,10 +427,6 @@ static TypeInfo bcm2835_property_info = { .class_init = bcm2835_property_class_init, .instance_init = bcm2835_property_init, }; +TYPE_INFO(bcm2835_property_info) -static void bcm2835_property_register_types(void) -{ - type_register_static(&bcm2835_property_info); -} -type_init(bcm2835_property_register_types) diff --git a/hw/misc/bcm2835_rng.c b/hw/misc/bcm2835_rng.c index d0c4e64e88..ff99501644 100644 --- a/hw/misc/bcm2835_rng.c +++ b/hw/misc/bcm2835_rng.c @@ -138,10 +138,6 @@ static TypeInfo bcm2835_rng_info = { .class_init = bcm2835_rng_class_init, .instance_init = bcm2835_rng_init, }; +TYPE_INFO(bcm2835_rng_info) -static void bcm2835_rng_register_types(void) -{ - type_register_static(&bcm2835_rng_info); -} -type_init(bcm2835_rng_register_types) diff --git a/hw/misc/bcm2835_thermal.c b/hw/misc/bcm2835_thermal.c index c6f3b1ad60..210a943581 100644 --- a/hw/misc/bcm2835_thermal.c +++ b/hw/misc/bcm2835_thermal.c @@ -126,10 +126,6 @@ static const TypeInfo bcm2835_thermal_info = { .instance_size = sizeof(Bcm2835ThermalState), .class_init = bcm2835_thermal_class_init, }; +TYPE_INFO(bcm2835_thermal_info) -static void bcm2835_thermal_register_types(void) -{ - type_register_static(&bcm2835_thermal_info); -} -type_init(bcm2835_thermal_register_types) diff --git a/hw/misc/debugexit.c b/hw/misc/debugexit.c index 99a814f10c..e0f00d2a96 100644 --- a/hw/misc/debugexit.c +++ b/hw/misc/debugexit.c @@ -75,10 +75,6 @@ static const TypeInfo debug_exit_info = { .instance_size = sizeof(ISADebugExitState), .class_init = debug_exit_class_initfn, }; +TYPE_INFO(debug_exit_info) -static void debug_exit_register_types(void) -{ - type_register_static(&debug_exit_info); -} -type_init(debug_exit_register_types) diff --git a/hw/misc/eccmemctl.c b/hw/misc/eccmemctl.c index aec447368e..daf75f1335 100644 --- a/hw/misc/eccmemctl.c +++ b/hw/misc/eccmemctl.c @@ -346,11 +346,7 @@ static const TypeInfo ecc_info = { .instance_init = ecc_init, .class_init = ecc_class_init, }; +TYPE_INFO(ecc_info) -static void ecc_register_types(void) -{ - type_register_static(&ecc_info); -} -type_init(ecc_register_types) diff --git a/hw/misc/empty_slot.c b/hw/misc/empty_slot.c index 9a011b1c11..d1736d784d 100644 --- a/hw/misc/empty_slot.c +++ b/hw/misc/empty_slot.c @@ -99,10 +99,6 @@ static const TypeInfo empty_slot_info = { .instance_size = sizeof(EmptySlot), .class_init = empty_slot_class_init, }; +TYPE_INFO(empty_slot_info) -static void empty_slot_register_types(void) -{ - type_register_static(&empty_slot_info); -} -type_init(empty_slot_register_types) diff --git a/hw/misc/exynos4210_clk.c b/hw/misc/exynos4210_clk.c index bc1463ff89..da18bc974c 100644 --- a/hw/misc/exynos4210_clk.c +++ b/hw/misc/exynos4210_clk.c @@ -156,11 +156,11 @@ static const TypeInfo exynos4210_clk_info = { .instance_init = exynos4210_clk_init, .class_init = exynos4210_clk_class_init, }; +TYPE_INFO(exynos4210_clk_info) static void exynos4210_clk_register(void) { qemu_log_mask(LOG_GUEST_ERROR, "Clock init\n"); - type_register_static(&exynos4210_clk_info); } type_init(exynos4210_clk_register) diff --git a/hw/misc/exynos4210_pmu.c b/hw/misc/exynos4210_pmu.c index 500f28343f..12ce99969c 100644 --- a/hw/misc/exynos4210_pmu.c +++ b/hw/misc/exynos4210_pmu.c @@ -513,10 +513,6 @@ static const TypeInfo exynos4210_pmu_info = { .instance_init = exynos4210_pmu_init, .class_init = exynos4210_pmu_class_init, }; +TYPE_INFO(exynos4210_pmu_info) -static void exynos4210_pmu_register(void) -{ - type_register_static(&exynos4210_pmu_info); -} -type_init(exynos4210_pmu_register) diff --git a/hw/misc/exynos4210_rng.c b/hw/misc/exynos4210_rng.c index 38cd61c7ea..b4938fe848 100644 --- a/hw/misc/exynos4210_rng.c +++ b/hw/misc/exynos4210_rng.c @@ -268,10 +268,6 @@ static const TypeInfo exynos4210_rng_info = { .instance_init = exynos4210_rng_init, .class_init = exynos4210_rng_class_init, }; +TYPE_INFO(exynos4210_rng_info) -static void exynos4210_rng_register(void) -{ - type_register_static(&exynos4210_rng_info); -} -type_init(exynos4210_rng_register) diff --git a/hw/misc/grlib_ahb_apb_pnp.c b/hw/misc/grlib_ahb_apb_pnp.c index 43e001c3c7..1c0178deb3 100644 --- a/hw/misc/grlib_ahb_apb_pnp.c +++ b/hw/misc/grlib_ahb_apb_pnp.c @@ -180,6 +180,7 @@ static const TypeInfo grlib_ahb_pnp_info = { .instance_size = sizeof(AHBPnp), .class_init = grlib_ahb_pnp_class_init, }; +TYPE_INFO(grlib_ahb_pnp_info) /* APBPnp */ @@ -291,11 +292,6 @@ static const TypeInfo grlib_apb_pnp_info = { .instance_size = sizeof(APBPnp), .class_init = grlib_apb_pnp_class_init, }; +TYPE_INFO(grlib_apb_pnp_info) -static void grlib_ahb_apb_pnp_register_types(void) -{ - type_register_static(&grlib_ahb_pnp_info); - type_register_static(&grlib_apb_pnp_info); -} -type_init(grlib_ahb_apb_pnp_register_types) diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c index d3107e5ca2..7b9d9dc5b5 100644 --- a/hw/misc/imx25_ccm.c +++ b/hw/misc/imx25_ccm.c @@ -311,10 +311,6 @@ static const TypeInfo imx25_ccm_info = { .instance_init = imx25_ccm_init, .class_init = imx25_ccm_class_init, }; +TYPE_INFO(imx25_ccm_info) -static void imx25_ccm_register_types(void) -{ - type_register_static(&imx25_ccm_info); -} -type_init(imx25_ccm_register_types) diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c index 6e246827ab..c12610e69b 100644 --- a/hw/misc/imx31_ccm.c +++ b/hw/misc/imx31_ccm.c @@ -338,10 +338,6 @@ static const TypeInfo imx31_ccm_info = { .instance_init = imx31_ccm_init, .class_init = imx31_ccm_class_init, }; +TYPE_INFO(imx31_ccm_info) -static void imx31_ccm_register_types(void) -{ - type_register_static(&imx31_ccm_info); -} -type_init(imx31_ccm_register_types) diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c index 7fec8f0a47..582e070287 100644 --- a/hw/misc/imx6_ccm.c +++ b/hw/misc/imx6_ccm.c @@ -774,10 +774,6 @@ static const TypeInfo imx6_ccm_info = { .instance_init = imx6_ccm_init, .class_init = imx6_ccm_class_init, }; +TYPE_INFO(imx6_ccm_info) -static void imx6_ccm_register_types(void) -{ - type_register_static(&imx6_ccm_info); -} -type_init(imx6_ccm_register_types) diff --git a/hw/misc/imx6_src.c b/hw/misc/imx6_src.c index dd99cc7acf..00af88e31b 100644 --- a/hw/misc/imx6_src.c +++ b/hw/misc/imx6_src.c @@ -302,10 +302,6 @@ static const TypeInfo imx6_src_info = { .instance_size = sizeof(IMX6SRCState), .class_init = imx6_src_class_init, }; +TYPE_INFO(imx6_src_info) -static void imx6_src_register_types(void) -{ - type_register_static(&imx6_src_info); -} -type_init(imx6_src_register_types) diff --git a/hw/misc/imx6ul_ccm.c b/hw/misc/imx6ul_ccm.c index 5e0661dacf..48e10f644d 100644 --- a/hw/misc/imx6ul_ccm.c +++ b/hw/misc/imx6ul_ccm.c @@ -929,10 +929,6 @@ static const TypeInfo imx6ul_ccm_info = { .instance_init = imx6ul_ccm_init, .class_init = imx6ul_ccm_class_init, }; +TYPE_INFO(imx6ul_ccm_info) -static void imx6ul_ccm_register_types(void) -{ - type_register_static(&imx6ul_ccm_info); -} -type_init(imx6ul_ccm_register_types) diff --git a/hw/misc/imx7_ccm.c b/hw/misc/imx7_ccm.c index 02fc1ae8d0..08642e103b 100644 --- a/hw/misc/imx7_ccm.c +++ b/hw/misc/imx7_ccm.c @@ -242,6 +242,7 @@ static const TypeInfo imx7_ccm_info = { .instance_init = imx7_ccm_init, .class_init = imx7_ccm_class_init, }; +TYPE_INFO(imx7_ccm_info) static const VMStateDescription vmstate_imx7_analog = { .name = TYPE_IMX7_ANALOG, @@ -270,10 +271,5 @@ static const TypeInfo imx7_analog_info = { .instance_init = imx7_analog_init, .class_init = imx7_analog_class_init, }; +TYPE_INFO(imx7_analog_info) -static void imx7_ccm_register_type(void) -{ - type_register_static(&imx7_ccm_info); - type_register_static(&imx7_analog_info); -} -type_init(imx7_ccm_register_type) diff --git a/hw/misc/imx7_gpr.c b/hw/misc/imx7_gpr.c index b03341a2eb..d1ae539f59 100644 --- a/hw/misc/imx7_gpr.c +++ b/hw/misc/imx7_gpr.c @@ -116,9 +116,5 @@ static const TypeInfo imx7_gpr_info = { .instance_init = imx7_gpr_init, .class_init = imx7_gpr_class_init, }; +TYPE_INFO(imx7_gpr_info) -static void imx7_gpr_register_type(void) -{ - type_register_static(&imx7_gpr_info); -} -type_init(imx7_gpr_register_type) diff --git a/hw/misc/imx7_snvs.c b/hw/misc/imx7_snvs.c index 45972a5920..e92b3bd9a5 100644 --- a/hw/misc/imx7_snvs.c +++ b/hw/misc/imx7_snvs.c @@ -76,9 +76,5 @@ static const TypeInfo imx7_snvs_info = { .instance_init = imx7_snvs_init, .class_init = imx7_snvs_class_init, }; +TYPE_INFO(imx7_snvs_info) -static void imx7_snvs_register_type(void) -{ - type_register_static(&imx7_snvs_info); -} -type_init(imx7_snvs_register_type) diff --git a/hw/misc/imx_ccm.c b/hw/misc/imx_ccm.c index 2f81b0ad73..d2bba941e5 100644 --- a/hw/misc/imx_ccm.c +++ b/hw/misc/imx_ccm.c @@ -78,10 +78,6 @@ static const TypeInfo imx_ccm_info = { .class_size = sizeof(IMXCCMClass), .abstract = true, }; +TYPE_INFO(imx_ccm_info) -static void imx_ccm_register_types(void) -{ - type_register_static(&imx_ccm_info); -} -type_init(imx_ccm_register_types) diff --git a/hw/misc/imx_rngc.c b/hw/misc/imx_rngc.c index 4c270df2db..8e67d3ef2a 100644 --- a/hw/misc/imx_rngc.c +++ b/hw/misc/imx_rngc.c @@ -269,10 +269,6 @@ static const TypeInfo imx_rngc_info = { .instance_size = sizeof(IMXRNGCState), .class_init = imx_rngc_class_init, }; +TYPE_INFO(imx_rngc_info) -static void imx_rngc_register_types(void) -{ - type_register_static(&imx_rngc_info); -} -type_init(imx_rngc_register_types) diff --git a/hw/misc/iotkit-secctl.c b/hw/misc/iotkit-secctl.c index 9fdb82056a..0c93ed02d8 100644 --- a/hw/misc/iotkit-secctl.c +++ b/hw/misc/iotkit-secctl.c @@ -790,10 +790,6 @@ static const TypeInfo iotkit_secctl_info = { .instance_init = iotkit_secctl_init, .class_init = iotkit_secctl_class_init, }; +TYPE_INFO(iotkit_secctl_info) -static void iotkit_secctl_register_types(void) -{ - type_register_static(&iotkit_secctl_info); -} -type_init(iotkit_secctl_register_types); diff --git a/hw/misc/iotkit-sysctl.c b/hw/misc/iotkit-sysctl.c index 269783366d..b145a76680 100644 --- a/hw/misc/iotkit-sysctl.c +++ b/hw/misc/iotkit-sysctl.c @@ -519,10 +519,6 @@ static const TypeInfo iotkit_sysctl_info = { .instance_init = iotkit_sysctl_init, .class_init = iotkit_sysctl_class_init, }; +TYPE_INFO(iotkit_sysctl_info) -static void iotkit_sysctl_register_types(void) -{ - type_register_static(&iotkit_sysctl_info); -} -type_init(iotkit_sysctl_register_types); diff --git a/hw/misc/iotkit-sysinfo.c b/hw/misc/iotkit-sysinfo.c index b2dcfc4376..559f640cd1 100644 --- a/hw/misc/iotkit-sysinfo.c +++ b/hw/misc/iotkit-sysinfo.c @@ -131,10 +131,6 @@ static const TypeInfo iotkit_sysinfo_info = { .instance_init = iotkit_sysinfo_init, .class_init = iotkit_sysinfo_class_init, }; +TYPE_INFO(iotkit_sysinfo_info) -static void iotkit_sysinfo_register_types(void) -{ - type_register_static(&iotkit_sysinfo_info); -} -type_init(iotkit_sysinfo_register_types); diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 2b6882face..e61062a2ed 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -1007,6 +1007,7 @@ static const TypeInfo ivshmem_common_info = { { }, }, }; +TYPE_INFO(ivshmem_common_info) static const VMStateDescription ivshmem_plain_vmsd = { .name = TYPE_IVSHMEM_PLAIN, @@ -1061,6 +1062,7 @@ static const TypeInfo ivshmem_plain_info = { .instance_size = sizeof(IVShmemState), .class_init = ivshmem_plain_class_init, }; +TYPE_INFO(ivshmem_plain_info) static const VMStateDescription ivshmem_doorbell_vmsd = { .name = TYPE_IVSHMEM_DOORBELL, @@ -1122,12 +1124,6 @@ static const TypeInfo ivshmem_doorbell_info = { .instance_init = ivshmem_doorbell_init, .class_init = ivshmem_doorbell_class_init, }; +TYPE_INFO(ivshmem_doorbell_info) -static void ivshmem_register_types(void) -{ - type_register_static(&ivshmem_common_info); - type_register_static(&ivshmem_plain_info); - type_register_static(&ivshmem_doorbell_info); -} -type_init(ivshmem_register_types) diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index d76d7b28d3..79c660eb2d 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -1178,6 +1178,7 @@ static TypeInfo mac_via_info = { .instance_init = mac_via_init, .class_init = mac_via_class_init, }; +TYPE_INFO(mac_via_info) /* VIA 1 */ static void mos6522_q800_via1_reset(DeviceState *dev) @@ -1213,6 +1214,7 @@ static const TypeInfo mos6522_q800_via1_type_info = { .instance_init = mos6522_q800_via1_init, .class_init = mos6522_q800_via1_class_init, }; +TYPE_INFO(mos6522_q800_via1_type_info) /* VIA 2 */ static void mos6522_q800_via2_portB_write(MOS6522State *s) @@ -1259,12 +1261,6 @@ static const TypeInfo mos6522_q800_via2_type_info = { .instance_init = mos6522_q800_via2_init, .class_init = mos6522_q800_via2_class_init, }; +TYPE_INFO(mos6522_q800_via2_type_info) -static void mac_via_register_types(void) -{ - type_register_static(&mos6522_q800_via1_type_info); - type_register_static(&mos6522_q800_via2_type_info); - type_register_static(&mac_via_info); -} -type_init(mac_via_register_types); diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index 286e7a55f4..751aa7c240 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -580,6 +580,7 @@ static const TypeInfo cuda_type_info = { .instance_init = cuda_init, .class_init = cuda_class_init, }; +TYPE_INFO(cuda_type_info) static void mos6522_cuda_portB_write(MOS6522State *s) { @@ -619,11 +620,6 @@ static const TypeInfo mos6522_cuda_type_info = { .instance_size = sizeof(MOS6522CUDAState), .class_init = mos6522_cuda_class_init, }; +TYPE_INFO(mos6522_cuda_type_info) -static void cuda_register_types(void) -{ - type_register_static(&mos6522_cuda_type_info); - type_register_static(&cuda_type_info); -} -type_init(cuda_register_types) diff --git a/hw/misc/macio/gpio.c b/hw/misc/macio/gpio.c index 0fef8fb335..f77db07c67 100644 --- a/hw/misc/macio/gpio.c +++ b/hw/misc/macio/gpio.c @@ -224,10 +224,6 @@ static const TypeInfo macio_gpio_init_info = { { } }, }; +TYPE_INFO(macio_gpio_init_info) -static void macio_gpio_register_types(void) -{ - type_register_static(&macio_gpio_init_info); -} -type_init(macio_gpio_register_types) diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index e220f1a927..13c201c74f 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -931,10 +931,6 @@ static const TypeInfo mac_dbdma_type_info = { .instance_init = mac_dbdma_init, .class_init = mac_dbdma_class_init }; +TYPE_INFO(mac_dbdma_type_info) -static void mac_dbdma_register_types(void) -{ - type_register_static(&mac_dbdma_type_info); -} -type_init(mac_dbdma_register_types) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 679722628e..b9aba19d18 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -467,6 +467,7 @@ static const TypeInfo macio_bus_info = { .parent = TYPE_SYSTEM_BUS, .instance_size = sizeof(MacIOBusState), }; +TYPE_INFO(macio_bus_info) static const TypeInfo macio_oldworld_type_info = { .name = TYPE_OLDWORLD_MACIO, @@ -475,6 +476,7 @@ static const TypeInfo macio_oldworld_type_info = { .instance_init = macio_oldworld_init, .class_init = macio_oldworld_class_init, }; +TYPE_INFO(macio_oldworld_type_info) static const TypeInfo macio_newworld_type_info = { .name = TYPE_NEWWORLD_MACIO, @@ -483,6 +485,7 @@ static const TypeInfo macio_newworld_type_info = { .instance_init = macio_newworld_init, .class_init = macio_newworld_class_init, }; +TYPE_INFO(macio_newworld_type_info) static const TypeInfo macio_type_info = { .name = TYPE_MACIO, @@ -496,13 +499,6 @@ static const TypeInfo macio_type_info = { { }, }, }; +TYPE_INFO(macio_type_info) -static void macio_register_types(void) -{ - type_register_static(&macio_bus_info); - type_register_static(&macio_type_info); - type_register_static(&macio_oldworld_type_info); - type_register_static(&macio_newworld_type_info); -} -type_init(macio_register_types) diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c index 09022995ad..0f1d73e267 100644 --- a/hw/misc/macio/pmu.c +++ b/hw/misc/macio/pmu.c @@ -801,6 +801,7 @@ static const TypeInfo pmu_type_info = { .instance_init = pmu_init, .class_init = pmu_class_init, }; +TYPE_INFO(pmu_type_info) static void mos6522_pmu_portB_write(MOS6522State *s) { @@ -860,11 +861,6 @@ static const TypeInfo mos6522_pmu_type_info = { .instance_size = sizeof(MOS6522PMUState), .class_init = mos6522_pmu_class_init, }; +TYPE_INFO(mos6522_pmu_type_info) -static void pmu_register_types(void) -{ - type_register_static(&pmu_type_info); - type_register_static(&mos6522_pmu_type_info); -} -type_init(pmu_register_types) diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c index 7e6723f343..3db545c99a 100644 --- a/hw/misc/max111x.c +++ b/hw/misc/max111x.c @@ -194,6 +194,7 @@ static const TypeInfo max111x_info = { .class_init = max111x_class_init, .abstract = true, }; +TYPE_INFO(max111x_info) static void max1110_class_init(ObjectClass *klass, void *data) { @@ -209,6 +210,7 @@ static const TypeInfo max1110_info = { .parent = TYPE_MAX_111X, .class_init = max1110_class_init, }; +TYPE_INFO(max1110_info) static void max1111_class_init(ObjectClass *klass, void *data) { @@ -224,12 +226,6 @@ static const TypeInfo max1111_info = { .parent = TYPE_MAX_111X, .class_init = max1111_class_init, }; +TYPE_INFO(max1111_info) -static void max111x_register_types(void) -{ - type_register_static(&max111x_info); - type_register_static(&max1110_info); - type_register_static(&max1111_info); -} -type_init(max111x_register_types) diff --git a/hw/misc/milkymist-hpdmc.c b/hw/misc/milkymist-hpdmc.c index 61e86e6b34..bb21fd7a4b 100644 --- a/hw/misc/milkymist-hpdmc.c +++ b/hw/misc/milkymist-hpdmc.c @@ -164,10 +164,6 @@ static const TypeInfo milkymist_hpdmc_info = { .instance_size = sizeof(MilkymistHpdmcState), .class_init = milkymist_hpdmc_class_init, }; +TYPE_INFO(milkymist_hpdmc_info) -static void milkymist_hpdmc_register_types(void) -{ - type_register_static(&milkymist_hpdmc_info); -} -type_init(milkymist_hpdmc_register_types) diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c index 516825e83d..f78de71df4 100644 --- a/hw/misc/milkymist-pfpu.c +++ b/hw/misc/milkymist-pfpu.c @@ -540,10 +540,6 @@ static const TypeInfo milkymist_pfpu_info = { .instance_size = sizeof(MilkymistPFPUState), .class_init = milkymist_pfpu_class_init, }; +TYPE_INFO(milkymist_pfpu_info) -static void milkymist_pfpu_register_types(void) -{ - type_register_static(&milkymist_pfpu_info); -} -type_init(milkymist_pfpu_register_types) diff --git a/hw/misc/mips_cmgcr.c b/hw/misc/mips_cmgcr.c index 3c8b37f700..ddb46df9fa 100644 --- a/hw/misc/mips_cmgcr.c +++ b/hw/misc/mips_cmgcr.c @@ -246,10 +246,6 @@ static const TypeInfo mips_gcr_info = { .instance_init = mips_gcr_init, .class_init = mips_gcr_class_init, }; +TYPE_INFO(mips_gcr_info) -static void mips_gcr_register_types(void) -{ - type_register_static(&mips_gcr_info); -} -type_init(mips_gcr_register_types) diff --git a/hw/misc/mips_cpc.c b/hw/misc/mips_cpc.c index 2f7b2c9592..9b155b1326 100644 --- a/hw/misc/mips_cpc.c +++ b/hw/misc/mips_cpc.c @@ -185,10 +185,6 @@ static const TypeInfo mips_cpc_info = { .instance_init = mips_cpc_init, .class_init = mips_cpc_class_init, }; +TYPE_INFO(mips_cpc_info) -static void mips_cpc_register_types(void) -{ - type_register_static(&mips_cpc_info); -} -type_init(mips_cpc_register_types) diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c index 3540985258..7afc7c053d 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -573,10 +573,6 @@ static const TypeInfo mips_itu_info = { .instance_init = mips_itu_init, .class_init = mips_itu_class_init, }; +TYPE_INFO(mips_itu_info) -static void mips_itu_register_types(void) -{ - type_register_static(&mips_itu_info); -} -type_init(mips_itu_register_types) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 19e154b870..240839e994 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -523,10 +523,6 @@ static const TypeInfo mos6522_type_info = { .class_size = sizeof(MOS6522DeviceClass), .class_init = mos6522_class_init, }; +TYPE_INFO(mos6522_type_info) -static void mos6522_register_types(void) -{ - type_register_static(&mos6522_type_info); -} -type_init(mos6522_register_types) diff --git a/hw/misc/mps2-fpgaio.c b/hw/misc/mps2-fpgaio.c index 2f3fbeef34..83c060f0ca 100644 --- a/hw/misc/mps2-fpgaio.c +++ b/hw/misc/mps2-fpgaio.c @@ -310,10 +310,6 @@ static const TypeInfo mps2_fpgaio_info = { .instance_init = mps2_fpgaio_init, .class_init = mps2_fpgaio_class_init, }; +TYPE_INFO(mps2_fpgaio_info) -static void mps2_fpgaio_register_types(void) -{ - type_register_static(&mps2_fpgaio_info); -} -type_init(mps2_fpgaio_register_types); diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c index 9d0909e7b3..c3de3813e8 100644 --- a/hw/misc/mps2-scc.c +++ b/hw/misc/mps2-scc.c @@ -303,10 +303,6 @@ static const TypeInfo mps2_scc_info = { .instance_init = mps2_scc_init, .class_init = mps2_scc_class_init, }; +TYPE_INFO(mps2_scc_info) -static void mps2_scc_register_types(void) -{ - type_register_static(&mps2_scc_info); -} -type_init(mps2_scc_register_types); diff --git a/hw/misc/msf2-sysreg.c b/hw/misc/msf2-sysreg.c index 2dce55c364..6ea5b97456 100644 --- a/hw/misc/msf2-sysreg.c +++ b/hw/misc/msf2-sysreg.c @@ -154,10 +154,6 @@ static const TypeInfo msf2_sysreg_info = { .instance_size = sizeof(MSF2SysregState), .instance_init = msf2_sysreg_init, }; +TYPE_INFO(msf2_sysreg_info) -static void msf2_sysreg_register_types(void) -{ - type_register_static(&msf2_sysreg_info); -} -type_init(msf2_sysreg_register_types) diff --git a/hw/misc/mst_fpga.c b/hw/misc/mst_fpga.c index 81abdf8ede..fc4100e1b5 100644 --- a/hw/misc/mst_fpga.c +++ b/hw/misc/mst_fpga.c @@ -260,10 +260,6 @@ static const TypeInfo mst_fpga_info = { .instance_init = mst_fpga_init, .class_init = mst_fpga_class_init, }; +TYPE_INFO(mst_fpga_info) -static void mst_fpga_register_types(void) -{ - type_register_static(&mst_fpga_info); -} -type_init(mst_fpga_register_types) diff --git a/hw/misc/nrf51_rng.c b/hw/misc/nrf51_rng.c index fc86e1b697..1f71b295f5 100644 --- a/hw/misc/nrf51_rng.c +++ b/hw/misc/nrf51_rng.c @@ -257,10 +257,6 @@ static const TypeInfo nrf51_rng_info = { .instance_init = nrf51_rng_init, .class_init = nrf51_rng_class_init }; +TYPE_INFO(nrf51_rng_info) -static void nrf51_rng_register_types(void) -{ - type_register_static(&nrf51_rng_info); -} -type_init(nrf51_rng_register_types) diff --git a/hw/misc/pc-testdev.c b/hw/misc/pc-testdev.c index 8aa8e6549f..9d5a17f747 100644 --- a/hw/misc/pc-testdev.c +++ b/hw/misc/pc-testdev.c @@ -207,10 +207,6 @@ static const TypeInfo testdev_info = { .instance_size = sizeof(PCTestdev), .class_init = testdev_class_init, }; +TYPE_INFO(testdev_info) -static void testdev_register_types(void) -{ - type_register_static(&testdev_info); -} -type_init(testdev_register_types) diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c index e4ccdeaf78..60f73dd257 100644 --- a/hw/misc/pca9552.c +++ b/hw/misc/pca9552.c @@ -410,6 +410,7 @@ static const TypeInfo pca955x_info = { .class_size = sizeof(PCA955xClass), .abstract = true, }; +TYPE_INFO(pca955x_info) static void pca9552_class_init(ObjectClass *oc, void *data) { @@ -427,11 +428,6 @@ static const TypeInfo pca9552_info = { .parent = TYPE_PCA955X, .class_init = pca9552_class_init, }; +TYPE_INFO(pca9552_info) -static void pca955x_register_types(void) -{ - type_register_static(&pca955x_info); - type_register_static(&pca9552_info); -} -type_init(pca955x_register_types) diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c index 188de4d9cc..1b0aba0429 100644 --- a/hw/misc/pci-testdev.c +++ b/hw/misc/pci-testdev.c @@ -352,10 +352,6 @@ static const TypeInfo pci_testdev_info = { { }, }, }; +TYPE_INFO(pci_testdev_info) -static void pci_testdev_register_types(void) -{ - type_register_static(&pci_testdev_info); -} -type_init(pci_testdev_register_types) diff --git a/hw/misc/puv3_pm.c b/hw/misc/puv3_pm.c index 8989d363cd..8cc3d44efa 100644 --- a/hw/misc/puv3_pm.c +++ b/hw/misc/puv3_pm.c @@ -149,10 +149,6 @@ static const TypeInfo puv3_pm_info = { .instance_size = sizeof(PUV3PMState), .class_init = puv3_pm_class_init, }; +TYPE_INFO(puv3_pm_info) -static void puv3_pm_register_type(void) -{ - type_register_static(&puv3_pm_info); -} -type_init(puv3_pm_register_type) diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index abb10bbcaf..98ce4e3289 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -129,10 +129,6 @@ static TypeInfo pvpanic_isa_info = { .instance_init = pvpanic_isa_initfn, .class_init = pvpanic_isa_class_init, }; +TYPE_INFO(pvpanic_isa_info) -static void pvpanic_register_types(void) -{ - type_register_static(&pvpanic_isa_info); -} -type_init(pvpanic_register_types) diff --git a/hw/misc/sga.c b/hw/misc/sga.c index 6866bf72cb..c1a5625d6a 100644 --- a/hw/misc/sga.c +++ b/hw/misc/sga.c @@ -59,10 +59,6 @@ static const TypeInfo sga_info = { .instance_size = sizeof(ISASGAState), .class_init = sga_class_initfn, }; +TYPE_INFO(sga_info) -static void sga_register_types(void) -{ - type_register_static(&sga_info); -} -type_init(sga_register_types) diff --git a/hw/misc/slavio_misc.c b/hw/misc/slavio_misc.c index 279b38dfc7..41be8d7598 100644 --- a/hw/misc/slavio_misc.c +++ b/hw/misc/slavio_misc.c @@ -495,6 +495,7 @@ static const TypeInfo slavio_misc_info = { .instance_init = slavio_misc_init, .class_init = slavio_misc_class_init, }; +TYPE_INFO(slavio_misc_info) static const TypeInfo apc_info = { .name = TYPE_APC, @@ -502,11 +503,6 @@ static const TypeInfo apc_info = { .instance_size = sizeof(MiscState), .instance_init = apc_init, }; +TYPE_INFO(apc_info) -static void slavio_misc_register_types(void) -{ - type_register_static(&slavio_misc_info); - type_register_static(&apc_info); -} -type_init(slavio_misc_register_types) diff --git a/hw/misc/stm32f2xx_syscfg.c b/hw/misc/stm32f2xx_syscfg.c index aa59b43549..c106f28257 100644 --- a/hw/misc/stm32f2xx_syscfg.c +++ b/hw/misc/stm32f2xx_syscfg.c @@ -154,10 +154,6 @@ static const TypeInfo stm32f2xx_syscfg_info = { .instance_init = stm32f2xx_syscfg_init, .class_init = stm32f2xx_syscfg_class_init, }; +TYPE_INFO(stm32f2xx_syscfg_info) -static void stm32f2xx_syscfg_register_types(void) -{ - type_register_static(&stm32f2xx_syscfg_info); -} -type_init(stm32f2xx_syscfg_register_types) diff --git a/hw/misc/stm32f4xx_exti.c b/hw/misc/stm32f4xx_exti.c index 02e7810046..d00a0240ef 100644 --- a/hw/misc/stm32f4xx_exti.c +++ b/hw/misc/stm32f4xx_exti.c @@ -179,10 +179,6 @@ static const TypeInfo stm32f4xx_exti_info = { .instance_init = stm32f4xx_exti_init, .class_init = stm32f4xx_exti_class_init, }; +TYPE_INFO(stm32f4xx_exti_info) -static void stm32f4xx_exti_register_types(void) -{ - type_register_static(&stm32f4xx_exti_info); -} -type_init(stm32f4xx_exti_register_types) diff --git a/hw/misc/stm32f4xx_syscfg.c b/hw/misc/stm32f4xx_syscfg.c index f960e4ea1e..fe70ba4c7b 100644 --- a/hw/misc/stm32f4xx_syscfg.c +++ b/hw/misc/stm32f4xx_syscfg.c @@ -162,10 +162,6 @@ static const TypeInfo stm32f4xx_syscfg_info = { .instance_init = stm32f4xx_syscfg_init, .class_init = stm32f4xx_syscfg_class_init, }; +TYPE_INFO(stm32f4xx_syscfg_info) -static void stm32f4xx_syscfg_register_types(void) -{ - type_register_static(&stm32f4xx_syscfg_info); -} -type_init(stm32f4xx_syscfg_register_types) diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c index b47120492a..59cea18752 100644 --- a/hw/misc/tmp105.c +++ b/hw/misc/tmp105.c @@ -264,10 +264,6 @@ static const TypeInfo tmp105_info = { .instance_init = tmp105_initfn, .class_init = tmp105_class_init, }; +TYPE_INFO(tmp105_info) -static void tmp105_register_types(void) -{ - type_register_static(&tmp105_info); -} -type_init(tmp105_register_types) diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c index 49abe2d246..7ae88322b7 100644 --- a/hw/misc/tmp421.c +++ b/hw/misc/tmp421.c @@ -378,12 +378,12 @@ static const TypeInfo tmp421_info = { .instance_init = tmp421_initfn, .abstract = true, }; +TYPE_INFO(tmp421_info) static void tmp421_register_types(void) { int i; - type_register_static(&tmp421_info); for (i = 0; i < ARRAY_SIZE(devices); ++i) { TypeInfo ti = { .name = devices[i].name, diff --git a/hw/misc/tz-mpc.c b/hw/misc/tz-mpc.c index 98f151237f..415e067676 100644 --- a/hw/misc/tz-mpc.c +++ b/hw/misc/tz-mpc.c @@ -606,6 +606,7 @@ static const TypeInfo tz_mpc_info = { .instance_init = tz_mpc_init, .class_init = tz_mpc_class_init, }; +TYPE_INFO(tz_mpc_info) static void tz_mpc_iommu_memory_region_class_init(ObjectClass *klass, void *data) @@ -622,11 +623,6 @@ static const TypeInfo tz_mpc_iommu_memory_region_info = { .parent = TYPE_IOMMU_MEMORY_REGION, .class_init = tz_mpc_iommu_memory_region_class_init, }; +TYPE_INFO(tz_mpc_iommu_memory_region_info) -static void tz_mpc_register_types(void) -{ - type_register_static(&tz_mpc_info); - type_register_static(&tz_mpc_iommu_memory_region_info); -} -type_init(tz_mpc_register_types); diff --git a/hw/misc/tz-msc.c b/hw/misc/tz-msc.c index acbe94400b..6ece4c15a5 100644 --- a/hw/misc/tz-msc.c +++ b/hw/misc/tz-msc.c @@ -303,10 +303,6 @@ static const TypeInfo tz_msc_info = { .instance_init = tz_msc_init, .class_init = tz_msc_class_init, }; +TYPE_INFO(tz_msc_info) -static void tz_msc_register_types(void) -{ - type_register_static(&tz_msc_info); -} -type_init(tz_msc_register_types); diff --git a/hw/misc/tz-ppc.c b/hw/misc/tz-ppc.c index 6431257b52..58c39757d4 100644 --- a/hw/misc/tz-ppc.c +++ b/hw/misc/tz-ppc.c @@ -329,10 +329,6 @@ static const TypeInfo tz_ppc_info = { .instance_init = tz_ppc_init, .class_init = tz_ppc_class_init, }; +TYPE_INFO(tz_ppc_info) -static void tz_ppc_register_types(void) -{ - type_register_static(&tz_ppc_info); -} -type_init(tz_ppc_register_types); diff --git a/hw/misc/unimp.c b/hw/misc/unimp.c index bc4084d344..cb5ba7b363 100644 --- a/hw/misc/unimp.c +++ b/hw/misc/unimp.c @@ -88,10 +88,6 @@ static const TypeInfo unimp_info = { .instance_size = sizeof(UnimplementedDeviceState), .class_init = unimp_class_init, }; +TYPE_INFO(unimp_info) -static void unimp_register_types(void) -{ - type_register_static(&unimp_info); -} -type_init(unimp_register_types) diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index a9d718fc23..7b88db0413 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -99,10 +99,6 @@ static const TypeInfo vmcoreinfo_device_info = { .instance_size = sizeof(VMCoreInfoState), .class_init = vmcoreinfo_device_class_init, }; +TYPE_INFO(vmcoreinfo_device_info) -static void vmcoreinfo_register_types(void) -{ - type_register_static(&vmcoreinfo_device_info); -} -type_init(vmcoreinfo_register_types) diff --git a/hw/misc/zynq-xadc.c b/hw/misc/zynq-xadc.c index 7b1972ce06..f95ccd4c85 100644 --- a/hw/misc/zynq-xadc.c +++ b/hw/misc/zynq-xadc.c @@ -296,10 +296,6 @@ static const TypeInfo zynq_xadc_info = { .instance_size = sizeof(ZynqXADCState), .instance_init = zynq_xadc_init, }; +TYPE_INFO(zynq_xadc_info) -static void zynq_xadc_register_types(void) -{ - type_register_static(&zynq_xadc_info); -} -type_init(zynq_xadc_register_types) diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c index f7472d1f3c..51d14a29a1 100644 --- a/hw/misc/zynq_slcr.c +++ b/hw/misc/zynq_slcr.c @@ -616,10 +616,6 @@ static const TypeInfo zynq_slcr_info = { .instance_size = sizeof(ZynqSLCRState), .instance_init = zynq_slcr_init, }; +TYPE_INFO(zynq_slcr_info) -static void zynq_slcr_register_types(void) -{ - type_register_static(&zynq_slcr_info); -} -type_init(zynq_slcr_register_types) diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c index 28637ff4c1..d2f1df3a84 100644 --- a/hw/net/allwinner-sun8i-emac.c +++ b/hw/net/allwinner-sun8i-emac.c @@ -858,10 +858,6 @@ static const TypeInfo allwinner_sun8i_emac_info = { .instance_init = allwinner_sun8i_emac_init, .class_init = allwinner_sun8i_emac_class_init, }; +TYPE_INFO(allwinner_sun8i_emac_info) -static void allwinner_sun8i_emac_register_types(void) -{ - type_register_static(&allwinner_sun8i_emac_info); -} -type_init(allwinner_sun8i_emac_register_types) diff --git a/hw/net/allwinner_emac.c b/hw/net/allwinner_emac.c index ddddf35c45..bdd4c97162 100644 --- a/hw/net/allwinner_emac.c +++ b/hw/net/allwinner_emac.c @@ -531,10 +531,6 @@ static const TypeInfo aw_emac_info = { .instance_init = aw_emac_init, .class_init = aw_emac_class_init, }; +TYPE_INFO(aw_emac_info) -static void aw_emac_register_types(void) -{ - type_register_static(&aw_emac_info); -} -type_init(aw_emac_register_types) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index a93b5c07ce..b39b289104 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -1710,10 +1710,6 @@ static const TypeInfo gem_info = { .instance_init = gem_init, .class_init = gem_class_init, }; +TYPE_INFO(gem_info) -static void gem_register_types(void) -{ - type_register_static(&gem_info); -} -type_init(gem_register_types) diff --git a/hw/net/can/can_kvaser_pci.c b/hw/net/can/can_kvaser_pci.c index 4b941370d0..ae35e51434 100644 --- a/hw/net/can/can_kvaser_pci.c +++ b/hw/net/can/can_kvaser_pci.c @@ -313,10 +313,6 @@ static const TypeInfo kvaser_pci_info = { { }, }, }; +TYPE_INFO(kvaser_pci_info) -static void kvaser_pci_register_types(void) -{ - type_register_static(&kvaser_pci_info); -} -type_init(kvaser_pci_register_types) diff --git a/hw/net/can/can_mioe3680_pci.c b/hw/net/can/can_mioe3680_pci.c index 695e762a8d..271f44d5af 100644 --- a/hw/net/can/can_mioe3680_pci.c +++ b/hw/net/can/can_mioe3680_pci.c @@ -256,10 +256,6 @@ static const TypeInfo mioe3680_pci_info = { { }, }, }; +TYPE_INFO(mioe3680_pci_info) -static void mioe3680_pci_register_types(void) -{ - type_register_static(&mioe3680_pci_info); -} -type_init(mioe3680_pci_register_types) diff --git a/hw/net/can/can_pcm3680_pci.c b/hw/net/can/can_pcm3680_pci.c index 4218e63eb2..e3173a6f1c 100644 --- a/hw/net/can/can_pcm3680_pci.c +++ b/hw/net/can/can_pcm3680_pci.c @@ -257,10 +257,6 @@ static const TypeInfo pcm3680i_pci_info = { { }, }, }; +TYPE_INFO(pcm3680i_pci_info) -static void pcm3680i_pci_register_types(void) -{ - type_register_static(&pcm3680i_pci_info); -} -type_init(pcm3680i_pci_register_types) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index c54db0d62d..86bb2b6529 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -1040,10 +1040,6 @@ static const TypeInfo dp8393x_info = { .instance_init = dp8393x_instance_init, .class_init = dp8393x_class_init, }; +TYPE_INFO(dp8393x_info) -static void dp8393x_register_types(void) -{ - type_register_static(&dp8393x_info); -} -type_init(dp8393x_register_types) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index c4d896a9e6..ce0540face 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1789,6 +1789,7 @@ static const TypeInfo e1000_base_info = { { }, }, }; +TYPE_INFO(e1000_base_info) static const E1000Info e1000_devices[] = { { @@ -1815,7 +1816,6 @@ static void e1000_register_types(void) { int i; - type_register_static(&e1000_base_info); for (i = 0; i < ARRAY_SIZE(e1000_devices); i++) { const E1000Info *info = &e1000_devices[i]; TypeInfo type_info = {}; diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index fda34518c9..b955f76869 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -719,10 +719,6 @@ static const TypeInfo e1000e_info = { { } }, }; +TYPE_INFO(e1000e_info) -static void e1000e_register_types(void) -{ - type_register_static(&e1000e_info); -} -type_init(e1000e_register_types) diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c index 3408ceacb5..d7712e2924 100644 --- a/hw/net/etraxfs_eth.c +++ b/hw/net/etraxfs_eth.c @@ -680,10 +680,6 @@ static const TypeInfo etraxfs_eth_info = { .instance_size = sizeof(ETRAXFSEthState), .class_init = etraxfs_eth_class_init, }; +TYPE_INFO(etraxfs_eth_info) -static void etraxfs_eth_register_types(void) -{ - type_register_static(&etraxfs_eth_info); -} -type_init(etraxfs_eth_register_types) diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c index 7035cf4eb9..410ae10553 100644 --- a/hw/net/fsl_etsec/etsec.c +++ b/hw/net/fsl_etsec/etsec.c @@ -436,13 +436,9 @@ static TypeInfo etsec_info = { .class_init = etsec_class_init, .instance_init = etsec_instance_init, }; +TYPE_INFO(etsec_info) -static void etsec_register_types(void) -{ - type_register_static(&etsec_info); -} -type_init(etsec_register_types) DeviceState *etsec_create(hwaddr base, MemoryRegion * mr, diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index 5f4b26fc5f..70620d864b 100644 --- a/hw/net/ftgmac100.c +++ b/hw/net/ftgmac100.c @@ -1123,6 +1123,7 @@ static const TypeInfo ftgmac100_info = { .instance_size = sizeof(FTGMAC100State), .class_init = ftgmac100_class_init, }; +TYPE_INFO(ftgmac100_info) /* * AST2600 MII controller @@ -1282,11 +1283,6 @@ static const TypeInfo aspeed_mii_info = { .instance_size = sizeof(AspeedMiiState), .class_init = aspeed_mii_class_init, }; +TYPE_INFO(aspeed_mii_info) -static void ftgmac100_register_types(void) -{ - type_register_static(&ftgmac100_info); - type_register_static(&aspeed_mii_info); -} -type_init(ftgmac100_register_types) diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c index 2c14804041..372fdd839b 100644 --- a/hw/net/imx_fec.c +++ b/hw/net/imx_fec.c @@ -1360,17 +1360,13 @@ static const TypeInfo imx_fec_info = { .instance_init = imx_fec_init, .class_init = imx_eth_class_init, }; +TYPE_INFO(imx_fec_info) static const TypeInfo imx_enet_info = { .name = TYPE_IMX_ENET, .parent = TYPE_IMX_FEC, .instance_init = imx_enet_init, }; +TYPE_INFO(imx_enet_info) -static void imx_eth_register_types(void) -{ - type_register_static(&imx_fec_info); - type_register_static(&imx_enet_info); -} -type_init(imx_eth_register_types) diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 8e2a432179..32cee7b116 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -1381,11 +1381,8 @@ static const TypeInfo lan9118_info = { .instance_size = sizeof(lan9118_state), .class_init = lan9118_class_init, }; +TYPE_INFO(lan9118_info) -static void lan9118_register_types(void) -{ - type_register_static(&lan9118_info); -} /* Legacy helper function. Should go away when machine config files are implemented. */ @@ -1403,4 +1400,3 @@ void lan9118_init(NICInfo *nd, uint32_t base, qemu_irq irq) sysbus_connect_irq(s, 0, irq); } -type_init(lan9118_register_types) diff --git a/hw/net/lance.c b/hw/net/lance.c index 4c5f01baad..9190a4f178 100644 --- a/hw/net/lance.c +++ b/hw/net/lance.c @@ -163,10 +163,6 @@ static const TypeInfo lance_info = { .class_init = lance_class_init, .instance_init = lance_instance_init, }; +TYPE_INFO(lance_info) -static void lance_register_types(void) -{ - type_register_static(&lance_info); -} -type_init(lance_register_types) diff --git a/hw/net/lasi_i82596.c b/hw/net/lasi_i82596.c index 820b63f350..e17ab6d394 100644 --- a/hw/net/lasi_i82596.c +++ b/hw/net/lasi_i82596.c @@ -181,10 +181,6 @@ static const TypeInfo lasi_82596_info = { .class_init = lasi_82596_class_init, .instance_init = lasi_82596_instance_init, }; +TYPE_INFO(lasi_82596_info) -static void lasi_82596_register_types(void) -{ - type_register_static(&lasi_82596_info); -} -type_init(lasi_82596_register_types) diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c index 25e3e453ab..1da49cf688 100644 --- a/hw/net/mcf_fec.c +++ b/hw/net/mcf_fec.c @@ -683,10 +683,6 @@ static const TypeInfo mcf_fec_info = { .instance_init = mcf_fec_instance_init, .class_init = mcf_fec_class_init, }; +TYPE_INFO(mcf_fec_info) -static void mcf_fec_register_types(void) -{ - type_register_static(&mcf_fec_info); -} -type_init(mcf_fec_register_types) diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c index 1ba01754ee..c1531a8637 100644 --- a/hw/net/milkymist-minimac2.c +++ b/hw/net/milkymist-minimac2.c @@ -539,10 +539,6 @@ static const TypeInfo milkymist_minimac2_info = { .instance_size = sizeof(MilkymistMinimac2State), .class_init = milkymist_minimac2_class_init, }; +TYPE_INFO(milkymist_minimac2_info) -static void milkymist_minimac2_register_types(void) -{ - type_register_static(&milkymist_minimac2_info); -} -type_init(milkymist_minimac2_register_types) diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c index 0c578c430c..137a964795 100644 --- a/hw/net/mipsnet.c +++ b/hw/net/mipsnet.c @@ -287,10 +287,6 @@ static const TypeInfo mipsnet_info = { .instance_size = sizeof(MIPSnetState), .class_init = mipsnet_class_init, }; +TYPE_INFO(mipsnet_info) -static void mipsnet_register_types(void) -{ - type_register_static(&mipsnet_info); -} -type_init(mipsnet_register_types) diff --git a/hw/net/msf2-emac.c b/hw/net/msf2-emac.c index 32ba9e8412..8bc6bcf46d 100644 --- a/hw/net/msf2-emac.c +++ b/hw/net/msf2-emac.c @@ -580,10 +580,6 @@ static const TypeInfo msf2_emac_info = { .instance_init = msf2_emac_init, .class_init = msf2_emac_class_init, }; +TYPE_INFO(msf2_emac_info) -static void msf2_emac_register_types(void) -{ - type_register_static(&msf2_emac_info); -} -type_init(msf2_emac_register_types) diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c index a878056426..8d1fa0fc32 100644 --- a/hw/net/ne2000-isa.c +++ b/hw/net/ne2000-isa.c @@ -142,10 +142,6 @@ static const TypeInfo ne2000_isa_info = { .class_init = isa_ne2000_class_initfn, .instance_init = isa_ne2000_instance_init, }; +TYPE_INFO(ne2000_isa_info) -static void ne2000_isa_register_types(void) -{ - type_register_static(&ne2000_isa_info); -} -type_init(ne2000_isa_register_types) diff --git a/hw/net/ne2000-pci.c b/hw/net/ne2000-pci.c index 9e5d10859a..7508125610 100644 --- a/hw/net/ne2000-pci.c +++ b/hw/net/ne2000-pci.c @@ -127,10 +127,6 @@ static const TypeInfo ne2000_info = { { }, }, }; +TYPE_INFO(ne2000_info) -static void ne2000_register_types(void) -{ - type_register_static(&ne2000_info); -} -type_init(ne2000_register_types) diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c index 2ba0dc8c2f..8ef1197157 100644 --- a/hw/net/opencores_eth.c +++ b/hw/net/opencores_eth.c @@ -763,10 +763,6 @@ static const TypeInfo open_eth_info = { .instance_size = sizeof(OpenEthState), .class_init = open_eth_class_init, }; +TYPE_INFO(open_eth_info) -static void open_eth_register_types(void) -{ - type_register_static(&open_eth_info); -} -type_init(open_eth_register_types) diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c index 49d3e42e83..aba8f19048 100644 --- a/hw/net/pcnet-pci.c +++ b/hw/net/pcnet-pci.c @@ -287,10 +287,6 @@ static const TypeInfo pcnet_info = { { }, }, }; +TYPE_INFO(pcnet_info) -static void pci_pcnet_register_types(void) -{ - type_register_static(&pcnet_info); -} -type_init(pci_pcnet_register_types) diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index 15d66f6cbc..9b5d972d1c 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -1536,10 +1536,6 @@ static const TypeInfo rocker_info = { { }, }, }; +TYPE_INFO(rocker_info) -static void rocker_register_types(void) -{ - type_register_static(&rocker_info); -} -type_init(rocker_register_types) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index ab93d78ab3..c6e9207f74 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -3452,10 +3452,6 @@ static const TypeInfo rtl8139_info = { { }, }, }; +TYPE_INFO(rtl8139_info) -static void rtl8139_register_types(void) -{ - type_register_static(&rtl8139_info); -} -type_init(rtl8139_register_types) diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c index a347b6a4d5..bf7e3e6830 100644 --- a/hw/net/smc91c111.c +++ b/hw/net/smc91c111.c @@ -808,11 +808,8 @@ static const TypeInfo smc91c111_info = { .instance_size = sizeof(smc91c111_state), .class_init = smc91c111_class_init, }; +TYPE_INFO(smc91c111_info) -static void smc91c111_register_types(void) -{ - type_register_static(&smc91c111_info); -} /* Legacy helper function. Should go away when machine config files are implemented. */ @@ -830,4 +827,3 @@ void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq) sysbus_connect_irq(s, 0, irq); } -type_init(smc91c111_register_types) diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index 4cd02dda01..a6139568bb 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -869,6 +869,7 @@ static const TypeInfo spapr_vlan_info = { .instance_init = spapr_vlan_instance_init, .instance_finalize = spapr_vlan_instance_finalize, }; +TYPE_INFO(spapr_vlan_info) static void spapr_vlan_register_types(void) { @@ -880,7 +881,6 @@ static void spapr_vlan_register_types(void) spapr_register_hypercall(H_MULTICAST_CTRL, h_multicast_ctrl); spapr_register_hypercall(H_CHANGE_LOGICAL_LAN_MAC, h_change_logical_lan_mac); - type_register_static(&spapr_vlan_info); } type_init(spapr_vlan_register_types) diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c index cb6e2509ea..87399c89b6 100644 --- a/hw/net/stellaris_enet.c +++ b/hw/net/stellaris_enet.c @@ -517,10 +517,6 @@ static const TypeInfo stellaris_enet_info = { .instance_size = sizeof(stellaris_enet_state), .class_init = stellaris_enet_class_init, }; +TYPE_INFO(stellaris_enet_info) -static void stellaris_enet_register_types(void) -{ - type_register_static(&stellaris_enet_info); -} -type_init(stellaris_enet_register_types) diff --git a/hw/net/sungem.c b/hw/net/sungem.c index e4b7b57704..4c9e2bbda5 100644 --- a/hw/net/sungem.c +++ b/hw/net/sungem.c @@ -1444,10 +1444,6 @@ static const TypeInfo sungem_info = { { } } }; +TYPE_INFO(sungem_info) -static void sungem_register_types(void) -{ - type_register_static(&sungem_info); -} -type_init(sungem_register_types) diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index bc48d46b9f..6c38d3d5c6 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -973,10 +973,6 @@ static const TypeInfo sunhme_info = { { } } }; +TYPE_INFO(sunhme_info) -static void sunhme_register_types(void) -{ - type_register_static(&sunhme_info); -} -type_init(sunhme_register_types) diff --git a/hw/net/tulip.c b/hw/net/tulip.c index ca69f7ea5e..21f9a18655 100644 --- a/hw/net/tulip.c +++ b/hw/net/tulip.c @@ -1038,10 +1038,6 @@ static const TypeInfo tulip_info = { { }, }, }; +TYPE_INFO(tulip_info) -static void tulip_register_types(void) -{ - type_register_static(&tulip_info); -} -type_init(tulip_register_types) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index a1fe9e9285..1c0c9184ef 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3602,10 +3602,6 @@ static const TypeInfo virtio_net_info = { .instance_init = virtio_net_instance_init, .class_init = virtio_net_class_init, }; +TYPE_INFO(virtio_net_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_net_info); -} -type_init(virtio_register_types) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 7a6ca4ec35..b484a2faf2 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -2523,11 +2523,11 @@ static const TypeInfo vmxnet3_info = { { } }, }; +TYPE_INFO(vmxnet3_info) static void vmxnet3_register_types(void) { VMW_CBPRN("vmxnet3_register_types called..."); - type_register_static(&vmxnet3_info); } type_init(vmxnet3_register_types) diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c index 5bf1b61012..00f71dc951 100644 --- a/hw/net/xgmac.c +++ b/hw/net/xgmac.c @@ -433,10 +433,6 @@ static const TypeInfo xgmac_enet_info = { .instance_size = sizeof(XgmacState), .class_init = xgmac_enet_class_init, }; +TYPE_INFO(xgmac_enet_info) -static void xgmac_enet_register_types(void) -{ - type_register_static(&xgmac_enet_info); -} -type_init(xgmac_enet_register_types) diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 1e48eb70c9..9711a1dd8e 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -1065,6 +1065,7 @@ static const TypeInfo xilinx_enet_info = { .class_init = xilinx_enet_class_init, .instance_init = xilinx_enet_init, }; +TYPE_INFO(xilinx_enet_info) static const TypeInfo xilinx_enet_data_stream_info = { .name = TYPE_XILINX_AXI_ENET_DATA_STREAM, @@ -1076,6 +1077,7 @@ static const TypeInfo xilinx_enet_data_stream_info = { { } } }; +TYPE_INFO(xilinx_enet_data_stream_info) static const TypeInfo xilinx_enet_control_stream_info = { .name = TYPE_XILINX_AXI_ENET_CONTROL_STREAM, @@ -1087,12 +1089,6 @@ static const TypeInfo xilinx_enet_control_stream_info = { { } } }; +TYPE_INFO(xilinx_enet_control_stream_info) -static void xilinx_enet_register_types(void) -{ - type_register_static(&xilinx_enet_info); - type_register_static(&xilinx_enet_data_stream_info); - type_register_static(&xilinx_enet_control_stream_info); -} -type_init(xilinx_enet_register_types) diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 71d16fef3d..735236cb0d 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -272,10 +272,6 @@ static const TypeInfo xilinx_ethlite_info = { .instance_init = xilinx_ethlite_init, .class_init = xilinx_ethlite_class_init, }; +TYPE_INFO(xilinx_ethlite_info) -static void xilinx_ethlite_register_types(void) -{ - type_register_static(&xilinx_ethlite_info); -} -type_init(xilinx_ethlite_register_types) diff --git a/hw/nubus/mac-nubus-bridge.c b/hw/nubus/mac-nubus-bridge.c index 7c329300b8..42e32ff107 100644 --- a/hw/nubus/mac-nubus-bridge.c +++ b/hw/nubus/mac-nubus-bridge.c @@ -36,10 +36,6 @@ static const TypeInfo mac_nubus_bridge_info = { .instance_size = sizeof(MacNubusState), .class_init = mac_nubus_bridge_class_init, }; +TYPE_INFO(mac_nubus_bridge_info) -static void mac_nubus_bridge_register_types(void) -{ - type_register_static(&mac_nubus_bridge_info); -} -type_init(mac_nubus_bridge_register_types) diff --git a/hw/nubus/nubus-bridge.c b/hw/nubus/nubus-bridge.c index cd8c6a91eb..678da60ddd 100644 --- a/hw/nubus/nubus-bridge.c +++ b/hw/nubus/nubus-bridge.c @@ -25,10 +25,6 @@ static const TypeInfo nubus_bridge_info = { .instance_size = sizeof(SysBusDevice), .class_init = nubus_bridge_class_init, }; +TYPE_INFO(nubus_bridge_info) -static void nubus_register_types(void) -{ - type_register_static(&nubus_bridge_info); -} -type_init(nubus_register_types) diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c index 942a6d5342..0b44ce3c34 100644 --- a/hw/nubus/nubus-bus.c +++ b/hw/nubus/nubus-bus.c @@ -102,10 +102,6 @@ static const TypeInfo nubus_bus_info = { .instance_init = nubus_init, .class_init = nubus_class_init, }; +TYPE_INFO(nubus_bus_info) -static void nubus_register_types(void) -{ - type_register_static(&nubus_bus_info); -} -type_init(nubus_register_types) diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index ffe78a8823..5a2f5a55d5 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -206,10 +206,6 @@ static const TypeInfo nubus_device_type_info = { .instance_size = sizeof(NubusDevice), .class_init = nubus_device_class_init, }; +TYPE_INFO(nubus_device_type_info) -static void nubus_register_types(void) -{ - type_register_static(&nubus_device_type_info); -} -type_init(nubus_register_types) diff --git a/hw/nvram/ds1225y.c b/hw/nvram/ds1225y.c index d5cb922287..6daef757aa 100644 --- a/hw/nvram/ds1225y.c +++ b/hw/nvram/ds1225y.c @@ -162,10 +162,6 @@ static const TypeInfo nvram_sysbus_info = { .instance_size = sizeof(SysBusNvRamState), .class_init = nvram_sysbus_class_init, }; +TYPE_INFO(nvram_sysbus_info) -static void nvram_register_types(void) -{ - type_register_static(&nvram_sysbus_info); -} -type_init(nvram_register_types) diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c index d46a2bec3f..95582d67a7 100644 --- a/hw/nvram/eeprom_at24c.c +++ b/hw/nvram/eeprom_at24c.c @@ -194,10 +194,6 @@ const TypeInfo at24c_eeprom_type = { .class_size = sizeof(I2CSlaveClass), .class_init = at24c_eeprom_class_init, }; +TYPE_INFO(at24c_eeprom_type) -static void at24c_eeprom_register(void) -{ - type_register_static(&at24c_eeprom_type); -} -type_init(at24c_eeprom_register) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index f3a4728288..0615197196 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -1224,6 +1224,7 @@ static const TypeInfo fw_cfg_info = { .instance_size = sizeof(FWCfgState), .class_init = fw_cfg_class_init, }; +TYPE_INFO(fw_cfg_info) static void fw_cfg_file_slots_allocate(FWCfgState *s, Error **errp) { @@ -1297,6 +1298,7 @@ static const TypeInfo fw_cfg_io_info = { .instance_size = sizeof(FWCfgIoState), .class_init = fw_cfg_io_class_init, }; +TYPE_INFO(fw_cfg_io_info) static Property fw_cfg_mem_properties[] = { @@ -1359,19 +1361,13 @@ static const TypeInfo fw_cfg_mem_info = { .instance_size = sizeof(FWCfgMemState), .class_init = fw_cfg_mem_class_init, }; +TYPE_INFO(fw_cfg_mem_info) static const TypeInfo fw_cfg_data_generator_interface_info = { .parent = TYPE_INTERFACE, .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE, .class_size = sizeof(FWCfgDataGeneratorClass), }; +TYPE_INFO(fw_cfg_data_generator_interface_info) -static void fw_cfg_register_types(void) -{ - type_register_static(&fw_cfg_info); - type_register_static(&fw_cfg_io_info); - type_register_static(&fw_cfg_mem_info); - type_register_static(&fw_cfg_data_generator_interface_info); -} -type_init(fw_cfg_register_types) diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c index beec1c4e4d..4ab7b31761 100644 --- a/hw/nvram/mac_nvram.c +++ b/hw/nvram/mac_nvram.c @@ -127,11 +127,8 @@ static const TypeInfo macio_nvram_type_info = { .instance_size = sizeof(MacIONVRAMState), .class_init = macio_nvram_class_init, }; +TYPE_INFO(macio_nvram_type_info) -static void macio_nvram_register_types(void) -{ - type_register_static(&macio_nvram_type_info); -} /* Set up a system OpenBIOS NVRAM partition */ static void pmac_format_nvram_partition_of(MacIONVRAMState *nvr, int off, @@ -182,4 +179,3 @@ void pmac_format_nvram_partition(MacIONVRAMState *nvr, int len) pmac_format_nvram_partition_of(nvr, 0, len / 2); pmac_format_nvram_partition_osx(nvr, len / 2, len / 2); } -type_init(macio_nvram_register_types) diff --git a/hw/nvram/nrf51_nvm.c b/hw/nvram/nrf51_nvm.c index f2283c1a8d..c410a4c483 100644 --- a/hw/nvram/nrf51_nvm.c +++ b/hw/nvram/nrf51_nvm.c @@ -382,10 +382,6 @@ static const TypeInfo nrf51_nvm_info = { .instance_init = nrf51_nvm_init, .class_init = nrf51_nvm_class_init }; +TYPE_INFO(nrf51_nvm_info) -static void nrf51_nvm_register_types(void) -{ - type_register_static(&nrf51_nvm_info); -} -type_init(nrf51_nvm_register_types) diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c index 15d08281d4..f2b095480b 100644 --- a/hw/nvram/spapr_nvram.c +++ b/hw/nvram/spapr_nvram.c @@ -281,10 +281,6 @@ static const TypeInfo spapr_nvram_type_info = { .instance_size = sizeof(SpaprNvram), .class_init = spapr_nvram_class_init, }; +TYPE_INFO(spapr_nvram_type_info) -static void spapr_nvram_register_types(void) -{ - type_register_static(&spapr_nvram_type_info); -} -type_init(spapr_nvram_register_types) diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c index 677a310b96..b36e7f90a3 100644 --- a/hw/pci-bridge/dec.c +++ b/hw/pci-bridge/dec.c @@ -76,6 +76,7 @@ static const TypeInfo dec_21154_pci_bridge_info = { { }, }, }; +TYPE_INFO(dec_21154_pci_bridge_info) PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn) { @@ -138,6 +139,7 @@ static const TypeInfo dec_21154_pci_host_info = { { }, }, }; +TYPE_INFO(dec_21154_pci_host_info) static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data) { @@ -152,12 +154,6 @@ static const TypeInfo pci_dec_21154_device_info = { .instance_size = sizeof(DECState), .class_init = pci_dec_21154_device_class_init, }; +TYPE_INFO(pci_dec_21154_device_info) -static void dec_register_types(void) -{ - type_register_static(&pci_dec_21154_device_info); - type_register_static(&dec_21154_pci_host_info); - type_register_static(&dec_21154_pci_bridge_info); -} -type_init(dec_register_types) diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c index 2b3907655b..1ff0c82142 100644 --- a/hw/pci-bridge/i82801b11.c +++ b/hw/pci-bridge/i82801b11.c @@ -113,10 +113,6 @@ static const TypeInfo i82801b11_bridge_info = { { }, }, }; +TYPE_INFO(i82801b11_bridge_info) -static void d2pbr_register(void) -{ - type_register_static(&i82801b11_bridge_info); -} -type_init(d2pbr_register); diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c index f1e16135a3..c16bb0aafc 100644 --- a/hw/pci-bridge/ioh3420.c +++ b/hw/pci-bridge/ioh3420.c @@ -121,10 +121,6 @@ static const TypeInfo ioh3420_info = { .parent = TYPE_PCIE_ROOT_PORT, .class_init = ioh3420_class_init, }; +TYPE_INFO(ioh3420_info) -static void ioh3420_register_types(void) -{ - type_register_static(&ioh3420_info); -} -type_init(ioh3420_register_types) diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c index 4a080b7c7b..d080a0ca18 100644 --- a/hw/pci-bridge/pci_bridge_dev.c +++ b/hw/pci-bridge/pci_bridge_dev.c @@ -278,6 +278,7 @@ static const TypeInfo pci_bridge_dev_info = { { } } }; +TYPE_INFO(pci_bridge_dev_info) /* * Multiseat bridge. Same as the standard pci bridge, only with a @@ -299,11 +300,6 @@ static const TypeInfo pci_bridge_dev_seat_info = { .instance_size = sizeof(PCIBridgeDev), .class_init = pci_bridge_dev_seat_class_init, }; +TYPE_INFO(pci_bridge_dev_seat_info) -static void pci_bridge_dev_register(void) -{ - type_register_static(&pci_bridge_dev_info); - type_register_static(&pci_bridge_dev_seat_info); -} -type_init(pci_bridge_dev_register); diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index 22f9fc223b..4c19a5051b 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -90,6 +90,7 @@ static const TypeInfo pxb_bus_info = { .instance_size = sizeof(PXBBus), .class_init = pxb_bus_class_init, }; +TYPE_INFO(pxb_bus_info) static const TypeInfo pxb_pcie_bus_info = { .name = TYPE_PXB_PCIE_BUS, @@ -97,6 +98,7 @@ static const TypeInfo pxb_pcie_bus_info = { .instance_size = sizeof(PXBBus), .class_init = pxb_bus_class_init, }; +TYPE_INFO(pxb_pcie_bus_info) static const char *pxb_host_root_bus_path(PCIHostState *host_bridge, PCIBus *rootbus) @@ -157,6 +159,7 @@ static const TypeInfo pxb_host_info = { .parent = TYPE_PCI_HOST_BRIDGE, .class_init = pxb_host_class_init, }; +TYPE_INFO(pxb_host_info) /* * Registers the PXB bus as a child of pci host root bus. @@ -324,6 +327,7 @@ static const TypeInfo pxb_dev_info = { { }, }, }; +TYPE_INFO(pxb_dev_info) static void pxb_pcie_dev_realize(PCIDevice *dev, Error **errp) { @@ -362,14 +366,6 @@ static const TypeInfo pxb_pcie_dev_info = { { }, }, }; +TYPE_INFO(pxb_pcie_dev_info) -static void pxb_register_types(void) -{ - type_register_static(&pxb_bus_info); - type_register_static(&pxb_pcie_bus_info); - type_register_static(&pxb_host_info); - type_register_static(&pxb_dev_info); - type_register_static(&pxb_pcie_dev_info); -} -type_init(pxb_register_types) diff --git a/hw/pci-bridge/pcie_pci_bridge.c b/hw/pci-bridge/pcie_pci_bridge.c index eade133968..00b30b2a4b 100644 --- a/hw/pci-bridge/pcie_pci_bridge.c +++ b/hw/pci-bridge/pcie_pci_bridge.c @@ -171,10 +171,6 @@ static const TypeInfo pcie_pci_bridge_info = { { }, } }; +TYPE_INFO(pcie_pci_bridge_info) -static void pciepci_register(void) -{ - type_register_static(&pcie_pci_bridge_info); -} -type_init(pciepci_register); diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c index f1cfe9d14a..b48d4b0ef1 100644 --- a/hw/pci-bridge/pcie_root_port.c +++ b/hw/pci-bridge/pcie_root_port.c @@ -189,10 +189,6 @@ static const TypeInfo rp_info = { { } }, }; +TYPE_INFO(rp_info) -static void rp_register_types(void) -{ - type_register_static(&rp_info); -} -type_init(rp_register_types) diff --git a/hw/pci-bridge/simba.c b/hw/pci-bridge/simba.c index ba55ab1939..c2783b3c0e 100644 --- a/hw/pci-bridge/simba.c +++ b/hw/pci-bridge/simba.c @@ -93,10 +93,6 @@ static const TypeInfo simba_pci_bridge_info = { { }, }, }; +TYPE_INFO(simba_pci_bridge_info) -static void simba_register_types(void) -{ - type_register_static(&simba_pci_bridge_info); -} -type_init(simba_register_types) diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c index 04aae72cd6..1ff57a0358 100644 --- a/hw/pci-bridge/xio3130_downstream.c +++ b/hw/pci-bridge/xio3130_downstream.c @@ -181,10 +181,6 @@ static const TypeInfo xio3130_downstream_info = { { } }, }; +TYPE_INFO(xio3130_downstream_info) -static void xio3130_downstream_register_types(void) -{ - type_register_static(&xio3130_downstream_info); -} -type_init(xio3130_downstream_register_types) diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c index 5cd3af4fbc..4fe1695278 100644 --- a/hw/pci-bridge/xio3130_upstream.c +++ b/hw/pci-bridge/xio3130_upstream.c @@ -150,10 +150,6 @@ static const TypeInfo xio3130_upstream_info = { { } }, }; +TYPE_INFO(xio3130_upstream_info) -static void xio3130_upstream_register_types(void) -{ - type_register_static(&xio3130_upstream_info); -} -type_init(xio3130_upstream_register_types) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 1405b3fc70..ea7e30155c 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -788,6 +788,7 @@ static const TypeInfo bonito_info = { { }, }, }; +TYPE_INFO(bonito_info) static void bonito_pcihost_class_init(ObjectClass *klass, void *data) { @@ -802,11 +803,6 @@ static const TypeInfo bonito_pcihost_info = { .instance_size = sizeof(BonitoState), .class_init = bonito_pcihost_class_init, }; +TYPE_INFO(bonito_pcihost_info) -static void bonito_register_types(void) -{ - type_register_static(&bonito_pcihost_info); - type_register_static(&bonito_info); -} -type_init(bonito_register_types) diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c index 8492c18991..d96f3a3a3a 100644 --- a/hw/pci-host/designware.c +++ b/hw/pci-host/designware.c @@ -737,6 +737,7 @@ static const TypeInfo designware_pcie_root_info = { { } }, }; +TYPE_INFO(designware_pcie_root_info) static const TypeInfo designware_pcie_host_info = { .name = TYPE_DESIGNWARE_PCIE_HOST, @@ -745,10 +746,5 @@ static const TypeInfo designware_pcie_host_info = { .instance_init = designware_pcie_host_init, .class_init = designware_pcie_host_class_init, }; +TYPE_INFO(designware_pcie_host_info) -static void designware_pcie_register(void) -{ - type_register_static(&designware_pcie_root_info); - type_register_static(&designware_pcie_host_info); -} -type_init(designware_pcie_register) diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c index 2bdbe7b456..fa1d12744e 100644 --- a/hw/pci-host/gpex.c +++ b/hw/pci-host/gpex.c @@ -136,6 +136,7 @@ static const TypeInfo gpex_host_info = { .instance_init = gpex_host_initfn, .class_init = gpex_host_class_init, }; +TYPE_INFO(gpex_host_info) /**************************************************************************** * GPEX Root D0:F0 @@ -180,11 +181,6 @@ static const TypeInfo gpex_root_info = { { }, }, }; +TYPE_INFO(gpex_root_info) -static void gpex_register(void) -{ - type_register_static(&gpex_root_info); - type_register_static(&gpex_host_info); -} -type_init(gpex_register) diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c index 4b3af0c704..066dc773e2 100644 --- a/hw/pci-host/grackle.c +++ b/hw/pci-host/grackle.c @@ -149,6 +149,7 @@ static const TypeInfo grackle_pci_info = { { }, }, }; +TYPE_INFO(grackle_pci_info) static char *grackle_ofw_unit_address(const SysBusDevice *dev) { @@ -181,11 +182,6 @@ static const TypeInfo grackle_host_info = { .instance_init = grackle_init, .class_init = grackle_class_init, }; +TYPE_INFO(grackle_host_info) -static void grackle_register_types(void) -{ - type_register_static(&grackle_pci_info); - type_register_static(&grackle_host_info); -} -type_init(grackle_register_types) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 8ed2417f0c..56ac1089b6 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -369,6 +369,7 @@ static const TypeInfo i440fx_info = { { }, }, }; +TYPE_INFO(i440fx_info) static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge, PCIBus *rootbus) @@ -410,11 +411,6 @@ static const TypeInfo i440fx_pcihost_info = { .instance_init = i440fx_pcihost_initfn, .class_init = i440fx_pcihost_class_init, }; +TYPE_INFO(i440fx_pcihost_info) -static void i440fx_register_types(void) -{ - type_register_static(&i440fx_info); - type_register_static(&i440fx_pcihost_info); -} -type_init(i440fx_register_types) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 82132c12ca..171e4e1c71 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -893,6 +893,7 @@ static const TypeInfo pnv_phb3_iommu_memory_region_info = { .name = TYPE_PNV_PHB3_IOMMU_MEMORY_REGION, .class_init = pnv_phb3_iommu_memory_region_class_init, }; +TYPE_INFO(pnv_phb3_iommu_memory_region_info) /* * MSI/MSIX memory region implementation. @@ -1113,6 +1114,7 @@ static const TypeInfo pnv_phb3_type_info = { .class_init = pnv_phb3_class_init, .instance_init = pnv_phb3_instance_init, }; +TYPE_INFO(pnv_phb3_type_info) static void pnv_phb3_root_bus_class_init(ObjectClass *klass, void *data) { @@ -1134,6 +1136,7 @@ static const TypeInfo pnv_phb3_root_bus_info = { { } }, }; +TYPE_INFO(pnv_phb3_root_bus_info) static void pnv_phb3_root_port_realize(DeviceState *dev, Error **errp) { @@ -1173,13 +1176,6 @@ static const TypeInfo pnv_phb3_root_port_info = { .instance_size = sizeof(PnvPHB3RootPort), .class_init = pnv_phb3_root_port_class_init, }; +TYPE_INFO(pnv_phb3_root_port_info) -static void pnv_phb3_register_types(void) -{ - type_register_static(&pnv_phb3_root_bus_info); - type_register_static(&pnv_phb3_root_port_info); - type_register_static(&pnv_phb3_type_info); - type_register_static(&pnv_phb3_iommu_memory_region_info); -} -type_init(pnv_phb3_register_types) diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c index 099d2092a2..a57a34c405 100644 --- a/hw/pci-host/pnv_phb3_msi.c +++ b/hw/pci-host/pnv_phb3_msi.c @@ -310,13 +310,9 @@ static const TypeInfo phb3_msi_info = { .class_size = sizeof(ICSStateClass), .instance_init = phb3_msi_instance_init, }; +TYPE_INFO(phb3_msi_info) -static void pnv_phb3_msi_register_types(void) -{ - type_register_static(&phb3_msi_info); -} -type_init(pnv_phb3_msi_register_types); void pnv_phb3_msi_pic_print_info(Phb3MsiState *msi, Monitor *mon) { diff --git a/hw/pci-host/pnv_phb3_pbcq.c b/hw/pci-host/pnv_phb3_pbcq.c index a0526aa1ec..edb7eb1f70 100644 --- a/hw/pci-host/pnv_phb3_pbcq.c +++ b/hw/pci-host/pnv_phb3_pbcq.c @@ -349,10 +349,6 @@ static const TypeInfo pnv_pbcq_type_info = { { } } }; +TYPE_INFO(pnv_pbcq_type_info) -static void pnv_pbcq_register_types(void) -{ - type_register_static(&pnv_pbcq_type_info); -} -type_init(pnv_pbcq_register_types) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 75ad766fe0..6e8c45e200 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1058,6 +1058,7 @@ static const TypeInfo pnv_phb4_iommu_memory_region_info = { .name = TYPE_PNV_PHB4_IOMMU_MEMORY_REGION, .class_init = pnv_phb4_iommu_memory_region_class_init, }; +TYPE_INFO(pnv_phb4_iommu_memory_region_info) /* * MSI/MSIX memory region implementation. @@ -1301,6 +1302,7 @@ static const TypeInfo pnv_phb4_type_info = { { }, } }; +TYPE_INFO(pnv_phb4_type_info) static void pnv_phb4_root_bus_class_init(ObjectClass *klass, void *data) { @@ -1322,6 +1324,7 @@ static const TypeInfo pnv_phb4_root_bus_info = { { } }, }; +TYPE_INFO(pnv_phb4_root_bus_info) static void pnv_phb4_root_port_reset(DeviceState *dev) { @@ -1385,16 +1388,9 @@ static const TypeInfo pnv_phb4_root_port_info = { .instance_size = sizeof(PnvPHB4RootPort), .class_init = pnv_phb4_root_port_class_init, }; +TYPE_INFO(pnv_phb4_root_port_info) -static void pnv_phb4_register_types(void) -{ - type_register_static(&pnv_phb4_root_bus_info); - type_register_static(&pnv_phb4_root_port_info); - type_register_static(&pnv_phb4_type_info); - type_register_static(&pnv_phb4_iommu_memory_region_info); -} -type_init(pnv_phb4_register_types); void pnv_phb4_update_regions(PnvPhb4PecStack *stack) { diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 741ddc90ed..dcbbce0d20 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -513,6 +513,7 @@ static const TypeInfo pnv_pec_type_info = { { } } }; +TYPE_INFO(pnv_pec_type_info) static void pnv_pec_stk_instance_init(Object *obj) { @@ -583,11 +584,6 @@ static const TypeInfo pnv_pec_stk_type_info = { { } } }; +TYPE_INFO(pnv_pec_stk_type_info) -static void pnv_pec_register_types(void) -{ - type_register_static(&pnv_pec_type_info); - type_register_static(&pnv_pec_stk_type_info); -} -type_init(pnv_pec_register_types); diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c index d71072731d..c2a8527521 100644 --- a/hw/pci-host/ppce500.c +++ b/hw/pci-host/ppce500.c @@ -518,6 +518,7 @@ static const TypeInfo e500_host_bridge_info = { { }, }, }; +TYPE_INFO(e500_host_bridge_info) static Property pcihost_properties[] = { DEFINE_PROP_UINT32("first_slot", PPCE500PCIState, first_slot, 0x11), @@ -541,11 +542,6 @@ static const TypeInfo e500_pcihost_info = { .instance_size = sizeof(PPCE500PCIState), .class_init = e500_pcihost_class_init, }; +TYPE_INFO(e500_pcihost_info) -static void e500_pci_register_types(void) -{ - type_register_static(&e500_pcihost_info); - type_register_static(&e500_host_bridge_info); -} -type_init(e500_pci_register_types) diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index 4b93fd2b01..5de4ab83f9 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -395,6 +395,7 @@ static const TypeInfo raven_info = { { }, }, }; +TYPE_INFO(raven_info) static Property raven_pcihost_properties[] = { DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine, @@ -423,11 +424,6 @@ static const TypeInfo raven_pcihost_info = { .instance_init = raven_pcihost_initfn, .class_init = raven_pcihost_class_init, }; +TYPE_INFO(raven_pcihost_info) -static void raven_register_types(void) -{ - type_register_static(&raven_pcihost_info); - type_register_static(&raven_info); -} -type_init(raven_register_types) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index b67cb9c29f..df0e50d1b9 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -261,6 +261,7 @@ static const TypeInfo q35_host_info = { .instance_init = q35_host_initfn, .class_init = q35_host_class_init, }; +TYPE_INFO(q35_host_info) /**************************************************************************** * MCH D0:F0 @@ -706,11 +707,6 @@ static const TypeInfo mch_info = { { }, }, }; +TYPE_INFO(mch_info) -static void q35_register(void) -{ - type_register_static(&mch_info); - type_register_static(&q35_host_info); -} -type_init(q35_register); diff --git a/hw/pci-host/sabre.c b/hw/pci-host/sabre.c index 0cc68585f8..5a67f55a11 100644 --- a/hw/pci-host/sabre.c +++ b/hw/pci-host/sabre.c @@ -499,6 +499,7 @@ static const TypeInfo sabre_pci_info = { { }, }, }; +TYPE_INFO(sabre_pci_info) static char *sabre_ofw_unit_address(const SysBusDevice *dev) { @@ -535,11 +536,6 @@ static const TypeInfo sabre_info = { .instance_init = sabre_init, .class_init = sabre_class_init, }; +TYPE_INFO(sabre_info) -static void sabre_register_types(void) -{ - type_register_static(&sabre_info); - type_register_static(&sabre_pci_info); -} -type_init(sabre_register_types) diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c index 1ed1072eeb..b1aa37101b 100644 --- a/hw/pci-host/uninorth.c +++ b/hw/pci-host/uninorth.c @@ -380,6 +380,7 @@ static const TypeInfo unin_main_pci_host_info = { { }, }, }; +TYPE_INFO(unin_main_pci_host_info) static void u3_agp_pci_host_class_init(ObjectClass *klass, void *data) { @@ -408,6 +409,7 @@ static const TypeInfo u3_agp_pci_host_info = { { }, }, }; +TYPE_INFO(u3_agp_pci_host_info) static void unin_agp_pci_host_class_init(ObjectClass *klass, void *data) { @@ -436,6 +438,7 @@ static const TypeInfo unin_agp_pci_host_info = { { }, }, }; +TYPE_INFO(unin_agp_pci_host_info) static void unin_internal_pci_host_class_init(ObjectClass *klass, void *data) { @@ -464,6 +467,7 @@ static const TypeInfo unin_internal_pci_host_info = { { }, }, }; +TYPE_INFO(unin_internal_pci_host_info) static Property pci_unin_main_pci_host_props[] = { DEFINE_PROP_UINT32("ofw-addr", UNINHostState, ofw_addr, -1), @@ -489,6 +493,7 @@ static const TypeInfo pci_unin_main_info = { .instance_init = pci_unin_main_init, .class_init = pci_unin_main_class_init, }; +TYPE_INFO(pci_unin_main_info) static void pci_u3_agp_class_init(ObjectClass *klass, void *data) { @@ -505,6 +510,7 @@ static const TypeInfo pci_u3_agp_info = { .instance_init = pci_u3_agp_init, .class_init = pci_u3_agp_class_init, }; +TYPE_INFO(pci_u3_agp_info) static void pci_unin_agp_class_init(ObjectClass *klass, void *data) { @@ -521,6 +527,7 @@ static const TypeInfo pci_unin_agp_info = { .instance_init = pci_unin_agp_init, .class_init = pci_unin_agp_class_init, }; +TYPE_INFO(pci_unin_agp_info) static void pci_unin_internal_class_init(ObjectClass *klass, void *data) { @@ -537,6 +544,7 @@ static const TypeInfo pci_unin_internal_info = { .instance_init = pci_unin_internal_init, .class_init = pci_unin_internal_class_init, }; +TYPE_INFO(pci_unin_internal_info) /* UniN device */ static void unin_write(void *opaque, hwaddr addr, uint64_t value, @@ -592,20 +600,12 @@ static const TypeInfo unin_info = { .instance_init = unin_init, .class_init = unin_class_init, }; +TYPE_INFO(unin_info) static void unin_register_types(void) { - type_register_static(&unin_main_pci_host_info); - type_register_static(&u3_agp_pci_host_info); - type_register_static(&unin_agp_pci_host_info); - type_register_static(&unin_internal_pci_host_info); - type_register_static(&pci_unin_main_info); - type_register_static(&pci_u3_agp_info); - type_register_static(&pci_unin_agp_info); - type_register_static(&pci_unin_internal_info); - type_register_static(&unin_info); } type_init(unin_register_types) diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index 7e4aa467a2..fd71ae8d19 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -494,6 +494,7 @@ static const TypeInfo versatile_pci_host_info = { { }, }, }; +TYPE_INFO(versatile_pci_host_info) static Property pci_vpb_properties[] = { DEFINE_PROP_UINT8("broken-irq-mapping", PCIVPBState, irq_mapping_prop, @@ -518,6 +519,7 @@ static const TypeInfo pci_vpb_info = { .instance_init = pci_vpb_init, .class_init = pci_vpb_class_init, }; +TYPE_INFO(pci_vpb_info) static void pci_realview_init(Object *obj) { @@ -535,12 +537,6 @@ static const TypeInfo pci_realview_info = { .parent = TYPE_VERSATILE_PCI, .instance_init = pci_realview_init, }; +TYPE_INFO(pci_realview_info) -static void versatile_pci_register_types(void) -{ - type_register_static(&pci_vpb_info); - type_register_static(&pci_realview_info); - type_register_static(&versatile_pci_host_info); -} -type_init(versatile_pci_register_types) diff --git a/hw/pci-host/xen_igd_pt.c b/hw/pci-host/xen_igd_pt.c index d094b675d6..27e2e475c6 100644 --- a/hw/pci-host/xen_igd_pt.c +++ b/hw/pci-host/xen_igd_pt.c @@ -110,10 +110,6 @@ static const TypeInfo igd_passthrough_i440fx_info = { .instance_size = sizeof(PCII440FXState), .class_init = igd_passthrough_i440fx_class_init, }; +TYPE_INFO(igd_passthrough_i440fx_info) -static void igd_pt_i440fx_register_types(void) -{ - type_register_static(&igd_passthrough_i440fx_info); -} -type_init(igd_pt_i440fx_register_types) diff --git a/hw/pci-host/xilinx-pcie.c b/hw/pci-host/xilinx-pcie.c index 3b321421b6..896a0d7b22 100644 --- a/hw/pci-host/xilinx-pcie.c +++ b/hw/pci-host/xilinx-pcie.c @@ -185,6 +185,7 @@ static const TypeInfo xilinx_pcie_host_info = { .instance_init = xilinx_pcie_host_init, .class_init = xilinx_pcie_host_class_init, }; +TYPE_INFO(xilinx_pcie_host_info) static uint32_t xilinx_pcie_root_config_read(PCIDevice *d, uint32_t address, int len) @@ -321,11 +322,6 @@ static const TypeInfo xilinx_pcie_root_info = { { } }, }; +TYPE_INFO(xilinx_pcie_root_info) -static void xilinx_pcie_register(void) -{ - type_register_static(&xilinx_pcie_root_info); - type_register_static(&xilinx_pcie_host_info); -} -type_init(xilinx_pcie_register) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index de0fae10ab..938a307b86 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -191,16 +191,19 @@ static const TypeInfo pci_bus_info = { .class_size = sizeof(PCIBusClass), .class_init = pci_bus_class_init, }; +TYPE_INFO(pci_bus_info) static const TypeInfo pcie_interface_info = { .name = INTERFACE_PCIE_DEVICE, .parent = TYPE_INTERFACE, }; +TYPE_INFO(pcie_interface_info) static const TypeInfo conventional_pci_interface_info = { .name = INTERFACE_CONVENTIONAL_PCI_DEVICE, .parent = TYPE_INTERFACE, }; +TYPE_INFO(conventional_pci_interface_info) static void pcie_bus_class_init(ObjectClass *klass, void *data) { @@ -214,6 +217,7 @@ static const TypeInfo pcie_bus_info = { .parent = TYPE_PCI_BUS, .class_init = pcie_bus_class_init, }; +TYPE_INFO(pcie_bus_info) static PCIBus *pci_find_bus_nr(PCIBus *bus, int bus_num); static void pci_update_mappings(PCIDevice *d); @@ -2824,14 +2828,6 @@ static const TypeInfo pci_device_type_info = { .class_init = pci_device_class_init, .class_base_init = pci_device_class_base_init, }; +TYPE_INFO(pci_device_type_info) -static void pci_register_types(void) -{ - type_register_static(&pci_bus_info); - type_register_static(&pcie_bus_info); - type_register_static(&conventional_pci_interface_info); - type_register_static(&pcie_interface_info); - type_register_static(&pci_device_type_info); -} -type_init(pci_register_types) diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index 3789c17edc..622779a55c 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -473,10 +473,6 @@ static const TypeInfo pci_bridge_type_info = { .instance_size = sizeof(PCIBridge), .abstract = true, }; +TYPE_INFO(pci_bridge_type_info) -static void pci_bridge_register_types(void) -{ - type_register_static(&pci_bridge_type_info); -} -type_init(pci_bridge_register_types) diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c index 8ca5fadcbd..9348314164 100644 --- a/hw/pci/pci_host.c +++ b/hw/pci/pci_host.c @@ -240,10 +240,6 @@ static const TypeInfo pci_host_type_info = { .instance_size = sizeof(PCIHostState), .class_init = pci_host_class_init, }; +TYPE_INFO(pci_host_type_info) -static void pci_host_register_types(void) -{ - type_register_static(&pci_host_type_info); -} -type_init(pci_host_register_types) diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c index 3534006f99..5f0136694b 100644 --- a/hw/pci/pcie_host.c +++ b/hw/pci/pcie_host.c @@ -128,10 +128,6 @@ static const TypeInfo pcie_host_type_info = { .instance_size = sizeof(PCIExpressHost), .instance_init = pcie_host_init, }; +TYPE_INFO(pcie_host_type_info) -static void pcie_host_register_types(void) -{ - type_register_static(&pcie_host_type_info); -} -type_init(pcie_host_register_types) diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c index eb563ad435..dee5065217 100644 --- a/hw/pci/pcie_port.c +++ b/hw/pci/pcie_port.c @@ -143,6 +143,7 @@ static const TypeInfo pcie_port_type_info = { .abstract = true, .class_init = pcie_port_class_init, }; +TYPE_INFO(pcie_port_type_info) static Property pcie_slot_props[] = { DEFINE_PROP_UINT8("chassis", PCIESlot, chassis, 0), @@ -174,11 +175,6 @@ static const TypeInfo pcie_slot_type_info = { { } } }; +TYPE_INFO(pcie_slot_type_info) -static void pcie_port_register_types(void) -{ - type_register_static(&pcie_port_type_info); - type_register_static(&pcie_slot_type_info); -} -type_init(pcie_port_register_types) diff --git a/hw/pcmcia/pcmcia.c b/hw/pcmcia/pcmcia.c index 03d13e7d67..c53a1ab47e 100644 --- a/hw/pcmcia/pcmcia.c +++ b/hw/pcmcia/pcmcia.c @@ -15,10 +15,6 @@ static const TypeInfo pcmcia_card_type_info = { .abstract = true, .class_size = sizeof(PCMCIACardClass), }; +TYPE_INFO(pcmcia_card_type_info) -static void pcmcia_register_types(void) -{ - type_register_static(&pcmcia_card_type_info); -} -type_init(pcmcia_register_types) diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c index 5f4bf22a90..73b1ae6d70 100644 --- a/hw/pcmcia/pxa2xx.c +++ b/hw/pcmcia/pxa2xx.c @@ -258,10 +258,6 @@ static const TypeInfo pxa2xx_pcmcia_type_info = { .instance_size = sizeof(PXA2xxPCMCIAState), .instance_init = pxa2xx_pcmcia_initfn, }; +TYPE_INFO(pxa2xx_pcmcia_type_info) -static void pxa2xx_pcmcia_register_types(void) -{ - type_register_static(&pxa2xx_pcmcia_type_info); -} -type_init(pxa2xx_pcmcia_register_types) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index ab9884e315..2ddc55e5c5 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -1147,6 +1147,7 @@ static const TypeInfo e500_ccsr_info = { .instance_size = sizeof(PPCE500CCSRState), .instance_init = e500_ccsr_initfn, }; +TYPE_INFO(e500_ccsr_info) static const TypeInfo ppce500_info = { .name = TYPE_PPCE500_MACHINE, @@ -1155,11 +1156,6 @@ static const TypeInfo ppce500_info = { .instance_size = sizeof(PPCE500MachineState), .class_size = sizeof(PPCE500MachineClass), }; +TYPE_INFO(ppce500_info) -static void e500_register_types(void) -{ - type_register_static(&e500_ccsr_info); - type_register_static(&ppce500_info); -} -type_init(e500_register_types) diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c index bddd5e7c48..711c2f04eb 100644 --- a/hw/ppc/e500plat.c +++ b/hw/ppc/e500plat.c @@ -110,9 +110,5 @@ static const TypeInfo e500plat_info = { { } } }; +TYPE_INFO(e500plat_info) -static void e500plat_register_types(void) -{ - type_register_static(&e500plat_info); -} -type_init(e500plat_register_types) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index e42bd7a626..0ce36a743f 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -645,10 +645,6 @@ static const TypeInfo core99_machine_info = { { } }, }; +TYPE_INFO(core99_machine_info) -static void mac_machine_register_types(void) -{ - type_register_static(&core99_machine_info); -} -type_init(mac_machine_register_types) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 7aba040f1b..55e17988ca 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -454,10 +454,6 @@ static const TypeInfo ppc_heathrow_machine_info = { { } }, }; +TYPE_INFO(ppc_heathrow_machine_info) -static void ppc_heathrow_register_types(void) -{ - type_register_static(&ppc_heathrow_machine_info); -} -type_init(ppc_heathrow_register_types); diff --git a/hw/ppc/mpc8544_guts.c b/hw/ppc/mpc8544_guts.c index b96ea36f98..3a2a6f5f5d 100644 --- a/hw/ppc/mpc8544_guts.c +++ b/hw/ppc/mpc8544_guts.c @@ -133,10 +133,6 @@ static const TypeInfo mpc8544_guts_info = { .instance_size = sizeof(GutsState), .instance_init = mpc8544_guts_initfn, }; +TYPE_INFO(mpc8544_guts_info) -static void mpc8544_guts_register_types(void) -{ - type_register_static(&mpc8544_guts_info); -} -type_init(mpc8544_guts_register_types) diff --git a/hw/ppc/mpc8544ds.c b/hw/ppc/mpc8544ds.c index 81177505f0..c9a0d0069d 100644 --- a/hw/ppc/mpc8544ds.c +++ b/hw/ppc/mpc8544ds.c @@ -65,10 +65,6 @@ static const TypeInfo mpc8544ds_info = { .parent = TYPE_PPCE500_MACHINE, .class_init = e500plat_machine_class_init, }; +TYPE_INFO(mpc8544ds_info) -static void mpc8544ds_register_types(void) -{ - type_register_static(&mpc8544ds_info); -} -type_init(mpc8544ds_register_types) diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index 4724ddf96c..06fbe76c5c 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -431,10 +431,6 @@ static const TypeInfo pnv_quad_info = { .instance_size = sizeof(PnvQuad), .class_init = pnv_quad_class_init, }; +TYPE_INFO(pnv_quad_info) -static void pnv_core_register_types(void) -{ - type_register_static(&pnv_quad_info); -} -type_init(pnv_core_register_types) diff --git a/hw/ppc/pnv_homer.c b/hw/ppc/pnv_homer.c index 9a262629b7..08d2d36722 100644 --- a/hw/ppc/pnv_homer.c +++ b/hw/ppc/pnv_homer.c @@ -188,6 +188,7 @@ static const TypeInfo pnv_homer_power8_type_info = { .instance_size = sizeof(PnvHomer), .class_init = pnv_homer_power8_class_init, }; +TYPE_INFO(pnv_homer_power8_type_info) /* P9 Pstate table */ @@ -331,6 +332,7 @@ static const TypeInfo pnv_homer_power9_type_info = { .instance_size = sizeof(PnvHomer), .class_init = pnv_homer_power9_class_init, }; +TYPE_INFO(pnv_homer_power9_type_info) static void pnv_homer_realize(DeviceState *dev, Error **errp) { @@ -371,12 +373,6 @@ static const TypeInfo pnv_homer_type_info = { .class_size = sizeof(PnvHomerClass), .abstract = true, }; +TYPE_INFO(pnv_homer_type_info) -static void pnv_homer_register_types(void) -{ - type_register_static(&pnv_homer_type_info); - type_register_static(&pnv_homer_power8_type_info); - type_register_static(&pnv_homer_power9_type_info); -} -type_init(pnv_homer_register_types); diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c index b5ffa48dac..d6fe6d1d25 100644 --- a/hw/ppc/pnv_lpc.c +++ b/hw/ppc/pnv_lpc.c @@ -653,6 +653,7 @@ static const TypeInfo pnv_lpc_power8_info = { { } } }; +TYPE_INFO(pnv_lpc_power8_info) static void pnv_lpc_power9_realize(DeviceState *dev, Error **errp) { @@ -690,6 +691,7 @@ static const TypeInfo pnv_lpc_power9_info = { .instance_size = sizeof(PnvLpcController), .class_init = pnv_lpc_power9_class_init, }; +TYPE_INFO(pnv_lpc_power9_info) static void pnv_lpc_power10_class_init(ObjectClass *klass, void *data) { @@ -703,6 +705,7 @@ static const TypeInfo pnv_lpc_power10_info = { .parent = TYPE_PNV9_LPC, .class_init = pnv_lpc_power10_class_init, }; +TYPE_INFO(pnv_lpc_power10_info) static void pnv_lpc_realize(DeviceState *dev, Error **errp) { @@ -772,16 +775,9 @@ static const TypeInfo pnv_lpc_info = { .class_size = sizeof(PnvLpcClass), .abstract = true, }; +TYPE_INFO(pnv_lpc_info) -static void pnv_lpc_register_types(void) -{ - type_register_static(&pnv_lpc_info); - type_register_static(&pnv_lpc_power8_info); - type_register_static(&pnv_lpc_power9_info); - type_register_static(&pnv_lpc_power10_info); -} -type_init(pnv_lpc_register_types) /* If we don't use the built-in LPC interrupt deserializer, we need * to provide a set of qirqs for the ISA bus or things will go bad. diff --git a/hw/ppc/pnv_occ.c b/hw/ppc/pnv_occ.c index 5a716c256e..9fde6cde7d 100644 --- a/hw/ppc/pnv_occ.c +++ b/hw/ppc/pnv_occ.c @@ -177,6 +177,7 @@ static const TypeInfo pnv_occ_power8_type_info = { .instance_size = sizeof(PnvOCC), .class_init = pnv_occ_power8_class_init, }; +TYPE_INFO(pnv_occ_power8_type_info) #define P9_OCB_OCI_OCCMISC 0x6080 #define P9_OCB_OCI_OCCMISC_CLEAR 0x6081 @@ -248,6 +249,7 @@ static const TypeInfo pnv_occ_power9_type_info = { .instance_size = sizeof(PnvOCC), .class_init = pnv_occ_power9_class_init, }; +TYPE_INFO(pnv_occ_power9_type_info) static void pnv_occ_realize(DeviceState *dev, Error **errp) { @@ -291,12 +293,6 @@ static const TypeInfo pnv_occ_type_info = { .class_size = sizeof(PnvOCCClass), .abstract = true, }; +TYPE_INFO(pnv_occ_type_info) -static void pnv_occ_register_types(void) -{ - type_register_static(&pnv_occ_type_info); - type_register_static(&pnv_occ_power8_type_info); - type_register_static(&pnv_occ_power9_type_info); -} -type_init(pnv_occ_register_types); diff --git a/hw/ppc/pnv_pnor.c b/hw/ppc/pnv_pnor.c index c365ee58b8..ab549a50ad 100644 --- a/hw/ppc/pnv_pnor.c +++ b/hw/ppc/pnv_pnor.c @@ -132,10 +132,6 @@ static const TypeInfo pnv_pnor_info = { .instance_size = sizeof(PnvPnor), .class_init = pnv_pnor_class_init, }; +TYPE_INFO(pnv_pnor_info) -static void pnv_pnor_register_types(void) -{ - type_register_static(&pnv_pnor_info); -} -type_init(pnv_pnor_register_types) diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c index 6a479cac53..80e5d5b7b1 100644 --- a/hw/ppc/pnv_psi.c +++ b/hw/ppc/pnv_psi.c @@ -589,6 +589,7 @@ static const TypeInfo pnv_psi_power8_info = { .instance_init = pnv_psi_power8_instance_init, .class_init = pnv_psi_power8_class_init, }; +TYPE_INFO(pnv_psi_power8_info) /* Common registers */ @@ -898,6 +899,7 @@ static const TypeInfo pnv_psi_power9_info = { { }, }, }; +TYPE_INFO(pnv_psi_power9_info) static void pnv_psi_power10_class_init(ObjectClass *klass, void *data) { @@ -918,6 +920,7 @@ static const TypeInfo pnv_psi_power10_info = { .parent = TYPE_PNV9_PSI, .class_init = pnv_psi_power10_class_init, }; +TYPE_INFO(pnv_psi_power10_info) static void pnv_psi_class_init(ObjectClass *klass, void *data) { @@ -944,16 +947,9 @@ static const TypeInfo pnv_psi_info = { { } } }; +TYPE_INFO(pnv_psi_info) -static void pnv_psi_register_types(void) -{ - type_register_static(&pnv_psi_info); - type_register_static(&pnv_psi_power8_info); - type_register_static(&pnv_psi_power9_info); - type_register_static(&pnv_psi_power10_info); -} -type_init(pnv_psi_register_types); void pnv_psi_pic_print_info(Pnv9Psi *psi9, Monitor *mon) { diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c index b681c72575..74f1e042c6 100644 --- a/hw/ppc/pnv_xscom.c +++ b/hw/ppc/pnv_xscom.c @@ -240,13 +240,9 @@ static const TypeInfo pnv_xscom_interface_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(PnvXScomInterfaceClass), }; +TYPE_INFO(pnv_xscom_interface_info) -static void pnv_xscom_register_types(void) -{ - type_register_static(&pnv_xscom_interface_info); -} -type_init(pnv_xscom_register_types) typedef struct ForeachPopulateArgs { void *fdt; diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 6198ec1035..d86f8c5f11 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -319,6 +319,7 @@ static const TypeInfo ref405ep_type = { .parent = TYPE_MACHINE, .class_init = ref405ep_class_init, }; +TYPE_INFO(ref405ep_type) /*****************************************************************************/ /* AMCC Taihu evaluation board */ @@ -550,11 +551,6 @@ static const TypeInfo taihu_type = { .parent = TYPE_MACHINE, .class_init = taihu_class_init, }; +TYPE_INFO(taihu_type) -static void ppc405_machine_init(void) -{ - type_register_static(&ref405ep_type); - type_register_static(&taihu_type); -} -type_init(ppc405_machine_init) diff --git a/hw/ppc/ppc440_pcix.c b/hw/ppc/ppc440_pcix.c index 2ee2d4f4fc..37feaa2f06 100644 --- a/hw/ppc/ppc440_pcix.c +++ b/hw/ppc/ppc440_pcix.c @@ -516,10 +516,6 @@ static const TypeInfo ppc440_pcix_info = { .instance_size = sizeof(PPC440PCIXState), .class_init = ppc440_pcix_class_init, }; +TYPE_INFO(ppc440_pcix_info) -static void ppc440_pcix_register_types(void) -{ - type_register_static(&ppc440_pcix_info); -} -type_init(ppc440_pcix_register_types) diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c index 38fc392438..c1167aa6da 100644 --- a/hw/ppc/ppc440_uc.c +++ b/hw/ppc/ppc440_uc.c @@ -1305,13 +1305,9 @@ static const TypeInfo ppc460ex_pcie_host_info = { .instance_size = sizeof(PPC460EXPCIEState), .class_init = ppc460ex_pcie_class_init, }; +TYPE_INFO(ppc460ex_pcie_host_info) -static void ppc460ex_pcie_register(void) -{ - type_register_static(&ppc460ex_pcie_host_info); -} -type_init(ppc460ex_pcie_register) static void ppc460ex_pcie_register_dcrs(PPC460EXPCIEState *s, CPUPPCState *env) { diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c index 3ea47df71f..b22df26c70 100644 --- a/hw/ppc/ppc4xx_pci.c +++ b/hw/ppc/ppc4xx_pci.c @@ -366,6 +366,7 @@ static const TypeInfo ppc4xx_host_bridge_info = { { }, }, }; +TYPE_INFO(ppc4xx_host_bridge_info) static void ppc4xx_pcihost_class_init(ObjectClass *klass, void *data) { @@ -381,11 +382,6 @@ static const TypeInfo ppc4xx_pcihost_info = { .instance_size = sizeof(PPC4xxPCIState), .class_init = ppc4xx_pcihost_class_init, }; +TYPE_INFO(ppc4xx_pcihost_info) -static void ppc4xx_pci_register_types(void) -{ - type_register_static(&ppc4xx_pcihost_info); - type_register_static(&ppc4xx_host_bridge_info); -} -type_init(ppc4xx_pci_register_types) diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index 66c1065db2..a5d13ec583 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -199,10 +199,6 @@ static const TypeInfo ppce500_spin_info = { .instance_init = ppce500_spin_initfn, .class_init = ppce500_spin_class_init, }; +TYPE_INFO(ppce500_spin_info) -static void ppce500_spin_register_types(void) -{ - type_register_static(&ppce500_spin_info); -} -type_init(ppce500_spin_register_types) diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c index bbc51b6e9a..c326518509 100644 --- a/hw/ppc/prep_systemio.c +++ b/hw/ppc/prep_systemio.c @@ -298,10 +298,6 @@ static TypeInfo prep_systemio800_info = { .instance_size = sizeof(PrepSystemIoState), .class_init = prep_systemio_class_initfn, }; +TYPE_INFO(prep_systemio800_info) -static void prep_systemio_register_types(void) -{ - type_register_static(&prep_systemio800_info); -} -type_init(prep_systemio_register_types) diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c index ce97365f5e..a5c32c8ed5 100644 --- a/hw/ppc/rs6000_mc.c +++ b/hw/ppc/rs6000_mc.c @@ -230,10 +230,6 @@ static const TypeInfo rs6000mc_info = { .instance_size = sizeof(RS6000MCState), .class_init = rs6000mc_class_initfn, }; +TYPE_INFO(rs6000mc_info) -static void rs6000mc_types(void) -{ - type_register_static(&rs6000mc_info); -} -type_init(rs6000mc_types) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0ae293ec94..0b5439902f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4551,6 +4551,7 @@ static const TypeInfo spapr_machine_info = { { } }, }; +TYPE_INFO(spapr_machine_info) static void spapr_machine_latest_class_options(MachineClass *mc) { @@ -4988,9 +4989,4 @@ static void spapr_machine_2_1_class_options(MachineClass *mc) } DEFINE_SPAPR_MACHINE(2_1, "2.1", false); -static void spapr_machine_register_types(void) -{ - type_register_static(&spapr_machine_info); -} -type_init(spapr_machine_register_types) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index fe998d8108..2c058a1eb2 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -742,6 +742,7 @@ static const TypeInfo spapr_dr_connector_info = { .class_init = spapr_dr_connector_class_init, .abstract = true, }; +TYPE_INFO(spapr_dr_connector_info) static const TypeInfo spapr_drc_physical_info = { .name = TYPE_SPAPR_DRC_PHYSICAL, @@ -750,6 +751,7 @@ static const TypeInfo spapr_drc_physical_info = { .class_init = spapr_drc_physical_class_init, .abstract = true, }; +TYPE_INFO(spapr_drc_physical_info) static const TypeInfo spapr_drc_logical_info = { .name = TYPE_SPAPR_DRC_LOGICAL, @@ -757,24 +759,28 @@ static const TypeInfo spapr_drc_logical_info = { .class_init = spapr_drc_logical_class_init, .abstract = true, }; +TYPE_INFO(spapr_drc_logical_info) static const TypeInfo spapr_drc_cpu_info = { .name = TYPE_SPAPR_DRC_CPU, .parent = TYPE_SPAPR_DRC_LOGICAL, .class_init = spapr_drc_cpu_class_init, }; +TYPE_INFO(spapr_drc_cpu_info) static const TypeInfo spapr_drc_pci_info = { .name = TYPE_SPAPR_DRC_PCI, .parent = TYPE_SPAPR_DRC_PHYSICAL, .class_init = spapr_drc_pci_class_init, }; +TYPE_INFO(spapr_drc_pci_info) static const TypeInfo spapr_drc_lmb_info = { .name = TYPE_SPAPR_DRC_LMB, .parent = TYPE_SPAPR_DRC_LOGICAL, .class_init = spapr_drc_lmb_class_init, }; +TYPE_INFO(spapr_drc_lmb_info) static const TypeInfo spapr_drc_phb_info = { .name = TYPE_SPAPR_DRC_PHB, @@ -782,12 +788,14 @@ static const TypeInfo spapr_drc_phb_info = { .instance_size = sizeof(SpaprDrc), .class_init = spapr_drc_phb_class_init, }; +TYPE_INFO(spapr_drc_phb_info) static const TypeInfo spapr_drc_pmem_info = { .name = TYPE_SPAPR_DRC_PMEM, .parent = TYPE_SPAPR_DRC_LOGICAL, .class_init = spapr_drc_pmem_class_init, }; +TYPE_INFO(spapr_drc_pmem_info) /* helper functions for external users */ @@ -1252,14 +1260,6 @@ out: static void spapr_drc_register_types(void) { - type_register_static(&spapr_dr_connector_info); - type_register_static(&spapr_drc_physical_info); - type_register_static(&spapr_drc_logical_info); - type_register_static(&spapr_drc_cpu_info); - type_register_static(&spapr_drc_pci_info); - type_register_static(&spapr_drc_lmb_info); - type_register_static(&spapr_drc_phb_info); - type_register_static(&spapr_drc_pmem_info); spapr_rtas_register(RTAS_SET_INDICATOR, "set-indicator", rtas_set_indicator); diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index 0fecabc135..eb21773d69 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -686,6 +686,7 @@ static TypeInfo spapr_tce_table_info = { .instance_size = sizeof(SpaprTceTable), .class_init = spapr_tce_table_class_init, }; +TYPE_INFO(spapr_tce_table_info) static void spapr_iommu_memory_region_class_init(ObjectClass *klass, void *data) { @@ -703,11 +704,6 @@ static const TypeInfo spapr_iommu_memory_region_info = { .name = TYPE_SPAPR_IOMMU_MEMORY_REGION, .class_init = spapr_iommu_memory_region_class_init, }; +TYPE_INFO(spapr_iommu_memory_region_info) -static void register_types(void) -{ - type_register_static(&spapr_tce_table_info); - type_register_static(&spapr_iommu_memory_region_info); -} -type_init(register_types); diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 2f8f7d62f8..e6066b39c0 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -28,6 +28,7 @@ static const TypeInfo spapr_intc_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(SpaprInterruptControllerClass), }; +TYPE_INFO(spapr_intc_info) static void spapr_irq_msi_init(SpaprMachineState *spapr) { @@ -585,9 +586,4 @@ SpaprIrq spapr_irq_xics_legacy = { .xive = false, }; -static void spapr_irq_register_types(void) -{ - type_register_static(&spapr_intc_info); -} -type_init(spapr_irq_register_types) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 363cdb3f7b..7ae68dbf10 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -2243,6 +2243,7 @@ static const TypeInfo spapr_phb_info = { { } } }; +TYPE_INFO(spapr_phb_info) static void spapr_phb_pci_enumerate_bridge(PCIBus *bus, PCIDevice *pdev, void *opaque) @@ -2459,12 +2460,7 @@ void spapr_pci_rtas_init(void) rtas_ibm_slot_error_detail); } -static void spapr_pci_register_types(void) -{ - type_register_static(&spapr_phb_info); -} -type_init(spapr_pci_register_types) static int spapr_switch_one_vga(DeviceState *dev, void *opaque) { diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c index 85bf64d68e..f25a10d26a 100644 --- a/hw/ppc/spapr_rng.c +++ b/hw/ppc/spapr_rng.c @@ -156,9 +156,5 @@ static const TypeInfo spapr_rng_info = { .instance_init = spapr_rng_instance_init, .class_init = spapr_rng_class_init, }; +TYPE_INFO(spapr_rng_info) -static void spapr_rng_register_type(void) -{ - type_register_static(&spapr_rng_info); -} -type_init(spapr_rng_register_type) diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c index 68cfc578a3..4761bc4c76 100644 --- a/hw/ppc/spapr_rtc.c +++ b/hw/ppc/spapr_rtc.c @@ -183,9 +183,5 @@ static const TypeInfo spapr_rtc_info = { .instance_size = sizeof(SpaprRtcState), .class_init = spapr_rtc_class_init, }; +TYPE_INFO(spapr_rtc_info) -static void spapr_rtc_register_types(void) -{ - type_register_static(&spapr_rtc_info); -} -type_init(spapr_rtc_register_types) diff --git a/hw/ppc/spapr_tpm_proxy.c b/hw/ppc/spapr_tpm_proxy.c index a01f81f9e0..a6e4d61cfb 100644 --- a/hw/ppc/spapr_tpm_proxy.c +++ b/hw/ppc/spapr_tpm_proxy.c @@ -168,10 +168,10 @@ static const TypeInfo spapr_tpm_proxy_info = { .instance_size = sizeof(SpaprTpmProxy), .class_init = spapr_tpm_proxy_class_init, }; +TYPE_INFO(spapr_tpm_proxy_info) static void spapr_tpm_proxy_register_types(void) { - type_register_static(&spapr_tpm_proxy_info); spapr_register_hypercall(SVM_H_TPM_COMM, h_tpm_comm); } diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index 731080d989..387f7f196c 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -65,6 +65,7 @@ static const TypeInfo spapr_vio_bus_info = { .class_init = spapr_vio_bus_class_init, .instance_size = sizeof(SpaprVioBus), }; +TYPE_INFO(spapr_vio_bus_info) SpaprVioDevice *spapr_vio_find_by_reg(SpaprVioBus *bus, uint32_t reg) { @@ -613,6 +614,7 @@ static const TypeInfo spapr_vio_bridge_info = { .parent = TYPE_SYS_BUS_DEVICE, .class_init = spapr_vio_bridge_class_init, }; +TYPE_INFO(spapr_vio_bridge_info) const VMStateDescription vmstate_spapr_vio = { .name = "spapr_vio", @@ -649,15 +651,9 @@ static const TypeInfo spapr_vio_type_info = { .class_size = sizeof(SpaprVioDeviceClass), .class_init = vio_spapr_device_class_init, }; +TYPE_INFO(spapr_vio_type_info) -static void spapr_vio_register_types(void) -{ - type_register_static(&spapr_vio_bus_info); - type_register_static(&spapr_vio_bridge_info); - type_register_static(&spapr_vio_type_info); -} -type_init(spapr_vio_register_types) static int compare_reg(const void *p1, const void *p2) { diff --git a/hw/rdma/rdma.c b/hw/rdma/rdma.c index 7bec0d0d2c..969d21fa4d 100644 --- a/hw/rdma/rdma.c +++ b/hw/rdma/rdma.c @@ -21,10 +21,6 @@ static const TypeInfo rdma_hmp_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(RdmaProviderClass), }; +TYPE_INFO(rdma_hmp_info) -static void rdma_register_types(void) -{ - type_register_static(&rdma_hmp_info); -} -type_init(rdma_register_types) diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index 3254aadb6e..0f62d73f82 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -707,10 +707,6 @@ static const TypeInfo pvrdma_info = { { } } }; +TYPE_INFO(pvrdma_info) -static void register_types(void) -{ - type_register_static(&pvrdma_info); -} -type_init(register_types) diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index 23ba3b4bfc..818764aa03 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -196,10 +196,6 @@ static const TypeInfo lowrisc_ibex_soc_type_info = { .instance_init = lowrisc_ibex_soc_init, .class_init = lowrisc_ibex_soc_class_init, }; +TYPE_INFO(lowrisc_ibex_soc_type_info) -static void lowrisc_ibex_soc_register_types(void) -{ - type_register_static(&lowrisc_ibex_soc_type_info); -} -type_init(lowrisc_ibex_soc_register_types) diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c index f59fe52f0f..d2ce03c4e6 100644 --- a/hw/riscv/riscv_hart.c +++ b/hw/riscv/riscv_hart.c @@ -77,10 +77,6 @@ static const TypeInfo riscv_harts_info = { .instance_size = sizeof(RISCVHartArrayState), .class_init = riscv_harts_class_init, }; +TYPE_INFO(riscv_harts_info) -static void riscv_harts_register_types(void) -{ - type_register_static(&riscv_harts_info); -} -type_init(riscv_harts_register_types) diff --git a/hw/riscv/sifive_clint.c b/hw/riscv/sifive_clint.c index 669c21adc2..456a722de5 100644 --- a/hw/riscv/sifive_clint.c +++ b/hw/riscv/sifive_clint.c @@ -215,13 +215,9 @@ static const TypeInfo sifive_clint_info = { .instance_size = sizeof(SiFiveCLINTState), .class_init = sifive_clint_class_init, }; +TYPE_INFO(sifive_clint_info) -static void sifive_clint_register_types(void) -{ - type_register_static(&sifive_clint_info); -} -type_init(sifive_clint_register_types) /* diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index 88b4524117..5750936ed1 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -161,13 +161,9 @@ static const TypeInfo sifive_e_machine_typeinfo = { .instance_init = sifive_e_machine_instance_init, .instance_size = sizeof(SiFiveEState), }; +TYPE_INFO(sifive_e_machine_typeinfo) -static void sifive_e_machine_init_register_types(void) -{ - type_register_static(&sifive_e_machine_typeinfo); -} -type_init(sifive_e_machine_init_register_types) static void sifive_e_soc_init(Object *obj) { @@ -276,10 +272,6 @@ static const TypeInfo sifive_e_soc_type_info = { .instance_init = sifive_e_soc_init, .class_init = sifive_e_soc_class_init, }; +TYPE_INFO(sifive_e_soc_type_info) -static void sifive_e_soc_register_types(void) -{ - type_register_static(&sifive_e_soc_type_info); -} -type_init(sifive_e_soc_register_types) diff --git a/hw/riscv/sifive_e_prci.c b/hw/riscv/sifive_e_prci.c index 17dfa74715..c32f469876 100644 --- a/hw/riscv/sifive_e_prci.c +++ b/hw/riscv/sifive_e_prci.c @@ -104,13 +104,9 @@ static const TypeInfo sifive_e_prci_info = { .instance_size = sizeof(SiFiveEPRCIState), .instance_init = sifive_e_prci_init, }; +TYPE_INFO(sifive_e_prci_info) -static void sifive_e_prci_register_types(void) -{ - type_register_static(&sifive_e_prci_info); -} -type_init(sifive_e_prci_register_types) /* diff --git a/hw/riscv/sifive_gpio.c b/hw/riscv/sifive_gpio.c index aac6b44cac..25a47c7531 100644 --- a/hw/riscv/sifive_gpio.c +++ b/hw/riscv/sifive_gpio.c @@ -388,10 +388,6 @@ static const TypeInfo sifive_gpio_info = { .instance_size = sizeof(SIFIVEGPIOState), .class_init = sifive_gpio_class_init }; +TYPE_INFO(sifive_gpio_info) -static void sifive_gpio_register_types(void) -{ - type_register_static(&sifive_gpio_info); -} -type_init(sifive_gpio_register_types) diff --git a/hw/riscv/sifive_plic.c b/hw/riscv/sifive_plic.c index c20c192034..7235e13ebd 100644 --- a/hw/riscv/sifive_plic.c +++ b/hw/riscv/sifive_plic.c @@ -485,13 +485,9 @@ static const TypeInfo sifive_plic_info = { .instance_size = sizeof(SiFivePLICState), .class_init = sifive_plic_class_init, }; +TYPE_INFO(sifive_plic_info) -static void sifive_plic_register_types(void) -{ - type_register_static(&sifive_plic_info); -} -type_init(sifive_plic_register_types) /* * Create PLIC device. diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c index 0c78fb2c93..d3c646cb69 100644 --- a/hw/riscv/sifive_test.c +++ b/hw/riscv/sifive_test.c @@ -79,13 +79,9 @@ static const TypeInfo sifive_test_info = { .instance_size = sizeof(SiFiveTestState), .instance_init = sifive_test_init, }; +TYPE_INFO(sifive_test_info) -static void sifive_test_register_types(void) -{ - type_register_static(&sifive_test_info); -} -type_init(sifive_test_register_types) /* diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 0dfbcb5160..201950933a 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -571,13 +571,9 @@ static const TypeInfo sifive_u_machine_typeinfo = { .instance_init = sifive_u_machine_instance_init, .instance_size = sizeof(SiFiveUState), }; +TYPE_INFO(sifive_u_machine_typeinfo) -static void sifive_u_machine_init_register_types(void) -{ - type_register_static(&sifive_u_machine_typeinfo); -} -type_init(sifive_u_machine_init_register_types) static void sifive_u_soc_instance_init(Object *obj) { @@ -757,10 +753,6 @@ static const TypeInfo sifive_u_soc_type_info = { .instance_init = sifive_u_soc_instance_init, .class_init = sifive_u_soc_class_init, }; +TYPE_INFO(sifive_u_soc_type_info) -static void sifive_u_soc_register_types(void) -{ - type_register_static(&sifive_u_soc_type_info); -} -type_init(sifive_u_soc_register_types) diff --git a/hw/riscv/sifive_u_otp.c b/hw/riscv/sifive_u_otp.c index f6ecbaa2ca..145f98c25d 100644 --- a/hw/riscv/sifive_u_otp.c +++ b/hw/riscv/sifive_u_otp.c @@ -182,10 +182,6 @@ static const TypeInfo sifive_u_otp_info = { .instance_size = sizeof(SiFiveUOTPState), .class_init = sifive_u_otp_class_init, }; +TYPE_INFO(sifive_u_otp_info) -static void sifive_u_otp_register_types(void) -{ - type_register_static(&sifive_u_otp_info); -} -type_init(sifive_u_otp_register_types) diff --git a/hw/riscv/sifive_u_prci.c b/hw/riscv/sifive_u_prci.c index 4fa590c064..ebddf9c568 100644 --- a/hw/riscv/sifive_u_prci.c +++ b/hw/riscv/sifive_u_prci.c @@ -160,10 +160,6 @@ static const TypeInfo sifive_u_prci_info = { .instance_size = sizeof(SiFiveUPRCIState), .class_init = sifive_u_prci_class_init, }; +TYPE_INFO(sifive_u_prci_info) -static void sifive_u_prci_register_types(void) -{ - type_register_static(&sifive_u_prci_info); -} -type_init(sifive_u_prci_register_types) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 55a907bb35..9c72ae7e25 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -630,10 +630,6 @@ static const TypeInfo virt_machine_typeinfo = { .instance_init = virt_machine_instance_init, .instance_size = sizeof(RISCVVirtState), }; +TYPE_INFO(virt_machine_typeinfo) -static void virt_machine_init_register_types(void) -{ - type_register_static(&virt_machine_typeinfo); -} -type_init(virt_machine_init_register_types) diff --git a/hw/rtc/allwinner-rtc.c b/hw/rtc/allwinner-rtc.c index 5606a51d5c..0b07c24043 100644 --- a/hw/rtc/allwinner-rtc.c +++ b/hw/rtc/allwinner-rtc.c @@ -378,6 +378,7 @@ static const TypeInfo allwinner_rtc_info = { .class_size = sizeof(AwRtcClass), .abstract = true, }; +TYPE_INFO(allwinner_rtc_info) static const TypeInfo allwinner_rtc_sun4i_info = { .name = TYPE_AW_RTC_SUN4I, @@ -385,6 +386,7 @@ static const TypeInfo allwinner_rtc_sun4i_info = { .class_init = allwinner_rtc_sun4i_class_init, .instance_init = allwinner_rtc_sun4i_init, }; +TYPE_INFO(allwinner_rtc_sun4i_info) static const TypeInfo allwinner_rtc_sun6i_info = { .name = TYPE_AW_RTC_SUN6I, @@ -392,6 +394,7 @@ static const TypeInfo allwinner_rtc_sun6i_info = { .class_init = allwinner_rtc_sun6i_class_init, .instance_init = allwinner_rtc_sun6i_init, }; +TYPE_INFO(allwinner_rtc_sun6i_info) static const TypeInfo allwinner_rtc_sun7i_info = { .name = TYPE_AW_RTC_SUN7I, @@ -399,13 +402,6 @@ static const TypeInfo allwinner_rtc_sun7i_info = { .class_init = allwinner_rtc_sun7i_class_init, .instance_init = allwinner_rtc_sun7i_init, }; +TYPE_INFO(allwinner_rtc_sun7i_info) -static void allwinner_rtc_register(void) -{ - type_register_static(&allwinner_rtc_info); - type_register_static(&allwinner_rtc_sun4i_info); - type_register_static(&allwinner_rtc_sun6i_info); - type_register_static(&allwinner_rtc_sun7i_info); -} -type_init(allwinner_rtc_register) diff --git a/hw/rtc/aspeed_rtc.c b/hw/rtc/aspeed_rtc.c index 3ca1183558..e9d217d66b 100644 --- a/hw/rtc/aspeed_rtc.c +++ b/hw/rtc/aspeed_rtc.c @@ -172,10 +172,6 @@ static const TypeInfo aspeed_rtc_info = { .instance_size = sizeof(AspeedRtcState), .class_init = aspeed_rtc_class_init, }; +TYPE_INFO(aspeed_rtc_info) -static void aspeed_rtc_register_types(void) -{ - type_register_static(&aspeed_rtc_info); -} -type_init(aspeed_rtc_register_types) diff --git a/hw/rtc/ds1338.c b/hw/rtc/ds1338.c index 588a9ba9be..985d07f8f1 100644 --- a/hw/rtc/ds1338.c +++ b/hw/rtc/ds1338.c @@ -232,10 +232,6 @@ static const TypeInfo ds1338_info = { .instance_size = sizeof(DS1338State), .class_init = ds1338_class_init, }; +TYPE_INFO(ds1338_info) -static void ds1338_register_types(void) -{ - type_register_static(&ds1338_info); -} -type_init(ds1338_register_types) diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c index f85483a07f..375f682f5d 100644 --- a/hw/rtc/exynos4210_rtc.c +++ b/hw/rtc/exynos4210_rtc.c @@ -599,10 +599,6 @@ static const TypeInfo exynos4210_rtc_info = { .instance_init = exynos4210_rtc_init, .class_init = exynos4210_rtc_class_init, }; +TYPE_INFO(exynos4210_rtc_info) -static void exynos4210_rtc_register_types(void) -{ - type_register_static(&exynos4210_rtc_info); -} -type_init(exynos4210_rtc_register_types) diff --git a/hw/rtc/goldfish_rtc.c b/hw/rtc/goldfish_rtc.c index 6ddd45cce0..1473761de1 100644 --- a/hw/rtc/goldfish_rtc.c +++ b/hw/rtc/goldfish_rtc.c @@ -287,10 +287,6 @@ static const TypeInfo goldfish_rtc_info = { .instance_size = sizeof(GoldfishRTCState), .class_init = goldfish_rtc_class_init, }; +TYPE_INFO(goldfish_rtc_info) -static void goldfish_rtc_register_types(void) -{ - type_register_static(&goldfish_rtc_info); -} -type_init(goldfish_rtc_register_types) diff --git a/hw/rtc/m41t80.c b/hw/rtc/m41t80.c index 914ecac8f4..8b44b70eba 100644 --- a/hw/rtc/m41t80.c +++ b/hw/rtc/m41t80.c @@ -110,10 +110,6 @@ static const TypeInfo m41t80_info = { .instance_size = sizeof(M41t80State), .class_init = m41t80_class_init, }; +TYPE_INFO(m41t80_info) -static void m41t80_register_types(void) -{ - type_register_static(&m41t80_info); -} -type_init(m41t80_register_types) diff --git a/hw/rtc/m48t59-isa.c b/hw/rtc/m48t59-isa.c index 50430b7a85..6e72e132e4 100644 --- a/hw/rtc/m48t59-isa.c +++ b/hw/rtc/m48t59-isa.c @@ -165,6 +165,7 @@ static const TypeInfo m48txx_isa_type_info = { { } } }; +TYPE_INFO(m48txx_isa_type_info) static void m48t59_isa_register_types(void) { @@ -175,7 +176,6 @@ static void m48t59_isa_register_types(void) }; int i; - type_register_static(&m48txx_isa_type_info); for (i = 0; i < ARRAY_SIZE(m48txx_isa_info); i++) { isa_type_info.name = m48txx_isa_info[i].bus_name; diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c index b428a06045..1057e225d0 100644 --- a/hw/rtc/m48t59.c +++ b/hw/rtc/m48t59.c @@ -687,6 +687,7 @@ static const TypeInfo nvram_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(NvramClass), }; +TYPE_INFO(nvram_info) static const TypeInfo m48txx_sysbus_type_info = { .name = TYPE_M48TXX_SYS_BUS, @@ -700,6 +701,7 @@ static const TypeInfo m48txx_sysbus_type_info = { { } } }; +TYPE_INFO(m48txx_sysbus_type_info) static void m48t59_register_types(void) { @@ -710,8 +712,6 @@ static void m48t59_register_types(void) }; int i; - type_register_static(&nvram_info); - type_register_static(&m48txx_sysbus_type_info); for (i = 0; i < ARRAY_SIZE(m48txx_sysbus_info); i++) { sysbus_type_info.name = m48txx_sysbus_info[i].bus_name; diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index 7a38540cb9..336ebe03ff 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -1047,10 +1047,6 @@ static const TypeInfo mc146818rtc_info = { .instance_size = sizeof(RTCState), .class_init = rtc_class_initfn, }; +TYPE_INFO(mc146818rtc_info) -static void mc146818rtc_register_types(void) -{ - type_register_static(&mc146818rtc_info); -} -type_init(mc146818rtc_register_types) diff --git a/hw/rtc/pl031.c b/hw/rtc/pl031.c index ae47f09635..9c702916ee 100644 --- a/hw/rtc/pl031.c +++ b/hw/rtc/pl031.c @@ -331,10 +331,6 @@ static const TypeInfo pl031_info = { .instance_init = pl031_init, .class_init = pl031_class_init, }; +TYPE_INFO(pl031_info) -static void pl031_register_types(void) -{ - type_register_static(&pl031_info); -} -type_init(pl031_register_types) diff --git a/hw/rtc/sun4v-rtc.c b/hw/rtc/sun4v-rtc.c index 52caea8654..8e242e8416 100644 --- a/hw/rtc/sun4v-rtc.c +++ b/hw/rtc/sun4v-rtc.c @@ -87,10 +87,6 @@ static const TypeInfo sun4v_rtc_info = { .instance_size = sizeof(Sun4vRtc), .class_init = sun4v_rtc_class_init, }; +TYPE_INFO(sun4v_rtc_info) -static void sun4v_rtc_register_types(void) -{ - type_register_static(&sun4v_rtc_info); -} -type_init(sun4v_rtc_register_types) diff --git a/hw/rtc/twl92230.c b/hw/rtc/twl92230.c index d0011be89e..782d77d6fc 100644 --- a/hw/rtc/twl92230.c +++ b/hw/rtc/twl92230.c @@ -888,10 +888,6 @@ static const TypeInfo twl92230_info = { .instance_size = sizeof(MenelausState), .class_init = twl92230_class_init, }; +TYPE_INFO(twl92230_info) -static void twl92230_register_types(void) -{ - type_register_static(&twl92230_info); -} -type_init(twl92230_register_types) diff --git a/hw/rtc/xlnx-zynqmp-rtc.c b/hw/rtc/xlnx-zynqmp-rtc.c index 2bcd14d779..5d130d4d6c 100644 --- a/hw/rtc/xlnx-zynqmp-rtc.c +++ b/hw/rtc/xlnx-zynqmp-rtc.c @@ -266,10 +266,6 @@ static const TypeInfo rtc_info = { .class_init = rtc_class_init, .instance_init = rtc_init, }; +TYPE_INFO(rtc_info) -static void rtc_register_types(void) -{ - type_register_static(&rtc_info); -} -type_init(rtc_register_types) diff --git a/hw/s390x/3270-ccw.c b/hw/s390x/3270-ccw.c index 821319eee6..9acbf36920 100644 --- a/hw/s390x/3270-ccw.c +++ b/hw/s390x/3270-ccw.c @@ -170,10 +170,6 @@ static const TypeInfo emulated_ccw_3270_info = { .class_size = sizeof(EmulatedCcw3270Class), .abstract = true, }; +TYPE_INFO(emulated_ccw_3270_info) -static void emulated_ccw_register(void) -{ - type_register_static(&emulated_ccw_3270_info); -} -type_init(emulated_ccw_register) diff --git a/hw/s390x/ap-bridge.c b/hw/s390x/ap-bridge.c index 8bcf8ece9d..e6e1ff3310 100644 --- a/hw/s390x/ap-bridge.c +++ b/hw/s390x/ap-bridge.c @@ -37,6 +37,7 @@ static const TypeInfo ap_bus_info = { .instance_size = 0, .class_init = ap_bus_class_init, }; +TYPE_INFO(ap_bus_info) void s390_init_ap(void) { @@ -80,11 +81,6 @@ static const TypeInfo ap_bridge_info = { { } } }; +TYPE_INFO(ap_bridge_info) -static void ap_register(void) -{ - type_register_static(&ap_bridge_info); - type_register_static(&ap_bus_info); -} -type_init(ap_register) diff --git a/hw/s390x/ap-device.c b/hw/s390x/ap-device.c index fc0b41e937..0e82d9918c 100644 --- a/hw/s390x/ap-device.c +++ b/hw/s390x/ap-device.c @@ -28,10 +28,6 @@ static const TypeInfo ap_device_info = { .class_init = ap_class_init, .abstract = true, }; +TYPE_INFO(ap_device_info) -static void ap_device_register(void) -{ - type_register_static(&ap_device_info); -} -type_init(ap_device_register) diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c index c9707110e9..7484c2a5ca 100644 --- a/hw/s390x/ccw-device.c +++ b/hw/s390x/ccw-device.c @@ -79,10 +79,6 @@ static const TypeInfo ccw_device_info = { .class_init = ccw_device_class_init, .abstract = true, }; +TYPE_INFO(ccw_device_info) -static void ccw_device_register(void) -{ - type_register_static(&ccw_device_info); -} -type_init(ccw_device_register) diff --git a/hw/s390x/css-bridge.c b/hw/s390x/css-bridge.c index 9d793d671e..2ebb07a181 100644 --- a/hw/s390x/css-bridge.c +++ b/hw/s390x/css-bridge.c @@ -93,6 +93,7 @@ static const TypeInfo virtual_css_bus_info = { .instance_size = sizeof(VirtualCssBus), .class_init = virtual_css_bus_class_init, }; +TYPE_INFO(virtual_css_bus_info) VirtualCssBus *virtual_css_bus_init(void) { @@ -157,11 +158,6 @@ static const TypeInfo virtual_css_bridge_info = { { } } }; +TYPE_INFO(virtual_css_bridge_info) -static void virtual_css_register(void) -{ - type_register_static(&virtual_css_bridge_info); - type_register_static(&virtual_css_bus_info); -} -type_init(virtual_css_register) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 645b4080c5..60b28fa720 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -333,6 +333,7 @@ static const TypeInfo sclp_events_bus_info = { .name = TYPE_SCLP_EVENTS_BUS, .parent = TYPE_BUS, }; +TYPE_INFO(sclp_events_bus_info) static void command_handler(SCLPEventFacility *ef, SCCB *sccb, uint64_t code) { @@ -483,6 +484,7 @@ static const TypeInfo sclp_event_facility_info = { .class_init = init_event_facility_class, .class_size = sizeof(SCLPEventFacilityClass), }; +TYPE_INFO(sclp_event_facility_info) static void event_realize(DeviceState *qdev, Error **errp) { @@ -514,15 +516,9 @@ static const TypeInfo sclp_event_type_info = { .class_size = sizeof(SCLPEventClass), .abstract = true, }; +TYPE_INFO(sclp_event_type_info) -static void register_types(void) -{ - type_register_static(&sclp_events_bus_info); - type_register_static(&sclp_event_facility_info); - type_register_static(&sclp_event_type_info); -} -type_init(register_types) BusState *sclp_get_event_facility_bus(void) { diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 3d2652d75a..89e89acd79 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -765,10 +765,6 @@ static const TypeInfo s390_ipl_info = { .name = TYPE_S390_IPL, .instance_size = sizeof(S390IPLState), }; +TYPE_INFO(s390_ipl_info) -static void s390_ipl_register_types(void) -{ - type_register_static(&s390_ipl_info); -} -type_init(s390_ipl_register_types) diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c index b497571863..24edbfcd2f 100644 --- a/hw/s390x/s390-ccw.c +++ b/hw/s390x/s390-ccw.c @@ -194,10 +194,6 @@ static const TypeInfo s390_ccw_info = { .class_init = s390_ccw_class_init, .abstract = true, }; +TYPE_INFO(s390_ccw_info) -static void register_s390_ccw_type(void) -{ - type_register_static(&s390_ccw_info); -} -type_init(register_s390_ccw_type) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 92146a2119..d4ca1c3c20 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1140,12 +1140,14 @@ static const TypeInfo s390_pcihost_info = { { } } }; +TYPE_INFO(s390_pcihost_info) static const TypeInfo s390_pcibus_info = { .name = TYPE_S390_PCI_BUS, .parent = TYPE_BUS, .instance_size = sizeof(S390PCIBus), }; +TYPE_INFO(s390_pcibus_info) static uint16_t s390_pci_generate_uid(S390pciState *s) { @@ -1316,12 +1318,14 @@ static const TypeInfo s390_pci_device_info = { .instance_size = sizeof(S390PCIBusDevice), .class_init = s390_pci_device_class_init, }; +TYPE_INFO(s390_pci_device_info) static TypeInfo s390_pci_iommu_info = { .name = TYPE_S390_PCI_IOMMU, .parent = TYPE_OBJECT, .instance_size = sizeof(S390PCIIOMMU), }; +TYPE_INFO(s390_pci_iommu_info) static void s390_iommu_memory_region_class_init(ObjectClass *klass, void *data) { @@ -1336,14 +1340,6 @@ static const TypeInfo s390_iommu_memory_region_info = { .name = TYPE_S390_IOMMU_MEMORY_REGION, .class_init = s390_iommu_memory_region_class_init, }; +TYPE_INFO(s390_iommu_memory_region_info) -static void s390_pci_register_types(void) -{ - type_register_static(&s390_pcihost_info); - type_register_static(&s390_pcibus_info); - type_register_static(&s390_pci_device_info); - type_register_static(&s390_pci_iommu_info); - type_register_static(&s390_iommu_memory_region_info); -} -type_init(s390_pci_register_types) diff --git a/hw/s390x/s390-skeys-kvm.c b/hw/s390x/s390-skeys-kvm.c index 1c4d805ad8..eed05d265e 100644 --- a/hw/s390x/s390-skeys-kvm.c +++ b/hw/s390x/s390-skeys-kvm.c @@ -72,10 +72,6 @@ static const TypeInfo kvm_s390_skeys_info = { .class_init = kvm_s390_skeys_class_init, .class_size = sizeof(S390SKeysClass), }; +TYPE_INFO(kvm_s390_skeys_info) -static void kvm_s390_skeys_register_types(void) -{ - type_register_static(&kvm_s390_skeys_info); -} -type_init(kvm_s390_skeys_register_types) diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index db2f49cb27..0ac3b29520 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -251,6 +251,7 @@ static const TypeInfo qemu_s390_skeys_info = { .class_init = qemu_s390_skeys_class_init, .class_size = sizeof(S390SKeysClass), }; +TYPE_INFO(qemu_s390_skeys_info) static void s390_storage_keys_save(QEMUFile *f, void *opaque) { @@ -421,11 +422,6 @@ static const TypeInfo s390_skeys_info = { .class_size = sizeof(S390SKeysClass), .abstract = true, }; +TYPE_INFO(s390_skeys_info) -static void qemu_s390_skeys_register_types(void) -{ - type_register_static(&s390_skeys_info); - type_register_static(&qemu_s390_skeys_info); -} -type_init(qemu_s390_skeys_register_types) diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c index f89d8d9d16..d9eadfd8f7 100644 --- a/hw/s390x/s390-stattrib-kvm.c +++ b/hw/s390x/s390-stattrib-kvm.c @@ -187,10 +187,6 @@ static const TypeInfo kvm_s390_stattrib_info = { .class_init = kvm_s390_stattrib_class_init, .class_size = sizeof(S390StAttribClass), }; +TYPE_INFO(kvm_s390_stattrib_info) -static void kvm_s390_stattrib_register_types(void) -{ - type_register_static(&kvm_s390_stattrib_info); -} -type_init(kvm_s390_stattrib_register_types) diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index 4441e1d331..394072e898 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -330,6 +330,7 @@ static const TypeInfo qemu_s390_stattrib_info = { .class_init = qemu_s390_stattrib_class_init, .class_size = sizeof(S390StAttribClass), }; +TYPE_INFO(qemu_s390_stattrib_info) /* Generic abstract object: */ @@ -401,11 +402,6 @@ static const TypeInfo s390_stattrib_info = { .class_size = sizeof(S390StAttribClass), .abstract = true, }; +TYPE_INFO(s390_stattrib_info) -static void s390_stattrib_register_types(void) -{ - type_register_static(&s390_stattrib_info); - type_register_static(&qemu_s390_stattrib_info); -} -type_init(s390_stattrib_register_types) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index e72c61d2ea..820d8cb279 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -765,6 +765,7 @@ static const TypeInfo ccw_machine_info = { { } }, }; +TYPE_INFO(ccw_machine_info) bool css_migration_enabled(void) { @@ -1054,9 +1055,4 @@ static void ccw_machine_2_4_class_options(MachineClass *mc) } DEFINE_CCW_MACHINE(2_4, "2.4", false); -static void ccw_machine_register_types(void) -{ - type_register_static(&ccw_machine_info); -} -type_init(ccw_machine_register_types) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index a0ce444b4b..35bc750d31 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -411,9 +411,5 @@ static TypeInfo sclp_info = { .class_init = sclp_class_init, .class_size = sizeof(SCLPDeviceClass), }; +TYPE_INFO(sclp_info) -static void register_types(void) -{ - type_register_static(&sclp_info); -} -type_init(register_types); diff --git a/hw/s390x/sclpcpu.c b/hw/s390x/sclpcpu.c index 62806d3273..dd38d7ea4f 100644 --- a/hw/s390x/sclpcpu.c +++ b/hw/s390x/sclpcpu.c @@ -98,10 +98,6 @@ static const TypeInfo sclp_cpu_info = { .class_init = cpu_class_init, .class_size = sizeof(SCLPEventClass), }; +TYPE_INFO(sclp_cpu_info) -static void sclp_cpu_register_types(void) -{ - type_register_static(&sclp_cpu_info); -} -type_init(sclp_cpu_register_types) diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c index ce07b16884..5ec767f5bc 100644 --- a/hw/s390x/sclpquiesce.c +++ b/hw/s390x/sclpquiesce.c @@ -141,10 +141,6 @@ static const TypeInfo sclp_quiesce_info = { .class_init = quiesce_class_init, .class_size = sizeof(SCLPEventClass), }; +TYPE_INFO(sclp_quiesce_info) -static void register_types(void) -{ - type_register_static(&sclp_quiesce_info); -} -type_init(register_types) diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c index 6e21d83181..ce17950f2f 100644 --- a/hw/s390x/tod-kvm.c +++ b/hw/s390x/tod-kvm.c @@ -155,9 +155,5 @@ static TypeInfo kvm_s390_tod_info = { .class_init = kvm_s390_tod_class_init, .class_size = sizeof(S390TODClass), }; +TYPE_INFO(kvm_s390_tod_info) -static void register_types(void) -{ - type_register_static(&kvm_s390_tod_info); -} -type_init(register_types); diff --git a/hw/s390x/tod-qemu.c b/hw/s390x/tod-qemu.c index e91b9590f5..bdc900be3c 100644 --- a/hw/s390x/tod-qemu.c +++ b/hw/s390x/tod-qemu.c @@ -81,9 +81,5 @@ static TypeInfo qemu_s390_tod_info = { .class_init = qemu_s390_tod_class_init, .class_size = sizeof(S390TODClass), }; +TYPE_INFO(qemu_s390_tod_info) -static void register_types(void) -{ - type_register_static(&qemu_s390_tod_info); -} -type_init(register_types); diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c index 3c2979175e..7b3b0b3205 100644 --- a/hw/s390x/tod.c +++ b/hw/s390x/tod.c @@ -124,9 +124,5 @@ static TypeInfo s390_tod_info = { .class_size = sizeof(S390TODClass), .abstract = true, }; +TYPE_INFO(s390_tod_info) -static void register_types(void) -{ - type_register_static(&s390_tod_info); -} -type_init(register_types); diff --git a/hw/s390x/vhost-vsock-ccw.c b/hw/s390x/vhost-vsock-ccw.c index 0822ecca89..f30409bc19 100644 --- a/hw/s390x/vhost-vsock-ccw.c +++ b/hw/s390x/vhost-vsock-ccw.c @@ -52,10 +52,6 @@ static const TypeInfo vhost_vsock_ccw_info = { .instance_init = vhost_vsock_ccw_instance_init, .class_init = vhost_vsock_ccw_class_init, }; +TYPE_INFO(vhost_vsock_ccw_info) -static void vhost_vsock_ccw_register(void) -{ - type_register_static(&vhost_vsock_ccw_info); -} -type_init(vhost_vsock_ccw_register) diff --git a/hw/s390x/virtio-ccw-9p.c b/hw/s390x/virtio-ccw-9p.c index 88c8884fc5..dd8c451cc5 100644 --- a/hw/s390x/virtio-ccw-9p.c +++ b/hw/s390x/virtio-ccw-9p.c @@ -57,10 +57,6 @@ static const TypeInfo virtio_ccw_9p_info = { .instance_init = virtio_ccw_9p_instance_init, .class_init = virtio_ccw_9p_class_init, }; +TYPE_INFO(virtio_ccw_9p_info) -static void virtio_ccw_9p_register(void) -{ - type_register_static(&virtio_ccw_9p_info); -} -type_init(virtio_ccw_9p_register) diff --git a/hw/s390x/virtio-ccw-balloon.c b/hw/s390x/virtio-ccw-balloon.c index 4c7631a433..5e3acd91b2 100644 --- a/hw/s390x/virtio-ccw-balloon.c +++ b/hw/s390x/virtio-ccw-balloon.c @@ -62,10 +62,6 @@ static const TypeInfo virtio_ccw_balloon = { .instance_init = virtio_ccw_balloon_instance_init, .class_init = virtio_ccw_balloon_class_init, }; +TYPE_INFO(virtio_ccw_balloon) -static void virtio_ccw_balloon_register(void) -{ - type_register_static(&virtio_ccw_balloon); -} -type_init(virtio_ccw_balloon_register) diff --git a/hw/s390x/virtio-ccw-blk.c b/hw/s390x/virtio-ccw-blk.c index 2294ce1ce4..25cc528f34 100644 --- a/hw/s390x/virtio-ccw-blk.c +++ b/hw/s390x/virtio-ccw-blk.c @@ -59,10 +59,6 @@ static const TypeInfo virtio_ccw_blk = { .instance_init = virtio_ccw_blk_instance_init, .class_init = virtio_ccw_blk_class_init, }; +TYPE_INFO(virtio_ccw_blk) -static void virtio_ccw_blk_register(void) -{ - type_register_static(&virtio_ccw_blk); -} -type_init(virtio_ccw_blk_register) diff --git a/hw/s390x/virtio-ccw-crypto.c b/hw/s390x/virtio-ccw-crypto.c index 358c74fb4b..65e6ac1cf5 100644 --- a/hw/s390x/virtio-ccw-crypto.c +++ b/hw/s390x/virtio-ccw-crypto.c @@ -60,10 +60,6 @@ static const TypeInfo virtio_ccw_crypto = { .instance_init = virtio_ccw_crypto_instance_init, .class_init = virtio_ccw_crypto_class_init, }; +TYPE_INFO(virtio_ccw_crypto) -static void virtio_ccw_crypto_register(void) -{ - type_register_static(&virtio_ccw_crypto); -} -type_init(virtio_ccw_crypto_register) diff --git a/hw/s390x/virtio-ccw-gpu.c b/hw/s390x/virtio-ccw-gpu.c index c301e2586b..de63cb04e9 100644 --- a/hw/s390x/virtio-ccw-gpu.c +++ b/hw/s390x/virtio-ccw-gpu.c @@ -59,10 +59,6 @@ static const TypeInfo virtio_ccw_gpu = { .instance_init = virtio_ccw_gpu_instance_init, .class_init = virtio_ccw_gpu_class_init, }; +TYPE_INFO(virtio_ccw_gpu) -static void virtio_ccw_gpu_register(void) -{ - type_register_static(&virtio_ccw_gpu); -} -type_init(virtio_ccw_gpu_register) diff --git a/hw/s390x/virtio-ccw-input.c b/hw/s390x/virtio-ccw-input.c index 5601e25dee..42528ebd8a 100644 --- a/hw/s390x/virtio-ccw-input.c +++ b/hw/s390x/virtio-ccw-input.c @@ -78,6 +78,7 @@ static const TypeInfo virtio_ccw_input = { .class_init = virtio_ccw_input_class_init, .abstract = true, }; +TYPE_INFO(virtio_ccw_input) static const TypeInfo virtio_ccw_input_hid = { .name = TYPE_VIRTIO_INPUT_HID_CCW, @@ -85,6 +86,7 @@ static const TypeInfo virtio_ccw_input_hid = { .instance_size = sizeof(VirtIOInputHIDCcw), .abstract = true, }; +TYPE_INFO(virtio_ccw_input_hid) static const TypeInfo virtio_ccw_keyboard = { .name = TYPE_VIRTIO_KEYBOARD_CCW, @@ -92,6 +94,7 @@ static const TypeInfo virtio_ccw_keyboard = { .instance_size = sizeof(VirtIOInputHIDCcw), .instance_init = virtio_ccw_keyboard_instance_init, }; +TYPE_INFO(virtio_ccw_keyboard) static const TypeInfo virtio_ccw_mouse = { .name = TYPE_VIRTIO_MOUSE_CCW, @@ -99,6 +102,7 @@ static const TypeInfo virtio_ccw_mouse = { .instance_size = sizeof(VirtIOInputHIDCcw), .instance_init = virtio_ccw_mouse_instance_init, }; +TYPE_INFO(virtio_ccw_mouse) static const TypeInfo virtio_ccw_tablet = { .name = TYPE_VIRTIO_TABLET_CCW, @@ -106,14 +110,6 @@ static const TypeInfo virtio_ccw_tablet = { .instance_size = sizeof(VirtIOInputHIDCcw), .instance_init = virtio_ccw_tablet_instance_init, }; +TYPE_INFO(virtio_ccw_tablet) -static void virtio_ccw_input_register(void) -{ - type_register_static(&virtio_ccw_input); - type_register_static(&virtio_ccw_input_hid); - type_register_static(&virtio_ccw_keyboard); - type_register_static(&virtio_ccw_mouse); - type_register_static(&virtio_ccw_tablet); -} -type_init(virtio_ccw_input_register) diff --git a/hw/s390x/virtio-ccw-net.c b/hw/s390x/virtio-ccw-net.c index 3860d4e6ea..00bd695a9c 100644 --- a/hw/s390x/virtio-ccw-net.c +++ b/hw/s390x/virtio-ccw-net.c @@ -62,10 +62,6 @@ static const TypeInfo virtio_ccw_net = { .instance_init = virtio_ccw_net_instance_init, .class_init = virtio_ccw_net_class_init, }; +TYPE_INFO(virtio_ccw_net) -static void virtio_ccw_net_register(void) -{ - type_register_static(&virtio_ccw_net); -} -type_init(virtio_ccw_net_register) diff --git a/hw/s390x/virtio-ccw-rng.c b/hw/s390x/virtio-ccw-rng.c index 2e3a9da5e8..98cdba0d26 100644 --- a/hw/s390x/virtio-ccw-rng.c +++ b/hw/s390x/virtio-ccw-rng.c @@ -59,10 +59,6 @@ static const TypeInfo virtio_ccw_rng = { .instance_init = virtio_ccw_rng_instance_init, .class_init = virtio_ccw_rng_class_init, }; +TYPE_INFO(virtio_ccw_rng) -static void virtio_ccw_rng_register(void) -{ - type_register_static(&virtio_ccw_rng); -} -type_init(virtio_ccw_rng_register) diff --git a/hw/s390x/virtio-ccw-scsi.c b/hw/s390x/virtio-ccw-scsi.c index 6e4beef700..3ec7a35e53 100644 --- a/hw/s390x/virtio-ccw-scsi.c +++ b/hw/s390x/virtio-ccw-scsi.c @@ -69,6 +69,7 @@ static const TypeInfo virtio_ccw_scsi = { .instance_init = virtio_ccw_scsi_instance_init, .class_init = virtio_ccw_scsi_class_init, }; +TYPE_INFO(virtio_ccw_scsi) #ifdef CONFIG_VHOST_SCSI @@ -111,14 +112,13 @@ static const TypeInfo vhost_ccw_scsi = { .instance_init = vhost_ccw_scsi_instance_init, .class_init = vhost_ccw_scsi_class_init, }; +TYPE_INFO(vhost_ccw_scsi) #endif static void virtio_ccw_scsi_register(void) { - type_register_static(&virtio_ccw_scsi); #ifdef CONFIG_VHOST_SCSI - type_register_static(&vhost_ccw_scsi); #endif } diff --git a/hw/s390x/virtio-ccw-serial.c b/hw/s390x/virtio-ccw-serial.c index 61958228d1..c821eb57b3 100644 --- a/hw/s390x/virtio-ccw-serial.c +++ b/hw/s390x/virtio-ccw-serial.c @@ -70,10 +70,6 @@ static const TypeInfo virtio_ccw_serial = { .instance_init = virtio_ccw_serial_instance_init, .class_init = virtio_ccw_serial_class_init, }; +TYPE_INFO(virtio_ccw_serial) -static void virtio_ccw_serial_register(void) -{ - type_register_static(&virtio_ccw_serial); -} -type_init(virtio_ccw_serial_register) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 0e60270297..666e9768ed 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1199,6 +1199,7 @@ static const TypeInfo virtio_ccw_device_info = { .class_size = sizeof(VirtIOCCWDeviceClass), .abstract = true, }; +TYPE_INFO(virtio_ccw_device_info) /* virtio-ccw-bus */ @@ -1239,11 +1240,6 @@ static const TypeInfo virtio_ccw_bus_info = { .instance_size = sizeof(VirtioCcwBusState), .class_init = virtio_ccw_bus_class_init, }; +TYPE_INFO(virtio_ccw_bus_info) -static void virtio_ccw_register(void) -{ - type_register_static(&virtio_ccw_bus_info); - type_register_static(&virtio_ccw_device_info); -} -type_init(virtio_ccw_register) diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index 497a8d5901..0fa2e1cc45 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -407,6 +407,7 @@ static const TypeInfo esp_pci_info = { { }, }, }; +TYPE_INFO(esp_pci_info) typedef struct { PCIESPState pci; @@ -526,11 +527,6 @@ static const TypeInfo dc390_info = { .instance_size = sizeof(DC390State), .class_init = dc390_class_init, }; +TYPE_INFO(dc390_info) -static void esp_pci_register_types(void) -{ - type_register_static(&esp_pci_info); - type_register_static(&dc390_info); -} -type_init(esp_pci_register_types) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 405f8b7cbc..735529089d 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -997,10 +997,6 @@ static const TypeInfo sysbus_esp_info = { .instance_size = sizeof(SysBusESPState), .class_init = sysbus_esp_class_init, }; +TYPE_INFO(sysbus_esp_info) -static void esp_register_types(void) -{ - type_register_static(&sysbus_esp_info); -} -type_init(esp_register_types) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 63ff4181de..4c02f32182 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -2345,6 +2345,7 @@ static const TypeInfo lsi_info = { { }, }, }; +TYPE_INFO(lsi_info) static void lsi53c810_class_init(ObjectClass *klass, void *data) { @@ -2358,14 +2359,9 @@ static TypeInfo lsi53c810_info = { .parent = TYPE_LSI53C895A, .class_init = lsi53c810_class_init, }; +TYPE_INFO(lsi53c810_info) -static void lsi53c895a_register_types(void) -{ - type_register_static(&lsi_info); - type_register_static(&lsi53c810_info); -} -type_init(lsi53c895a_register_types) void lsi53c8xx_handle_legacy_cmdline(DeviceState *lsi_dev) { diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 390c2f2edb..eda0c22f03 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -2535,12 +2535,12 @@ static const TypeInfo megasas_info = { .class_size = sizeof(MegasasBaseClass), .abstract = true, }; +TYPE_INFO(megasas_info) static void megasas_register_types(void) { int i; - type_register_static(&megasas_info); for (i = 0; i < ARRAY_SIZE(megasas_devices); i++) { const MegasasInfo *info = &megasas_devices[i]; TypeInfo type_info = {}; diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index df65cc2223..06eccf3239 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -49,6 +49,7 @@ static const TypeInfo scsi_bus_info = { { } } }; +TYPE_INFO(scsi_bus_info) static int next_scsi_bus; static void scsi_device_realize(SCSIDevice *s, Error **errp) @@ -1738,11 +1739,6 @@ static const TypeInfo scsi_device_type_info = { .class_init = scsi_device_class_init, .instance_init = scsi_dev_instance_init, }; +TYPE_INFO(scsi_device_type_info) -static void scsi_register_types(void) -{ - type_register_static(&scsi_bus_info); - type_register_static(&scsi_device_type_info); -} -type_init(scsi_register_types) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 8ce68a9dd6..f0777dd4ee 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2976,6 +2976,7 @@ static const TypeInfo scsi_disk_base_info = { .class_size = sizeof(SCSIDiskClass), .abstract = true, }; +TYPE_INFO(scsi_disk_base_info) #define DEFINE_SCSI_DISK_PROPERTIES() \ DEFINE_PROP_DRIVE_IOTHREAD("drive", SCSIDiskState, qdev.conf.blk), \ @@ -3042,6 +3043,7 @@ static const TypeInfo scsi_hd_info = { .parent = TYPE_SCSI_DISK_BASE, .class_init = scsi_hd_class_initfn, }; +TYPE_INFO(scsi_hd_info) static Property scsi_cd_properties[] = { DEFINE_SCSI_DISK_PROPERTIES(), @@ -3073,6 +3075,7 @@ static const TypeInfo scsi_cd_info = { .parent = TYPE_SCSI_DISK_BASE, .class_init = scsi_cd_class_initfn, }; +TYPE_INFO(scsi_cd_info) #ifdef __linux__ static Property scsi_block_properties[] = { @@ -3112,6 +3115,7 @@ static const TypeInfo scsi_block_info = { .parent = TYPE_SCSI_DISK_BASE, .class_init = scsi_block_class_initfn, }; +TYPE_INFO(scsi_block_info) #endif static Property scsi_disk_properties[] = { @@ -3152,16 +3156,12 @@ static const TypeInfo scsi_disk_info = { .parent = TYPE_SCSI_DISK_BASE, .class_init = scsi_disk_class_initfn, }; +TYPE_INFO(scsi_disk_info) static void scsi_disk_register_types(void) { - type_register_static(&scsi_disk_base_info); - type_register_static(&scsi_hd_info); - type_register_static(&scsi_cd_info); #ifdef __linux__ - type_register_static(&scsi_block_info); #endif - type_register_static(&scsi_disk_info); } type_init(scsi_disk_register_types) diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 86ed0a3822..dc7ca649de 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -778,12 +778,8 @@ static const TypeInfo scsi_generic_info = { .instance_size = sizeof(SCSIDevice), .class_init = scsi_generic_class_initfn, }; +TYPE_INFO(scsi_generic_info) -static void scsi_generic_register_types(void) -{ - type_register_static(&scsi_generic_info); -} -type_init(scsi_generic_register_types) #endif /* __linux__ */ diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index d17dc03c73..10c64396d6 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -1290,10 +1290,6 @@ static const TypeInfo spapr_vscsi_info = { .instance_size = sizeof(VSCSIState), .class_init = spapr_vscsi_class_init, }; +TYPE_INFO(spapr_vscsi_info) -static void spapr_vscsi_register_types(void) -{ - type_register_static(&spapr_vscsi_info); -} -type_init(spapr_vscsi_register_types) diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c index 8ec49d7fef..cd025155e8 100644 --- a/hw/scsi/vhost-scsi-common.c +++ b/hw/scsi/vhost-scsi-common.c @@ -135,10 +135,6 @@ static const TypeInfo vhost_scsi_common_info = { .instance_size = sizeof(VHostSCSICommon), .abstract = true, }; +TYPE_INFO(vhost_scsi_common_info) -static void virtio_register_types(void) -{ - type_register_static(&vhost_scsi_common_info); -} -type_init(virtio_register_types) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 13b05af29b..2341e62744 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -323,10 +323,6 @@ static const TypeInfo vhost_scsi_info = { { } }, }; +TYPE_INFO(vhost_scsi_info) -static void virtio_register_types(void) -{ - type_register_static(&vhost_scsi_info); -} -type_init(virtio_register_types) diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index f2e524438a..ef8f8f05d9 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -230,10 +230,6 @@ static const TypeInfo vhost_user_scsi_info = { { } }, }; +TYPE_INFO(vhost_user_scsi_info) -static void virtio_register_types(void) -{ - type_register_static(&vhost_user_scsi_info); -} -type_init(virtio_register_types) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index b49775269e..f8af093d88 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -1028,6 +1028,7 @@ static const TypeInfo virtio_scsi_common_info = { .abstract = true, .class_init = virtio_scsi_common_class_init, }; +TYPE_INFO(virtio_scsi_common_info) static const TypeInfo virtio_scsi_info = { .name = TYPE_VIRTIO_SCSI, @@ -1039,11 +1040,6 @@ static const TypeInfo virtio_scsi_info = { { } } }; +TYPE_INFO(virtio_scsi_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_scsi_common_info); - type_register_static(&virtio_scsi_info); -} -type_init(virtio_register_types) diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index c071e0c7aa..796dbc14d6 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -1312,11 +1312,6 @@ static const TypeInfo pvscsi_info = { { } } }; +TYPE_INFO(pvscsi_info) -static void -pvscsi_register_types(void) -{ - type_register_static(&pvscsi_info); -} -type_init(pvscsi_register_types); diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index f404e1fdb4..980015cf94 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -823,18 +823,21 @@ static TypeInfo allwinner_sdhost_info = { .class_size = sizeof(AwSdHostClass), .abstract = true, }; +TYPE_INFO(allwinner_sdhost_info) static const TypeInfo allwinner_sdhost_sun4i_info = { .name = TYPE_AW_SDHOST_SUN4I, .parent = TYPE_AW_SDHOST, .class_init = allwinner_sdhost_sun4i_class_init, }; +TYPE_INFO(allwinner_sdhost_sun4i_info) static const TypeInfo allwinner_sdhost_sun5i_info = { .name = TYPE_AW_SDHOST_SUN5I, .parent = TYPE_AW_SDHOST, .class_init = allwinner_sdhost_sun5i_class_init, }; +TYPE_INFO(allwinner_sdhost_sun5i_info) static const TypeInfo allwinner_sdhost_bus_info = { .name = TYPE_AW_SDHOST_BUS, @@ -842,13 +845,6 @@ static const TypeInfo allwinner_sdhost_bus_info = { .instance_size = sizeof(SDBus), .class_init = allwinner_sdhost_bus_class_init, }; +TYPE_INFO(allwinner_sdhost_bus_info) -static void allwinner_sdhost_register_types(void) -{ - type_register_static(&allwinner_sdhost_info); - type_register_static(&allwinner_sdhost_sun4i_info); - type_register_static(&allwinner_sdhost_sun5i_info); - type_register_static(&allwinner_sdhost_bus_info); -} -type_init(allwinner_sdhost_register_types) diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c index 22cafce0fb..fe080b9465 100644 --- a/hw/sd/aspeed_sdhci.c +++ b/hw/sd/aspeed_sdhci.c @@ -189,10 +189,6 @@ static TypeInfo aspeed_sdhci_info = { .instance_size = sizeof(AspeedSDHCIState), .class_init = aspeed_sdhci_class_init, }; +TYPE_INFO(aspeed_sdhci_info) -static void aspeed_sdhci_register_types(void) -{ - type_register_static(&aspeed_sdhci_info); -} -type_init(aspeed_sdhci_register_types) diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c index 4a80fbcc86..ab912fc45b 100644 --- a/hw/sd/bcm2835_sdhost.c +++ b/hw/sd/bcm2835_sdhost.c @@ -441,17 +441,13 @@ static TypeInfo bcm2835_sdhost_info = { .class_init = bcm2835_sdhost_class_init, .instance_init = bcm2835_sdhost_init, }; +TYPE_INFO(bcm2835_sdhost_info) static const TypeInfo bcm2835_sdhost_bus_info = { .name = TYPE_BCM2835_SDHOST_BUS, .parent = TYPE_SD_BUS, .instance_size = sizeof(SDBus), }; +TYPE_INFO(bcm2835_sdhost_bus_info) -static void bcm2835_sdhost_register_types(void) -{ - type_register_static(&bcm2835_sdhost_info); - type_register_static(&bcm2835_sdhost_bus_info); -} -type_init(bcm2835_sdhost_register_types) diff --git a/hw/sd/core.c b/hw/sd/core.c index abec48bccb..5992760093 100644 --- a/hw/sd/core.c +++ b/hw/sd/core.c @@ -221,10 +221,6 @@ static const TypeInfo sd_bus_info = { .instance_size = sizeof(SDBus), .class_size = sizeof(SDBusClass), }; +TYPE_INFO(sd_bus_info) -static void sd_bus_register_types(void) -{ - type_register_static(&sd_bus_info); -} -type_init(sd_bus_register_types) diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 11f61294fc..64a369a04b 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -322,10 +322,6 @@ static const TypeInfo milkymist_memcard_info = { .instance_init = milkymist_memcard_init, .class_init = milkymist_memcard_class_init, }; +TYPE_INFO(milkymist_memcard_info) -static void milkymist_memcard_register_types(void) -{ - type_register_static(&milkymist_memcard_info); -} -type_init(milkymist_memcard_register_types) diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 2b3776a6a0..f937bb1add 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -529,10 +529,6 @@ static const TypeInfo pl181_info = { .instance_init = pl181_init, .class_init = pl181_class_init, }; +TYPE_INFO(pl181_info) -static void pl181_register_types(void) -{ - type_register_static(&pl181_info); -} -type_init(pl181_register_types) diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 68bed24480..7ff7e9b311 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -596,6 +596,7 @@ static const TypeInfo pxa2xx_mmci_info = { .instance_init = pxa2xx_mmci_instance_init, .class_init = pxa2xx_mmci_class_init, }; +TYPE_INFO(pxa2xx_mmci_info) static const TypeInfo pxa2xx_mmci_bus_info = { .name = TYPE_PXA2XX_MMCI_BUS, @@ -603,11 +604,6 @@ static const TypeInfo pxa2xx_mmci_bus_info = { .instance_size = sizeof(SDBus), .class_init = pxa2xx_mmci_bus_class_init, }; +TYPE_INFO(pxa2xx_mmci_bus_info) -static void pxa2xx_mmci_register_types(void) -{ - type_register_static(&pxa2xx_mmci_info); - type_register_static(&pxa2xx_mmci_bus_info); -} -type_init(pxa2xx_mmci_register_types) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index fad9cf1ee7..0b17afa46d 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2208,10 +2208,6 @@ static const TypeInfo sd_info = { .instance_init = sd_instance_init, .instance_finalize = sd_instance_finalize, }; +TYPE_INFO(sd_info) -static void sd_register_types(void) -{ - type_register_static(&sd_info); -} -type_init(sd_register_types) diff --git a/hw/sd/sdhci-pci.c b/hw/sd/sdhci-pci.c index c737c8b930..5d6f7ce25f 100644 --- a/hw/sd/sdhci-pci.c +++ b/hw/sd/sdhci-pci.c @@ -78,10 +78,6 @@ static const TypeInfo sdhci_pci_info = { { }, }, }; +TYPE_INFO(sdhci_pci_info) -static void sdhci_pci_register_type(void) -{ - type_register_static(&sdhci_pci_info); -} -type_init(sdhci_pci_register_type) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index deac181865..7902b8c12d 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1506,6 +1506,7 @@ static const TypeInfo sdhci_sysbus_info = { .instance_finalize = sdhci_sysbus_finalize, .class_init = sdhci_sysbus_class_init, }; +TYPE_INFO(sdhci_sysbus_info) /* --- qdev bus master --- */ @@ -1523,6 +1524,7 @@ static const TypeInfo sdhci_bus_info = { .instance_size = sizeof(SDBus), .class_init = sdhci_bus_class_init, }; +TYPE_INFO(sdhci_bus_info) /* --- qdev i.MX eSDHC --- */ @@ -1768,6 +1770,7 @@ static const TypeInfo imx_usdhc_info = { .parent = TYPE_SYSBUS_SDHCI, .instance_init = imx_usdhc_init, }; +TYPE_INFO(imx_usdhc_info) /* --- qdev Samsung s3c --- */ @@ -1832,13 +1835,6 @@ static const TypeInfo sdhci_s3c_info = { .parent = TYPE_SYSBUS_SDHCI, .instance_init = sdhci_s3c_init, }; +TYPE_INFO(sdhci_s3c_info) -static void sdhci_register_types(void) -{ - type_register_static(&sdhci_sysbus_info); - type_register_static(&sdhci_bus_info); - type_register_static(&imx_usdhc_info); - type_register_static(&sdhci_s3c_info); -} -type_init(sdhci_register_types) diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index 9210ef567f..70b864366b 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -307,10 +307,6 @@ static const TypeInfo ssi_sd_info = { .instance_size = sizeof(ssi_sd_state), .class_init = ssi_sd_class_init, }; +TYPE_INFO(ssi_sd_info) -static void ssi_sd_register_types(void) -{ - type_register_static(&ssi_sd_info); -} -type_init(ssi_sd_register_types) diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c index 0a3e86f949..b6f5a54781 100644 --- a/hw/sh4/sh_pci.c +++ b/hw/sh4/sh_pci.c @@ -180,6 +180,7 @@ static const TypeInfo sh_pci_host_info = { { }, }, }; +TYPE_INFO(sh_pci_host_info) static void sh_pci_device_class_init(ObjectClass *klass, void *data) { @@ -194,11 +195,6 @@ static const TypeInfo sh_pci_device_info = { .instance_size = sizeof(SHPCIState), .class_init = sh_pci_device_class_init, }; +TYPE_INFO(sh_pci_device_info) -static void sh_pci_register_types(void) -{ - type_register_static(&sh_pci_device_info); - type_register_static(&sh_pci_host_info); -} -type_init(sh_pci_register_types) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 9be930415f..d53a0faf82 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -631,6 +631,7 @@ static const TypeInfo idreg_info = { .instance_size = sizeof(IDRegState), .class_init = idreg_class_init, }; +TYPE_INFO(idreg_info) #define TYPE_TCX_AFX "tcx_afx" #define TCX_AFX(obj) OBJECT_CHECK(AFXState, (obj), TYPE_TCX_AFX) @@ -684,6 +685,7 @@ static const TypeInfo afx_info = { .instance_size = sizeof(AFXState), .class_init = afx_class_init, }; +TYPE_INFO(afx_info) #define TYPE_OPENPROM "openprom" #define OPENPROM(obj) OBJECT_CHECK(PROMState, (obj), TYPE_OPENPROM) @@ -772,6 +774,7 @@ static const TypeInfo prom_info = { .instance_size = sizeof(PROMState), .class_init = prom_class_init, }; +TYPE_INFO(prom_info) #define TYPE_SUN4M_MEMORY "memory" #define SUN4M_RAM(obj) OBJECT_CHECK(RamDevice, (obj), TYPE_SUN4M_MEMORY) @@ -815,6 +818,7 @@ static const TypeInfo ram_info = { .instance_init = ram_initfn, .class_init = ram_class_init, }; +TYPE_INFO(ram_info) static void cpu_devinit(const char *cpu_type, unsigned int id, uint64_t prom_addr, qemu_irq **cpu_irqs) @@ -1420,6 +1424,7 @@ static const TypeInfo ss5_type = { .parent = TYPE_MACHINE, .class_init = ss5_class_init, }; +TYPE_INFO(ss5_type) static void ss10_class_init(ObjectClass *oc, void *data) { @@ -1440,6 +1445,7 @@ static const TypeInfo ss10_type = { .parent = TYPE_MACHINE, .class_init = ss10_class_init, }; +TYPE_INFO(ss10_type) static void ss600mp_class_init(ObjectClass *oc, void *data) { @@ -1460,6 +1466,7 @@ static const TypeInfo ss600mp_type = { .parent = TYPE_MACHINE, .class_init = ss600mp_class_init, }; +TYPE_INFO(ss600mp_type) static void ss20_class_init(ObjectClass *oc, void *data) { @@ -1480,6 +1487,7 @@ static const TypeInfo ss20_type = { .parent = TYPE_MACHINE, .class_init = ss20_class_init, }; +TYPE_INFO(ss20_type) static void voyager_class_init(ObjectClass *oc, void *data) { @@ -1499,6 +1507,7 @@ static const TypeInfo voyager_type = { .parent = TYPE_MACHINE, .class_init = voyager_class_init, }; +TYPE_INFO(voyager_type) static void ss_lx_class_init(ObjectClass *oc, void *data) { @@ -1518,6 +1527,7 @@ static const TypeInfo ss_lx_type = { .parent = TYPE_MACHINE, .class_init = ss_lx_class_init, }; +TYPE_INFO(ss_lx_type) static void ss4_class_init(ObjectClass *oc, void *data) { @@ -1537,6 +1547,7 @@ static const TypeInfo ss4_type = { .parent = TYPE_MACHINE, .class_init = ss4_class_init, }; +TYPE_INFO(ss4_type) static void scls_class_init(ObjectClass *oc, void *data) { @@ -1556,6 +1567,7 @@ static const TypeInfo scls_type = { .parent = TYPE_MACHINE, .class_init = scls_class_init, }; +TYPE_INFO(scls_type) static void sbook_class_init(ObjectClass *oc, void *data) { @@ -1575,23 +1587,11 @@ static const TypeInfo sbook_type = { .parent = TYPE_MACHINE, .class_init = sbook_class_init, }; +TYPE_INFO(sbook_type) static void sun4m_register_types(void) { - type_register_static(&idreg_info); - type_register_static(&afx_info); - type_register_static(&prom_info); - type_register_static(&ram_info); - - type_register_static(&ss5_type); - type_register_static(&ss10_type); - type_register_static(&ss600mp_type); - type_register_static(&ss20_type); - type_register_static(&voyager_type); - type_register_static(&ss_lx_type); - type_register_static(&ss4_type); - type_register_static(&scls_type); - type_register_static(&sbook_type); + } type_init(sun4m_register_types) diff --git a/hw/sparc/sun4m_iommu.c b/hw/sparc/sun4m_iommu.c index 71f5465249..ce19fe0488 100644 --- a/hw/sparc/sun4m_iommu.c +++ b/hw/sparc/sun4m_iommu.c @@ -389,6 +389,7 @@ static const TypeInfo iommu_info = { .instance_init = iommu_init, .class_init = iommu_class_init, }; +TYPE_INFO(iommu_info) static void sun4m_iommu_memory_region_class_init(ObjectClass *klass, void *data) { @@ -402,11 +403,6 @@ static const TypeInfo sun4m_iommu_memory_region_info = { .name = TYPE_SUN4M_IOMMU_MEMORY_REGION, .class_init = sun4m_iommu_memory_region_class_init, }; +TYPE_INFO(sun4m_iommu_memory_region_info) -static void iommu_register_types(void) -{ - type_register_static(&iommu_info); - type_register_static(&sun4m_iommu_memory_region_info); -} -type_init(iommu_register_types) diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index a87d55f6bb..706bbafc38 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -174,10 +174,6 @@ static const TypeInfo niagara_type = { .parent = TYPE_MACHINE, .class_init = niagara_class_init, }; +TYPE_INFO(niagara_type) -static void niagara_register_types(void) -{ - type_register_static(&niagara_type); -} -type_init(niagara_register_types) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 9e30203dcc..73e6b0eed6 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -283,6 +283,7 @@ static const TypeInfo power_info = { .instance_size = sizeof(PowerDevice), .class_init = power_class_init, }; +TYPE_INFO(power_info) static void ebus_isa_irq_handler(void *opaque, int n, int level) { @@ -397,6 +398,7 @@ static const TypeInfo ebus_info = { { }, }, }; +TYPE_INFO(ebus_info) #define TYPE_OPENPROM "openprom" #define OPENPROM(obj) OBJECT_CHECK(PROMState, (obj), TYPE_OPENPROM) @@ -484,6 +486,7 @@ static const TypeInfo prom_info = { .instance_size = sizeof(PROMState), .class_init = prom_class_init, }; +TYPE_INFO(prom_info) #define TYPE_SUN4U_MEMORY "memory" @@ -544,6 +547,7 @@ static const TypeInfo ram_info = { .instance_size = sizeof(RamDevice), .class_init = ram_class_init, }; +TYPE_INFO(ram_info) static void sun4uv_init(MemoryRegion *address_space_mem, MachineState *machine, @@ -828,6 +832,7 @@ static const TypeInfo sun4u_type = { { } }, }; +TYPE_INFO(sun4u_type) static void sun4v_class_init(ObjectClass *oc, void *data) { @@ -847,16 +852,11 @@ static const TypeInfo sun4v_type = { .parent = TYPE_MACHINE, .class_init = sun4v_class_init, }; +TYPE_INFO(sun4v_type) static void sun4u_register_types(void) { - type_register_static(&power_info); - type_register_static(&ebus_info); - type_register_static(&prom_info); - type_register_static(&ram_info); - type_register_static(&sun4u_type); - type_register_static(&sun4v_type); } type_init(sun4u_register_types) diff --git a/hw/sparc64/sun4u_iommu.c b/hw/sparc64/sun4u_iommu.c index 9178277f82..25ed3d51c6 100644 --- a/hw/sparc64/sun4u_iommu.c +++ b/hw/sparc64/sun4u_iommu.c @@ -319,6 +319,7 @@ static const TypeInfo iommu_info = { .instance_init = iommu_init, .class_init = iommu_class_init, }; +TYPE_INFO(iommu_info) static void sun4u_iommu_memory_region_class_init(ObjectClass *klass, void *data) { @@ -332,11 +333,6 @@ static const TypeInfo sun4u_iommu_memory_region_info = { .name = TYPE_SUN4U_IOMMU_MEMORY_REGION, .class_init = sun4u_iommu_memory_region_class_init, }; +TYPE_INFO(sun4u_iommu_memory_region_info) -static void iommu_register_types(void) -{ - type_register_static(&iommu_info); - type_register_static(&sun4u_iommu_memory_region_info); -} -type_init(iommu_register_types) diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index 4fab1f5f85..a1f08cb7ee 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -1447,12 +1447,12 @@ static const TypeInfo aspeed_smc_info = { .class_size = sizeof(AspeedSMCClass), .abstract = true, }; +TYPE_INFO(aspeed_smc_info) static void aspeed_smc_register_types(void) { int i; - type_register_static(&aspeed_smc_info); for (i = 0; i < ARRAY_SIZE(controllers); ++i) { TypeInfo ti = { .name = controllers[i].name, diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c index 7f703d8328..0d888b0ae5 100644 --- a/hw/ssi/imx_spi.c +++ b/hw/ssi/imx_spi.c @@ -450,10 +450,6 @@ static const TypeInfo imx_spi_info = { .instance_size = sizeof(IMXSPIState), .class_init = imx_spi_class_init, }; +TYPE_INFO(imx_spi_info) -static void imx_spi_register_types(void) -{ - type_register_static(&imx_spi_info); -} -type_init(imx_spi_register_types) diff --git a/hw/ssi/mss-spi.c b/hw/ssi/mss-spi.c index b2432c5a13..d49e79ac79 100644 --- a/hw/ssi/mss-spi.c +++ b/hw/ssi/mss-spi.c @@ -413,10 +413,6 @@ static const TypeInfo mss_spi_info = { .instance_size = sizeof(MSSSpiState), .class_init = mss_spi_class_init, }; +TYPE_INFO(mss_spi_info) -static void mss_spi_register_types(void) -{ - type_register_static(&mss_spi_info); -} -type_init(mss_spi_register_types) diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c index cade2e92a8..e8705c470c 100644 --- a/hw/ssi/pl022.c +++ b/hw/ssi/pl022.c @@ -307,10 +307,6 @@ static const TypeInfo pl022_info = { .instance_size = sizeof(PL022State), .class_init = pl022_class_init, }; +TYPE_INFO(pl022_info) -static void pl022_register_types(void) -{ - type_register_static(&pl022_info); -} -type_init(pl022_register_types) diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c index a35d7ebb26..9461e57b8b 100644 --- a/hw/ssi/ssi.c +++ b/hw/ssi/ssi.c @@ -30,6 +30,7 @@ static const TypeInfo ssi_bus_info = { .parent = TYPE_BUS, .instance_size = sizeof(SSIBus), }; +TYPE_INFO(ssi_bus_info) static void ssi_cs_default(void *opaque, int n, int level) { @@ -89,6 +90,7 @@ static const TypeInfo ssi_slave_info = { .class_size = sizeof(SSISlaveClass), .abstract = true, }; +TYPE_INFO(ssi_slave_info) bool ssi_realize_and_unref(DeviceState *dev, SSIBus *bus, Error **errp) { @@ -136,10 +138,4 @@ const VMStateDescription vmstate_ssi_slave = { } }; -static void ssi_slave_register_types(void) -{ - type_register_static(&ssi_bus_info); - type_register_static(&ssi_slave_info); -} -type_init(ssi_slave_register_types) diff --git a/hw/ssi/stm32f2xx_spi.c b/hw/ssi/stm32f2xx_spi.c index cd6e8443db..7080454ce4 100644 --- a/hw/ssi/stm32f2xx_spi.c +++ b/hw/ssi/stm32f2xx_spi.c @@ -217,10 +217,6 @@ static const TypeInfo stm32f2xx_spi_info = { .instance_init = stm32f2xx_spi_init, .class_init = stm32f2xx_spi_class_init, }; +TYPE_INFO(stm32f2xx_spi_info) -static void stm32f2xx_spi_register_types(void) -{ - type_register_static(&stm32f2xx_spi_info); -} -type_init(stm32f2xx_spi_register_types) diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c index 80d1488dc7..4f6f50e313 100644 --- a/hw/ssi/xilinx_spi.c +++ b/hw/ssi/xilinx_spi.c @@ -381,10 +381,6 @@ static const TypeInfo xilinx_spi_info = { .instance_size = sizeof(XilinxSPI), .class_init = xilinx_spi_class_init, }; +TYPE_INFO(xilinx_spi_info) -static void xilinx_spi_register_types(void) -{ - type_register_static(&xilinx_spi_info); -} -type_init(xilinx_spi_register_types) diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c index b9371dbf8d..fbae9bc013 100644 --- a/hw/ssi/xilinx_spips.c +++ b/hw/ssi/xilinx_spips.c @@ -1479,6 +1479,7 @@ static const TypeInfo xilinx_spips_info = { .class_init = xilinx_spips_class_init, .class_size = sizeof(XilinxSPIPSClass), }; +TYPE_INFO(xilinx_spips_info) static const TypeInfo xilinx_qspips_info = { .name = TYPE_XILINX_QSPIPS, @@ -1486,6 +1487,7 @@ static const TypeInfo xilinx_qspips_info = { .instance_size = sizeof(XilinxQSPIPS), .class_init = xilinx_qspips_class_init, }; +TYPE_INFO(xilinx_qspips_info) static const TypeInfo xlnx_zynqmp_qspips_info = { .name = TYPE_XLNX_ZYNQMP_QSPIPS, @@ -1494,12 +1496,6 @@ static const TypeInfo xlnx_zynqmp_qspips_info = { .instance_init = xlnx_zynqmp_qspips_init, .class_init = xlnx_zynqmp_qspips_class_init, }; +TYPE_INFO(xlnx_zynqmp_qspips_info) -static void xilinx_spips_register_types(void) -{ - type_register_static(&xilinx_spips_info); - type_register_static(&xilinx_qspips_info); - type_register_static(&xlnx_zynqmp_qspips_info); -} -type_init(xilinx_spips_register_types) diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index 7233068a37..27d99c74b4 100644 --- a/hw/timer/a9gtimer.c +++ b/hw/timer/a9gtimer.c @@ -368,10 +368,6 @@ static const TypeInfo a9_gtimer_info = { .instance_size = sizeof(A9GTimerState), .class_init = a9_gtimer_class_init, }; +TYPE_INFO(a9_gtimer_info) -static void a9_gtimer_register_types(void) -{ - type_register_static(&a9_gtimer_info); -} -type_init(a9_gtimer_register_types) diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c index f84fc0ea25..fcd3176656 100644 --- a/hw/timer/allwinner-a10-pit.c +++ b/hw/timer/allwinner-a10-pit.c @@ -296,10 +296,6 @@ static const TypeInfo a10_pit_info = { .instance_init = a10_pit_init, .class_init = a10_pit_class_init, }; +TYPE_INFO(a10_pit_info) -static void a10_register_types(void) -{ - type_register_static(&a10_pit_info); -} -type_init(a10_register_types); diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c index be81b7a518..922b14c335 100644 --- a/hw/timer/altera_timer.c +++ b/hw/timer/altera_timer.c @@ -235,10 +235,6 @@ static const TypeInfo altera_timer_info = { .instance_init = altera_timer_init, .class_init = altera_timer_class_init, }; +TYPE_INFO(altera_timer_info) -static void altera_timer_register(void) -{ - type_register_static(&altera_timer_info); -} -type_init(altera_timer_register) diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index cdfca3000b..9d37535bc2 100644 --- a/hw/timer/arm_mptimer.c +++ b/hw/timer/arm_mptimer.c @@ -322,10 +322,6 @@ static const TypeInfo arm_mptimer_info = { .instance_init = arm_mptimer_init, .class_init = arm_mptimer_class_init, }; +TYPE_INFO(arm_mptimer_info) -static void arm_mptimer_register_types(void) -{ - type_register_static(&arm_mptimer_info); -} -type_init(arm_mptimer_register_types) diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c index 9607366d78..664c2d9bfc 100644 --- a/hw/timer/arm_timer.c +++ b/hw/timer/arm_timer.c @@ -385,6 +385,7 @@ static const TypeInfo icp_pit_info = { .instance_size = sizeof(icp_pit_state), .instance_init = icp_pit_init, }; +TYPE_INFO(icp_pit_info) static Property sp804_properties[] = { DEFINE_PROP_UINT32("freq0", SP804State, freq0, 1000000), @@ -408,11 +409,6 @@ static const TypeInfo sp804_info = { .instance_init = sp804_init, .class_init = sp804_class_init, }; +TYPE_INFO(sp804_info) -static void arm_timer_register_types(void) -{ - type_register_static(&icp_pit_info); - type_register_static(&sp804_info); -} -type_init(arm_timer_register_types) diff --git a/hw/timer/armv7m_systick.c b/hw/timer/armv7m_systick.c index 74c58bcf24..9fc69a0e90 100644 --- a/hw/timer/armv7m_systick.c +++ b/hw/timer/armv7m_systick.c @@ -253,10 +253,6 @@ static const TypeInfo armv7m_systick_info = { .instance_size = sizeof(SysTickState), .class_init = systick_class_init, }; +TYPE_INFO(armv7m_systick_info) -static void armv7m_systick_register_types(void) -{ - type_register_static(&armv7m_systick_info); -} -type_init(armv7m_systick_register_types) diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c index 42c47d2ce6..ca7a10dc33 100644 --- a/hw/timer/aspeed_timer.c +++ b/hw/timer/aspeed_timer.c @@ -696,6 +696,7 @@ static const TypeInfo aspeed_timer_info = { .class_size = sizeof(AspeedTimerClass), .abstract = true, }; +TYPE_INFO(aspeed_timer_info) static void aspeed_2400_timer_class_init(ObjectClass *klass, void *data) { @@ -712,6 +713,7 @@ static const TypeInfo aspeed_2400_timer_info = { .parent = TYPE_ASPEED_TIMER, .class_init = aspeed_2400_timer_class_init, }; +TYPE_INFO(aspeed_2400_timer_info) static void aspeed_2500_timer_class_init(ObjectClass *klass, void *data) { @@ -728,6 +730,7 @@ static const TypeInfo aspeed_2500_timer_info = { .parent = TYPE_ASPEED_TIMER, .class_init = aspeed_2500_timer_class_init, }; +TYPE_INFO(aspeed_2500_timer_info) static void aspeed_2600_timer_class_init(ObjectClass *klass, void *data) { @@ -744,13 +747,6 @@ static const TypeInfo aspeed_2600_timer_info = { .parent = TYPE_ASPEED_TIMER, .class_init = aspeed_2600_timer_class_init, }; +TYPE_INFO(aspeed_2600_timer_info) -static void aspeed_timer_register_types(void) -{ - type_register_static(&aspeed_timer_info); - type_register_static(&aspeed_2400_timer_info); - type_register_static(&aspeed_2500_timer_info); - type_register_static(&aspeed_2600_timer_info); -} -type_init(aspeed_timer_register_types) diff --git a/hw/timer/avr_timer16.c b/hw/timer/avr_timer16.c index c48555da52..dfd940a0c5 100644 --- a/hw/timer/avr_timer16.c +++ b/hw/timer/avr_timer16.c @@ -612,10 +612,6 @@ static const TypeInfo avr_timer16_info = { .instance_init = avr_timer16_init, .class_init = avr_timer16_class_init, }; +TYPE_INFO(avr_timer16_info) -static void avr_timer16_register_types(void) -{ - type_register_static(&avr_timer16_info); -} -type_init(avr_timer16_register_types) diff --git a/hw/timer/bcm2835_systmr.c b/hw/timer/bcm2835_systmr.c index 3387a6214a..28a0c16637 100644 --- a/hw/timer/bcm2835_systmr.c +++ b/hw/timer/bcm2835_systmr.c @@ -154,10 +154,6 @@ static const TypeInfo bcm2835_systmr_info = { .instance_size = sizeof(BCM2835SystemTimerState), .class_init = bcm2835_systmr_class_init, }; +TYPE_INFO(bcm2835_systmr_info) -static void bcm2835_systmr_register_types(void) -{ - type_register_static(&bcm2835_systmr_info); -} -type_init(bcm2835_systmr_register_types); diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c index b0ba6b2bba..9ab120cf9c 100644 --- a/hw/timer/cadence_ttc.c +++ b/hw/timer/cadence_ttc.c @@ -494,10 +494,6 @@ static const TypeInfo cadence_ttc_info = { .instance_init = cadence_ttc_init, .class_init = cadence_ttc_class_init, }; +TYPE_INFO(cadence_ttc_info) -static void cadence_ttc_register_types(void) -{ - type_register_static(&cadence_ttc_info); -} -type_init(cadence_ttc_register_types) diff --git a/hw/timer/cmsdk-apb-dualtimer.c b/hw/timer/cmsdk-apb-dualtimer.c index f6534241b9..57f959a040 100644 --- a/hw/timer/cmsdk-apb-dualtimer.c +++ b/hw/timer/cmsdk-apb-dualtimer.c @@ -520,10 +520,6 @@ static const TypeInfo cmsdk_apb_dualtimer_info = { .instance_init = cmsdk_apb_dualtimer_init, .class_init = cmsdk_apb_dualtimer_class_init, }; +TYPE_INFO(cmsdk_apb_dualtimer_info) -static void cmsdk_apb_dualtimer_register_types(void) -{ - type_register_static(&cmsdk_apb_dualtimer_info); -} -type_init(cmsdk_apb_dualtimer_register_types); diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index f85f1309f3..570e9beb29 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -270,10 +270,6 @@ static const TypeInfo cmsdk_apb_timer_info = { .instance_init = cmsdk_apb_timer_init, .class_init = cmsdk_apb_timer_class_init, }; +TYPE_INFO(cmsdk_apb_timer_info) -static void cmsdk_apb_timer_register_types(void) -{ - type_register_static(&cmsdk_apb_timer_info); -} -type_init(cmsdk_apb_timer_register_types); diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c index 32612228da..6300add9d4 100644 --- a/hw/timer/digic-timer.c +++ b/hw/timer/digic-timer.c @@ -169,10 +169,6 @@ static const TypeInfo digic_timer_info = { .instance_init = digic_timer_init, .class_init = digic_timer_class_init, }; +TYPE_INFO(digic_timer_info) -static void digic_timer_register_type(void) -{ - type_register_static(&digic_timer_info); -} -type_init(digic_timer_register_type) diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index afe3d30a8e..77767a1beb 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -357,10 +357,6 @@ static const TypeInfo etraxfs_timer_info = { .instance_size = sizeof(ETRAXTimerState), .class_init = etraxfs_timer_class_init, }; +TYPE_INFO(etraxfs_timer_info) -static void etraxfs_timer_register_types(void) -{ - type_register_static(&etraxfs_timer_info); -} -type_init(etraxfs_timer_register_types) diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 29a4b10676..077c820f3b 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -1545,10 +1545,6 @@ static const TypeInfo exynos4210_mct_info = { .instance_init = exynos4210_mct_init, .class_init = exynos4210_mct_class_init, }; +TYPE_INFO(exynos4210_mct_info) -static void exynos4210_mct_register_types(void) -{ - type_register_static(&exynos4210_mct_info); -} -type_init(exynos4210_mct_register_types) diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c index 59a8c08db0..c71063f6b0 100644 --- a/hw/timer/exynos4210_pwm.c +++ b/hw/timer/exynos4210_pwm.c @@ -425,10 +425,6 @@ static const TypeInfo exynos4210_pwm_info = { .instance_init = exynos4210_pwm_init, .class_init = exynos4210_pwm_class_init, }; +TYPE_INFO(exynos4210_pwm_info) -static void exynos4210_pwm_register_types(void) -{ - type_register_static(&exynos4210_pwm_info); -} -type_init(exynos4210_pwm_register_types) diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c index eff0ee3491..d5bf6cb1f7 100644 --- a/hw/timer/grlib_gptimer.c +++ b/hw/timer/grlib_gptimer.c @@ -424,10 +424,6 @@ static const TypeInfo grlib_gptimer_info = { .instance_size = sizeof(GPTimerUnit), .class_init = grlib_gptimer_class_init, }; +TYPE_INFO(grlib_gptimer_info) -static void grlib_gptimer_register_types(void) -{ - type_register_static(&grlib_gptimer_info); -} -type_init(grlib_gptimer_register_types) diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 380acfa7c8..37f02c3c34 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -810,10 +810,6 @@ static const TypeInfo hpet_device_info = { .instance_init = hpet_init, .class_init = hpet_device_class_init, }; +TYPE_INFO(hpet_device_info) -static void hpet_register_types(void) -{ - type_register_static(&hpet_device_info); -} -type_init(hpet_register_types) diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c index 29f62e5356..f20d3d53e2 100644 --- a/hw/timer/i8254.c +++ b/hw/timer/i8254.c @@ -374,10 +374,6 @@ static const TypeInfo pit_info = { .class_init = pit_class_initfn, .class_size = sizeof(PITClass), }; +TYPE_INFO(pit_info) -static void pit_register_types(void) -{ - type_register_static(&pit_info); -} -type_init(pit_register_types) diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c index 050875b497..dc8536f392 100644 --- a/hw/timer/i8254_common.c +++ b/hw/timer/i8254_common.c @@ -262,10 +262,6 @@ static const TypeInfo pit_common_type = { .class_init = pit_common_class_init, .abstract = true, }; +TYPE_INFO(pit_common_type) -static void register_devices(void) -{ - type_register_static(&pit_common_type); -} -type_init(register_devices); diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index ebd58254d1..a13cca7c4e 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -368,10 +368,6 @@ static const TypeInfo imx_epit_info = { .instance_size = sizeof(IMXEPITState), .class_init = imx_epit_class_init, }; +TYPE_INFO(imx_epit_info) -static void imx_epit_register_types(void) -{ - type_register_static(&imx_epit_info); -} -type_init(imx_epit_register_types) diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c index 5c0d9a269c..8d6805b464 100644 --- a/hw/timer/imx_gpt.c +++ b/hw/timer/imx_gpt.c @@ -553,31 +553,27 @@ static const TypeInfo imx25_gpt_info = { .instance_init = imx25_gpt_init, .class_init = imx_gpt_class_init, }; +TYPE_INFO(imx25_gpt_info) static const TypeInfo imx31_gpt_info = { .name = TYPE_IMX31_GPT, .parent = TYPE_IMX25_GPT, .instance_init = imx31_gpt_init, }; +TYPE_INFO(imx31_gpt_info) static const TypeInfo imx6_gpt_info = { .name = TYPE_IMX6_GPT, .parent = TYPE_IMX25_GPT, .instance_init = imx6_gpt_init, }; +TYPE_INFO(imx6_gpt_info) static const TypeInfo imx7_gpt_info = { .name = TYPE_IMX7_GPT, .parent = TYPE_IMX25_GPT, .instance_init = imx7_gpt_init, }; +TYPE_INFO(imx7_gpt_info) -static void imx_gpt_register_types(void) -{ - type_register_static(&imx25_gpt_info); - type_register_static(&imx31_gpt_info); - type_register_static(&imx6_gpt_info); - type_register_static(&imx7_gpt_info); -} -type_init(imx_gpt_register_types) diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c index f703f407f5..929e8fee10 100644 --- a/hw/timer/lm32_timer.c +++ b/hw/timer/lm32_timer.c @@ -240,10 +240,6 @@ static const TypeInfo lm32_timer_info = { .instance_init = lm32_timer_init, .class_init = lm32_timer_class_init, }; +TYPE_INFO(lm32_timer_info) -static void lm32_timer_register_types(void) -{ - type_register_static(&lm32_timer_info); -} -type_init(lm32_timer_register_types) diff --git a/hw/timer/milkymist-sysctl.c b/hw/timer/milkymist-sysctl.c index 94389820b2..0e3787546a 100644 --- a/hw/timer/milkymist-sysctl.c +++ b/hw/timer/milkymist-sysctl.c @@ -353,10 +353,6 @@ static const TypeInfo milkymist_sysctl_info = { .instance_init = milkymist_sysctl_init, .class_init = milkymist_sysctl_class_init, }; +TYPE_INFO(milkymist_sysctl_info) -static void milkymist_sysctl_register_types(void) -{ - type_register_static(&milkymist_sysctl_info); -} -type_init(milkymist_sysctl_register_types) diff --git a/hw/timer/mss-timer.c b/hw/timer/mss-timer.c index 29943fd744..38976a4bca 100644 --- a/hw/timer/mss-timer.c +++ b/hw/timer/mss-timer.c @@ -289,10 +289,6 @@ static const TypeInfo mss_timer_info = { .instance_init = mss_timer_init, .class_init = mss_timer_class_init, }; +TYPE_INFO(mss_timer_info) -static void mss_timer_register_types(void) -{ - type_register_static(&mss_timer_info); -} -type_init(mss_timer_register_types) diff --git a/hw/timer/nrf51_timer.c b/hw/timer/nrf51_timer.c index 42be79c736..4cabc7e7d2 100644 --- a/hw/timer/nrf51_timer.c +++ b/hw/timer/nrf51_timer.c @@ -395,10 +395,6 @@ static const TypeInfo nrf51_timer_info = { .instance_init = nrf51_timer_init, .class_init = nrf51_timer_class_init }; +TYPE_INFO(nrf51_timer_info) -static void nrf51_timer_register_types(void) -{ - type_register_static(&nrf51_timer_info); -} -type_init(nrf51_timer_register_types) diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c index f76b0bb1ca..a9fff5b89f 100644 --- a/hw/timer/puv3_ost.c +++ b/hw/timer/puv3_ost.c @@ -156,10 +156,6 @@ static const TypeInfo puv3_ost_info = { .instance_size = sizeof(PUV3OSTState), .class_init = puv3_ost_class_init, }; +TYPE_INFO(puv3_ost_info) -static void puv3_ost_register_type(void) -{ - type_register_static(&puv3_ost_info); -} -type_init(puv3_ost_register_type) diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c index 944c165889..46a315e6db 100644 --- a/hw/timer/pxa2xx_timer.c +++ b/hw/timer/pxa2xx_timer.c @@ -572,6 +572,7 @@ static const TypeInfo pxa25x_timer_dev_info = { .instance_size = sizeof(PXA2xxTimerInfo), .class_init = pxa25x_timer_dev_class_init, }; +TYPE_INFO(pxa25x_timer_dev_info) static Property pxa27x_timer_dev_properties[] = { DEFINE_PROP_UINT32("freq", PXA2xxTimerInfo, freq, PXA27X_FREQ), @@ -594,6 +595,7 @@ static const TypeInfo pxa27x_timer_dev_info = { .instance_size = sizeof(PXA2xxTimerInfo), .class_init = pxa27x_timer_dev_class_init, }; +TYPE_INFO(pxa27x_timer_dev_info) static void pxa2xx_timer_class_init(ObjectClass *oc, void *data) { @@ -611,12 +613,6 @@ static const TypeInfo pxa2xx_timer_type_info = { .abstract = true, .class_init = pxa2xx_timer_class_init, }; +TYPE_INFO(pxa2xx_timer_type_info) -static void pxa2xx_timer_register_types(void) -{ - type_register_static(&pxa2xx_timer_type_info); - type_register_static(&pxa25x_timer_dev_info); - type_register_static(&pxa27x_timer_dev_info); -} -type_init(pxa2xx_timer_register_types) diff --git a/hw/timer/renesas_cmt.c b/hw/timer/renesas_cmt.c index 2e0fd21a36..92934f5cc5 100644 --- a/hw/timer/renesas_cmt.c +++ b/hw/timer/renesas_cmt.c @@ -274,10 +274,6 @@ static const TypeInfo rcmt_info = { .instance_init = rcmt_init, .class_init = rcmt_class_init, }; +TYPE_INFO(rcmt_info) -static void rcmt_register_types(void) -{ - type_register_static(&rcmt_info); -} -type_init(rcmt_register_types) diff --git a/hw/timer/renesas_tmr.c b/hw/timer/renesas_tmr.c index 446f2eacdd..5be0c71497 100644 --- a/hw/timer/renesas_tmr.c +++ b/hw/timer/renesas_tmr.c @@ -468,10 +468,6 @@ static const TypeInfo rtmr_info = { .instance_init = rtmr_init, .class_init = rtmr_class_init, }; +TYPE_INFO(rtmr_info) -static void rtmr_register_types(void) -{ - type_register_static(&rtmr_info); -} -type_init(rtmr_register_types) diff --git a/hw/timer/slavio_timer.c b/hw/timer/slavio_timer.c index 4c5d65e391..36734c07e6 100644 --- a/hw/timer/slavio_timer.c +++ b/hw/timer/slavio_timer.c @@ -437,10 +437,6 @@ static const TypeInfo slavio_timer_info = { .instance_init = slavio_timer_init, .class_init = slavio_timer_class_init, }; +TYPE_INFO(slavio_timer_info) -static void slavio_timer_register_types(void) -{ - type_register_static(&slavio_timer_info); -} -type_init(slavio_timer_register_types) diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c index ba8694dcd3..6cc466f2f3 100644 --- a/hw/timer/stm32f2xx_timer.c +++ b/hw/timer/stm32f2xx_timer.c @@ -338,10 +338,6 @@ static const TypeInfo stm32f2xx_timer_info = { .instance_init = stm32f2xx_timer_init, .class_init = stm32f2xx_timer_class_init, }; +TYPE_INFO(stm32f2xx_timer_info) -static void stm32f2xx_timer_register_types(void) -{ - type_register_static(&stm32f2xx_timer_info); -} -type_init(stm32f2xx_timer_register_types) diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c index 0190aa47d0..f14d4c14bb 100644 --- a/hw/timer/xilinx_timer.c +++ b/hw/timer/xilinx_timer.c @@ -263,10 +263,6 @@ static const TypeInfo xilinx_timer_info = { .instance_init = xilinx_timer_init, .class_init = xilinx_timer_class_init, }; +TYPE_INFO(xilinx_timer_info) -static void xilinx_timer_register_types(void) -{ - type_register_static(&xilinx_timer_info); -} -type_init(xilinx_timer_register_types) diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c index 60247295d4..788d05adc5 100644 --- a/hw/tpm/tpm_crb.c +++ b/hw/tpm/tpm_crb.c @@ -334,10 +334,6 @@ static const TypeInfo tpm_crb_info = { { } } }; +TYPE_INFO(tpm_crb_info) -static void tpm_crb_register(void) -{ - type_register_static(&tpm_crb_info); -} -type_init(tpm_crb_register) diff --git a/hw/tpm/tpm_spapr.c b/hw/tpm/tpm_spapr.c index 8288ab0a15..7f83a8b3b2 100644 --- a/hw/tpm/tpm_spapr.c +++ b/hw/tpm/tpm_spapr.c @@ -423,10 +423,6 @@ static const TypeInfo tpm_spapr_info = { { } } }; +TYPE_INFO(tpm_spapr_info) -static void tpm_spapr_register_types(void) -{ - type_register_static(&tpm_spapr_info); -} -type_init(tpm_spapr_register_types) diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c index 5faf6231c0..3bb4ec10fa 100644 --- a/hw/tpm/tpm_tis_isa.c +++ b/hw/tpm/tpm_tis_isa.c @@ -162,10 +162,6 @@ static const TypeInfo tpm_tis_isa_info = { { } } }; +TYPE_INFO(tpm_tis_isa_info) -static void tpm_tis_isa_register(void) -{ - type_register_static(&tpm_tis_isa_info); -} -type_init(tpm_tis_isa_register) diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c index 4a3bc70625..2a63c68f22 100644 --- a/hw/tpm/tpm_tis_sysbus.c +++ b/hw/tpm/tpm_tis_sysbus.c @@ -151,10 +151,6 @@ static const TypeInfo tpm_tis_sysbus_info = { { } } }; +TYPE_INFO(tpm_tis_sysbus_info) -static void tpm_tis_sysbus_register(void) -{ - type_register_static(&tpm_tis_sysbus_info); -} -type_init(tpm_tis_sysbus_register) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index b17bda3b29..75c5dd5d27 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -47,6 +47,7 @@ static const TypeInfo usb_bus_info = { { } } }; +TYPE_INFO(usb_bus_info) static int next_usb_bus = 0; static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses); @@ -767,11 +768,6 @@ static const TypeInfo usb_device_type_info = { .class_size = sizeof(USBDeviceClass), .class_init = usb_device_class_init, }; +TYPE_INFO(usb_device_type_info) -static void usb_register_types(void) -{ - type_register_static(&usb_bus_info); - type_register_static(&usb_device_type_info); -} -type_init(usb_register_types) diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 7d6105ef34..e4647413c6 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -612,10 +612,6 @@ static const TypeInfo emulated_card_info = { .instance_size = sizeof(EmulatedState), .class_init = emulated_class_initfn, }; +TYPE_INFO(emulated_card_info) -static void ccid_card_emulated_register_types(void) -{ - type_register_static(&emulated_card_info); -} -type_init(ccid_card_emulated_register_types) diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index bb325dbc4a..4a53ab2742 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -412,10 +412,6 @@ static const TypeInfo passthru_card_info = { .instance_size = sizeof(PassthruState), .class_init = passthru_class_initfn, }; +TYPE_INFO(passthru_card_info) -static void ccid_card_passthru_register_types(void) -{ - type_register_static(&passthru_card_info); -} -type_init(ccid_card_passthru_register_types) diff --git a/hw/usb/chipidea.c b/hw/usb/chipidea.c index 3dcd22ccba..ebf45f9a9c 100644 --- a/hw/usb/chipidea.c +++ b/hw/usb/chipidea.c @@ -169,9 +169,5 @@ static const TypeInfo chipidea_info = { .instance_init = chipidea_init, .class_init = chipidea_class_init, }; +TYPE_INFO(chipidea_info) -static void chipidea_register_type(void) -{ - type_register_static(&chipidea_info); -} -type_init(chipidea_register_type) diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 1371c44f48..eaef43d2b9 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -1019,10 +1019,10 @@ static const TypeInfo usb_audio_info = { .instance_size = sizeof(USBAudioState), .class_init = usb_audio_class_init, }; +TYPE_INFO(usb_audio_info) static void usb_audio_register_types(void) { - type_register_static(&usb_audio_info); usb_legacy_register(TYPE_USB_AUDIO, "audio", NULL); } diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index 89f63b698b..30aff4499f 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -803,6 +803,7 @@ static const TypeInfo usb_hid_type_info = { .abstract = true, .class_init = usb_hid_class_initfn, }; +TYPE_INFO(usb_hid_type_info) static Property usb_tablet_properties[] = { DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2), @@ -828,6 +829,7 @@ static const TypeInfo usb_tablet_info = { .parent = TYPE_USB_HID, .class_init = usb_tablet_class_initfn, }; +TYPE_INFO(usb_tablet_info) static Property usb_mouse_properties[] = { DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2), @@ -851,6 +853,7 @@ static const TypeInfo usb_mouse_info = { .parent = TYPE_USB_HID, .class_init = usb_mouse_class_initfn, }; +TYPE_INFO(usb_mouse_info) static Property usb_keyboard_properties[] = { DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2), @@ -875,15 +878,12 @@ static const TypeInfo usb_keyboard_info = { .parent = TYPE_USB_HID, .class_init = usb_keyboard_class_initfn, }; +TYPE_INFO(usb_keyboard_info) static void usb_hid_register_types(void) { - type_register_static(&usb_hid_type_info); - type_register_static(&usb_tablet_info); usb_legacy_register("usb-tablet", "tablet", NULL); - type_register_static(&usb_mouse_info); usb_legacy_register("usb-mouse", "mouse", NULL); - type_register_static(&usb_keyboard_info); usb_legacy_register("usb-kbd", "keyboard", NULL); } diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 5f19dd9fb5..f4193dfe85 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -695,10 +695,6 @@ static const TypeInfo hub_info = { .instance_size = sizeof(USBHubState), .class_init = usb_hub_class_initfn, }; +TYPE_INFO(hub_info) -static void usb_hub_register_types(void) -{ - type_register_static(&hub_info); -} -type_init(usb_hub_register_types) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 15a2243101..2e42a799eb 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -2113,10 +2113,6 @@ static TypeInfo mtp_info = { .instance_size = sizeof(MTPState), .class_init = usb_mtp_class_initfn, }; +TYPE_INFO(mtp_info) -static void usb_mtp_register_types(void) -{ - type_register_static(&mtp_info); -} -type_init(usb_mtp_register_types) diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index c69756709b..e5eb181d9e 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1419,10 +1419,6 @@ static const TypeInfo net_info = { .class_init = usb_net_class_initfn, .instance_init = usb_net_instance_init, }; +TYPE_INFO(net_info) -static void usb_net_register_types(void) -{ - type_register_static(&net_info); -} -type_init(usb_net_register_types) diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 7e50e3ba47..a6d85abd12 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -586,6 +586,7 @@ static const TypeInfo usb_serial_dev_type_info = { .abstract = true, .class_init = usb_serial_dev_class_init, }; +TYPE_INFO(usb_serial_dev_type_info) static void usb_serial_class_initfn(ObjectClass *klass, void *data) { @@ -602,6 +603,7 @@ static const TypeInfo serial_info = { .parent = TYPE_USB_SERIAL, .class_init = usb_serial_class_initfn, }; +TYPE_INFO(serial_info) static Property braille_properties[] = { DEFINE_PROP_CHR("chardev", USBSerialState, cs), @@ -623,12 +625,10 @@ static const TypeInfo braille_info = { .parent = TYPE_USB_SERIAL, .class_init = usb_braille_class_initfn, }; +TYPE_INFO(braille_info) static void usb_serial_register_types(void) { - type_register_static(&usb_serial_dev_type_info); - type_register_static(&serial_info); - type_register_static(&braille_info); usb_legacy_register("usb-braille", "braille", usb_braille_init); } diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index fcfe216594..a34aba700f 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -1180,6 +1180,7 @@ static const TypeInfo ccid_bus_info = { .parent = TYPE_BUS, .instance_size = sizeof(CCIDBus), }; +TYPE_INFO(ccid_bus_info) void ccid_card_send_apdu_to_guest(CCIDCardState *card, uint8_t *apdu, uint32_t len) @@ -1466,6 +1467,7 @@ static const TypeInfo ccid_info = { { } } }; +TYPE_INFO(ccid_info) static void ccid_card_class_init(ObjectClass *klass, void *data) { @@ -1484,12 +1486,10 @@ static const TypeInfo ccid_card_type_info = { .class_size = sizeof(CCIDCardClass), .class_init = ccid_card_class_init, }; +TYPE_INFO(ccid_card_type_info) static void ccid_register_types(void) { - type_register_static(&ccid_bus_info); - type_register_static(&ccid_card_type_info); - type_register_static(&ccid_info); usb_legacy_register(CCID_DEV_NAME, "ccid", NULL); } diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 405a4ccfe7..1b1b42016b 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -762,6 +762,7 @@ static const TypeInfo usb_storage_dev_type_info = { .abstract = true, .class_init = usb_msd_class_initfn_common, }; +TYPE_INFO(usb_storage_dev_type_info) static void usb_msd_instance_init(Object *obj) { @@ -785,18 +786,13 @@ static const TypeInfo msd_info = { .class_init = usb_msd_class_storage_initfn, .instance_init = usb_msd_instance_init, }; +TYPE_INFO(msd_info) static const TypeInfo bot_info = { .name = "usb-bot", .parent = TYPE_USB_STORAGE, .class_init = usb_msd_class_bot_initfn, }; +TYPE_INFO(bot_info) -static void usb_msd_register_types(void) -{ - type_register_static(&usb_storage_dev_type_info); - type_register_static(&msd_info); - type_register_static(&bot_info); -} -type_init(usb_msd_register_types) diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index a3a4d41c07..57f38da477 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -961,10 +961,6 @@ static const TypeInfo uas_info = { .instance_size = sizeof(UASDevice), .class_init = usb_uas_class_initfn, }; +TYPE_INFO(uas_info) -static void usb_uas_register_types(void) -{ - type_register_static(&uas_info); -} -type_init(usb_uas_register_types) diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c index 8aba44b8bc..cb8f156f8f 100644 --- a/hw/usb/dev-wacom.c +++ b/hw/usb/dev-wacom.c @@ -378,10 +378,10 @@ static const TypeInfo wacom_info = { .instance_size = sizeof(USBWacomState), .class_init = usb_wacom_class_init, }; +TYPE_INFO(wacom_info) static void usb_wacom_register_types(void) { - type_register_static(&wacom_info); usb_legacy_register(TYPE_USB_WACOM, "wacom-tablet", NULL); } diff --git a/hw/usb/hcd-dwc2.c b/hw/usb/hcd-dwc2.c index 97688d21bf..8a6b906e5f 100644 --- a/hw/usb/hcd-dwc2.c +++ b/hw/usb/hcd-dwc2.c @@ -1401,10 +1401,6 @@ static const TypeInfo dwc2_usb_type_info = { .class_size = sizeof(DWC2Class), .class_init = dwc2_class_init, }; +TYPE_INFO(dwc2_usb_type_info) -static void dwc2_usb_register_types(void) -{ - type_register_static(&dwc2_usb_type_info); -} -type_init(dwc2_usb_register_types) diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c index 4c37c8e227..6c97b8ceea 100644 --- a/hw/usb/hcd-ehci-pci.c +++ b/hw/usb/hcd-ehci-pci.c @@ -178,6 +178,7 @@ static const TypeInfo ehci_pci_type_info = { { }, }, }; +TYPE_INFO(ehci_pci_type_info) static void ehci_data_class_init(ObjectClass *klass, void *data) { @@ -223,7 +224,6 @@ static void ehci_pci_register_types(void) }; int i; - type_register_static(&ehci_pci_type_info); for (i = 0; i < ARRAY_SIZE(ehci_pci_info); i++) { ehci_type_info.name = ehci_pci_info[i].name; diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index 3730736540..7419494528 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -98,6 +98,7 @@ static const TypeInfo ehci_type_info = { .class_init = ehci_sysbus_class_init, .class_size = sizeof(SysBusEHCIClass), }; +TYPE_INFO(ehci_type_info) static void ehci_platform_class_init(ObjectClass *oc, void *data) { @@ -114,6 +115,7 @@ static const TypeInfo ehci_platform_type_info = { .parent = TYPE_SYS_BUS_EHCI, .class_init = ehci_platform_class_init, }; +TYPE_INFO(ehci_platform_type_info) static void ehci_exynos4210_class_init(ObjectClass *oc, void *data) { @@ -130,6 +132,7 @@ static const TypeInfo ehci_exynos4210_type_info = { .parent = TYPE_SYS_BUS_EHCI, .class_init = ehci_exynos4210_class_init, }; +TYPE_INFO(ehci_exynos4210_type_info) static void ehci_aw_h3_class_init(ObjectClass *oc, void *data) { @@ -146,6 +149,7 @@ static const TypeInfo ehci_aw_h3_type_info = { .parent = TYPE_SYS_BUS_EHCI, .class_init = ehci_aw_h3_class_init, }; +TYPE_INFO(ehci_aw_h3_type_info) static void ehci_tegra2_class_init(ObjectClass *oc, void *data) { @@ -162,6 +166,7 @@ static const TypeInfo ehci_tegra2_type_info = { .parent = TYPE_SYS_BUS_EHCI, .class_init = ehci_tegra2_class_init, }; +TYPE_INFO(ehci_tegra2_type_info) static void ehci_ppc4xx_init(Object *o) { @@ -186,6 +191,7 @@ static const TypeInfo ehci_ppc4xx_type_info = { .class_init = ehci_ppc4xx_class_init, .instance_init = ehci_ppc4xx_init, }; +TYPE_INFO(ehci_ppc4xx_type_info) /* * Faraday FUSBH200 USB 2.0 EHCI @@ -262,16 +268,6 @@ static const TypeInfo ehci_fusbh200_type_info = { .instance_init = fusbh200_ehci_init, .class_init = fusbh200_ehci_class_init, }; +TYPE_INFO(ehci_fusbh200_type_info) -static void ehci_sysbus_register_types(void) -{ - type_register_static(&ehci_type_info); - type_register_static(&ehci_platform_type_info); - type_register_static(&ehci_exynos4210_type_info); - type_register_static(&ehci_aw_h3_type_info); - type_register_static(&ehci_tegra2_type_info); - type_register_static(&ehci_ppc4xx_type_info); - type_register_static(&ehci_fusbh200_type_info); -} -type_init(ehci_sysbus_register_types) diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c index a7fb1666af..aa461de292 100644 --- a/hw/usb/hcd-ohci-pci.c +++ b/hw/usb/hcd-ohci-pci.c @@ -155,10 +155,6 @@ static const TypeInfo ohci_pci_info = { { }, }, }; +TYPE_INFO(ohci_pci_info) -static void ohci_pci_register_types(void) -{ - type_register_static(&ohci_pci_info); -} -type_init(ohci_pci_register_types) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 1e6e85e86a..d69956e998 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1995,10 +1995,6 @@ static const TypeInfo ohci_sysbus_info = { .instance_size = sizeof(OHCISysBusState), .class_init = ohci_sysbus_class_init, }; +TYPE_INFO(ohci_sysbus_info) -static void ohci_register_types(void) -{ - type_register_static(&ohci_sysbus_info); -} -type_init(ohci_register_types) diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 37f7beb3fa..a30964ac2c 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -1333,6 +1333,7 @@ static const TypeInfo uhci_pci_type_info = { { }, }, }; +TYPE_INFO(uhci_pci_type_info) static void uhci_data_class_init(ObjectClass *klass, void *data) { @@ -1432,7 +1433,6 @@ static void uhci_register_types(void) }; int i; - type_register_static(&uhci_pci_type_info); for (i = 0; i < ARRAY_SIZE(uhci_info); i++) { uhci_type_info.name = uhci_info[i].name; diff --git a/hw/usb/hcd-xhci-nec.c b/hw/usb/hcd-xhci-nec.c index e6a5a22b6d..91e27b64e1 100644 --- a/hw/usb/hcd-xhci-nec.c +++ b/hw/usb/hcd-xhci-nec.c @@ -55,10 +55,6 @@ static const TypeInfo nec_xhci_info = { .parent = TYPE_XHCI, .class_init = nec_xhci_class_init, }; +TYPE_INFO(nec_xhci_info) -static void nec_xhci_register_types(void) -{ - type_register_static(&nec_xhci_info); -} -type_init(nec_xhci_register_types) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 67a18fe2b6..7d2d8f854e 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3728,6 +3728,7 @@ static const TypeInfo xhci_info = { { } }, }; +TYPE_INFO(xhci_info) static void qemu_xhci_class_init(ObjectClass *klass, void *data) { @@ -3755,11 +3756,6 @@ static const TypeInfo qemu_xhci_info = { .class_init = qemu_xhci_class_init, .instance_init = qemu_xhci_instance_init, }; +TYPE_INFO(qemu_xhci_info) -static void xhci_register_types(void) -{ - type_register_static(&xhci_info); - type_register_static(&qemu_xhci_info); -} -type_init(xhci_register_types) diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index c474551d84..89d313e7e1 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1708,13 +1708,9 @@ static TypeInfo usb_host_dev_info = { .class_init = usb_host_class_initfn, .instance_init = usb_host_instance_init, }; +TYPE_INFO(usb_host_dev_info) -static void usb_host_register_types(void) -{ - type_register_static(&usb_host_dev_info); -} -type_init(usb_host_register_types) /* ------------------------------------------------------------------------ */ diff --git a/hw/usb/imx-usb-phy.c b/hw/usb/imx-usb-phy.c index e705a03a1f..59ed520aae 100644 --- a/hw/usb/imx-usb-phy.c +++ b/hw/usb/imx-usb-phy.c @@ -216,10 +216,6 @@ static const TypeInfo imx_usbphy_info = { .instance_size = sizeof(IMXUSBPHYState), .class_init = imx_usbphy_class_init, }; +TYPE_INFO(imx_usbphy_info) -static void imx_usbphy_register_types(void) -{ - type_register_static(&imx_usbphy_info); -} -type_init(imx_usbphy_register_types) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 417a60a2e6..b5c1e656bd 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -2605,10 +2605,6 @@ static const TypeInfo usbredir_dev_info = { .class_init = usbredir_class_initfn, .instance_init = usbredir_instance_init, }; +TYPE_INFO(usbredir_dev_info) -static void usbredir_register_types(void) -{ - type_register_static(&usbredir_dev_info); -} -type_init(usbredir_register_types) diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c index 27eb28d3e4..fc1263fcd0 100644 --- a/hw/usb/tusb6010.c +++ b/hw/usb/tusb6010.c @@ -840,10 +840,6 @@ static const TypeInfo tusb6010_info = { .instance_size = sizeof(TUSBState), .class_init = tusb6010_class_init, }; +TYPE_INFO(tusb6010_info) -static void tusb6010_register_types(void) -{ - type_register_static(&tusb6010_info); -} -type_init(tusb6010_register_types) diff --git a/hw/vfio/amd-xgbe.c b/hw/vfio/amd-xgbe.c index 96bd608b8d..324fb4808e 100644 --- a/hw/vfio/amd-xgbe.c +++ b/hw/vfio/amd-xgbe.c @@ -52,10 +52,6 @@ static const TypeInfo vfio_amd_xgbe_dev_info = { .class_init = vfio_amd_xgbe_class_init, .class_size = sizeof(VFIOAmdXgbeDeviceClass), }; +TYPE_INFO(vfio_amd_xgbe_dev_info) -static void register_amd_xgbe_dev_type(void) -{ - type_register_static(&vfio_amd_xgbe_dev_info); -} -type_init(register_amd_xgbe_dev_type) diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index b9330a8e6f..a45da2aa82 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -178,10 +178,6 @@ static const TypeInfo vfio_ap_info = { .instance_size = sizeof(VFIOAPDevice), .class_init = vfio_ap_class_init, }; +TYPE_INFO(vfio_ap_info) -static void vfio_ap_type_init(void) -{ - type_register_static(&vfio_ap_info); -} -type_init(vfio_ap_type_init) diff --git a/hw/vfio/calxeda-xgmac.c b/hw/vfio/calxeda-xgmac.c index 87c382e736..da37db3837 100644 --- a/hw/vfio/calxeda-xgmac.c +++ b/hw/vfio/calxeda-xgmac.c @@ -52,10 +52,6 @@ static const TypeInfo vfio_calxeda_xgmac_dev_info = { .class_init = vfio_calxeda_xgmac_class_init, .class_size = sizeof(VFIOCalxedaXgmacDeviceClass), }; +TYPE_INFO(vfio_calxeda_xgmac_dev_info) -static void register_calxeda_xgmac_dev_type(void) -{ - type_register_static(&vfio_calxeda_xgmac_dev_info); -} -type_init(register_calxeda_xgmac_dev_type) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index ff7f369779..96488335ed 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -740,10 +740,6 @@ static const TypeInfo vfio_ccw_info = { .instance_size = sizeof(VFIOCCWDevice), .class_init = vfio_ccw_class_init, }; +TYPE_INFO(vfio_ccw_info) -static void register_vfio_ccw_type(void) -{ - type_register_static(&vfio_ccw_info); -} -type_init(register_vfio_ccw_type) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 64e332746b..5a2aa3c06d 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -208,13 +208,9 @@ static TypeInfo vfio_pci_igd_lpc_bridge_info = { { }, }, }; +TYPE_INFO(vfio_pci_igd_lpc_bridge_info) -static void vfio_pci_igd_register_types(void) -{ - type_register_static(&vfio_pci_igd_lpc_bridge_info); -} -type_init(vfio_pci_igd_register_types) static int vfio_pci_igd_lpc_init(VFIOPCIDevice *vdev, struct vfio_region_info *info) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 2e561c06d6..8b7148daae 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3210,6 +3210,7 @@ static const TypeInfo vfio_pci_dev_info = { { } }, }; +TYPE_INFO(vfio_pci_dev_info) static Property vfio_pci_dev_nohotplug_properties[] = { DEFINE_PROP_BOOL("ramfb", VFIOPCIDevice, enable_ramfb, false), @@ -3230,11 +3231,6 @@ static const TypeInfo vfio_pci_nohotplug_dev_info = { .instance_size = sizeof(VFIOPCIDevice), .class_init = vfio_pci_nohotplug_dev_class_init, }; +TYPE_INFO(vfio_pci_nohotplug_dev_info) -static void register_vfio_pci_dev_type(void) -{ - type_register_static(&vfio_pci_dev_info); - type_register_static(&vfio_pci_nohotplug_dev_info); -} -type_init(register_vfio_pci_dev_type) diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c index ac2cefc9b1..16688f040f 100644 --- a/hw/vfio/platform.c +++ b/hw/vfio/platform.c @@ -714,10 +714,6 @@ static const TypeInfo vfio_platform_dev_info = { .class_init = vfio_platform_class_init, .class_size = sizeof(VFIOPlatformDeviceClass), }; +TYPE_INFO(vfio_platform_dev_info) -static void register_vfio_platform_dev_type(void) -{ - type_register_static(&vfio_platform_dev_info); -} -type_init(register_vfio_platform_dev_type) diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index 1bc5d03a00..bc9165c2ad 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -301,10 +301,6 @@ static const TypeInfo vuf_info = { .instance_size = sizeof(VHostUserFS), .class_init = vuf_class_init, }; +TYPE_INFO(vuf_info) -static void vuf_register_types(void) -{ - type_register_static(&vuf_info); -} -type_init(vuf_register_types) diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c index 3534a39d62..0e8f403bd5 100644 --- a/hw/virtio/vhost-user-vsock.c +++ b/hw/virtio/vhost-user-vsock.c @@ -172,10 +172,6 @@ static const TypeInfo vuv_info = { .instance_size = sizeof(VHostUserVSock), .class_init = vuv_class_init, }; +TYPE_INFO(vuv_info) -static void vuv_register_types(void) -{ - type_register_static(&vuv_info); -} -type_init(vuv_register_types) diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c index 5b2ebf3496..33c356e67a 100644 --- a/hw/virtio/vhost-vsock-common.c +++ b/hw/virtio/vhost-vsock-common.c @@ -249,10 +249,6 @@ static const TypeInfo vhost_vsock_common_info = { .class_init = vhost_vsock_common_class_init, .abstract = true, }; +TYPE_INFO(vhost_vsock_common_info) -static void vhost_vsock_common_register_types(void) -{ - type_register_static(&vhost_vsock_common_info); -} -type_init(vhost_vsock_common_register_types) diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index c8f0699b4f..dde39257e4 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -224,10 +224,6 @@ static const TypeInfo vhost_vsock_info = { .instance_size = sizeof(VHostVSock), .class_init = vhost_vsock_class_init, }; +TYPE_INFO(vhost_vsock_info) -static void vhost_vsock_register_types(void) -{ - type_register_static(&vhost_vsock_info); -} -type_init(vhost_vsock_register_types) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 22cb5df717..070f3e8364 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -1071,10 +1071,6 @@ static const TypeInfo virtio_balloon_info = { .instance_init = virtio_balloon_instance_init, .class_init = virtio_balloon_class_init, }; +TYPE_INFO(virtio_balloon_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_balloon_info); -} -type_init(virtio_register_types) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index d6332d45c3..29d49173bd 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -335,10 +335,6 @@ static const TypeInfo virtio_bus_info = { .class_size = sizeof(VirtioBusClass), .class_init = virtio_bus_class_init }; +TYPE_INFO(virtio_bus_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_bus_info); -} -type_init(virtio_register_types) diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 6da12e315f..86c4076860 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -986,10 +986,6 @@ static const TypeInfo virtio_crypto_info = { .instance_init = virtio_crypto_instance_init, .class_init = virtio_crypto_class_init, }; +TYPE_INFO(virtio_crypto_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_crypto_info); -} -type_init(virtio_register_types) diff --git a/hw/virtio/virtio-input-pci.c b/hw/virtio/virtio-input-pci.c index 74651a42ea..29c633b3d8 100644 --- a/hw/virtio/virtio-input-pci.c +++ b/hw/virtio/virtio-input-pci.c @@ -112,6 +112,7 @@ static const TypeInfo virtio_input_pci_info = { .class_init = virtio_input_pci_class_init, .abstract = true, }; +TYPE_INFO(virtio_input_pci_info) static const TypeInfo virtio_input_hid_pci_info = { .name = TYPE_VIRTIO_INPUT_HID_PCI, @@ -119,6 +120,7 @@ static const TypeInfo virtio_input_hid_pci_info = { .instance_size = sizeof(VirtIOInputHIDPCI), .abstract = true, }; +TYPE_INFO(virtio_input_hid_pci_info) static const VirtioPCIDeviceTypeInfo virtio_keyboard_pci_info = { .generic_name = TYPE_VIRTIO_KEYBOARD_PCI, @@ -146,8 +148,6 @@ static const VirtioPCIDeviceTypeInfo virtio_tablet_pci_info = { static void virtio_pci_input_register(void) { /* Base types: */ - type_register_static(&virtio_input_pci_info); - type_register_static(&virtio_input_hid_pci_info); /* Implementations: */ virtio_pci_types_register(&virtio_keyboard_pci_info); diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 5d56865e56..ad7665dad3 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -984,17 +984,13 @@ static const TypeInfo virtio_iommu_info = { .instance_init = virtio_iommu_instance_init, .class_init = virtio_iommu_class_init, }; +TYPE_INFO(virtio_iommu_info) static const TypeInfo virtio_iommu_memory_region_info = { .parent = TYPE_IOMMU_MEMORY_REGION, .name = TYPE_VIRTIO_IOMMU_MEMORY_REGION, .class_init = virtio_iommu_memory_region_class_init, }; +TYPE_INFO(virtio_iommu_memory_region_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_iommu_info); - type_register_static(&virtio_iommu_memory_region_info); -} -type_init(virtio_register_types) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 7740fc613f..2d0fee731f 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -862,10 +862,6 @@ static const TypeInfo virtio_mem_info = { .class_init = virtio_mem_class_init, .class_size = sizeof(VirtIOMEMClass), }; +TYPE_INFO(virtio_mem_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_mem_info); -} -type_init(virtio_register_types) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index f12d1595aa..fddb3d8d15 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -721,6 +721,7 @@ static const TypeInfo virtio_mmio_info = { .instance_size = sizeof(VirtIOMMIOProxy), .class_init = virtio_mmio_class_init, }; +TYPE_INFO(virtio_mmio_info) /* virtio-mmio-bus. */ @@ -790,11 +791,6 @@ static const TypeInfo virtio_mmio_bus_info = { .instance_size = sizeof(VirtioBusState), .class_init = virtio_mmio_bus_class_init, }; +TYPE_INFO(virtio_mmio_bus_info) -static void virtio_mmio_register_types(void) -{ - type_register_static(&virtio_mmio_bus_info); - type_register_static(&virtio_mmio_info); -} -type_init(virtio_mmio_register_types) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index ccdf54e81c..a619acc264 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1940,6 +1940,7 @@ static const TypeInfo virtio_pci_info = { .class_size = sizeof(VirtioPCIClass), .abstract = true, }; +TYPE_INFO(virtio_pci_info) static Property virtio_pci_generic_properties[] = { DEFINE_PROP_ON_OFF_AUTO("disable-legacy", VirtIOPCIProxy, disable_legacy, @@ -2103,12 +2104,11 @@ static const TypeInfo virtio_pci_bus_info = { .instance_size = sizeof(VirtioPCIBusState), .class_init = virtio_pci_bus_class_init, }; +TYPE_INFO(virtio_pci_bus_info) static void virtio_pci_register_types(void) { /* Base types: */ - type_register_static(&virtio_pci_bus_info); - type_register_static(&virtio_pci_info); } type_init(virtio_pci_register_types) diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c index 1e0c137497..f085a8687a 100644 --- a/hw/virtio/virtio-pmem.c +++ b/hw/virtio/virtio-pmem.c @@ -183,10 +183,6 @@ static TypeInfo virtio_pmem_info = { .class_init = virtio_pmem_class_init, .instance_size = sizeof(VirtIOPMEM), }; +TYPE_INFO(virtio_pmem_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_pmem_info); -} -type_init(virtio_register_types) diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 2886c0ce2a..0606aea8dc 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -281,10 +281,6 @@ static const TypeInfo virtio_rng_info = { .instance_size = sizeof(VirtIORNG), .class_init = virtio_rng_class_init, }; +TYPE_INFO(virtio_rng_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_rng_info); -} -type_init(virtio_register_types) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index e983025217..e3788a037b 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3853,10 +3853,6 @@ static const TypeInfo virtio_device_info = { .abstract = true, .class_size = sizeof(VirtioDeviceClass), }; +TYPE_INFO(virtio_device_info) -static void virtio_register_types(void) -{ - type_register_static(&virtio_device_info); -} -type_init(virtio_register_types) diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c index 5bbadadfa6..24cc0aa703 100644 --- a/hw/watchdog/cmsdk-apb-watchdog.c +++ b/hw/watchdog/cmsdk-apb-watchdog.c @@ -382,6 +382,7 @@ static const TypeInfo cmsdk_apb_watchdog_info = { .instance_init = cmsdk_apb_watchdog_init, .class_init = cmsdk_apb_watchdog_class_init, }; +TYPE_INFO(cmsdk_apb_watchdog_info) static void luminary_watchdog_init(Object *obj) { @@ -396,11 +397,6 @@ static const TypeInfo luminary_watchdog_info = { .parent = TYPE_CMSDK_APB_WATCHDOG, .instance_init = luminary_watchdog_init }; +TYPE_INFO(luminary_watchdog_info) -static void cmsdk_apb_watchdog_register_types(void) -{ - type_register_static(&cmsdk_apb_watchdog_info); - type_register_static(&luminary_watchdog_info); -} -type_init(cmsdk_apb_watchdog_register_types); diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index 6352ba1b0e..b8a5cb8a55 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -282,6 +282,7 @@ static const TypeInfo aspeed_wdt_info = { .class_size = sizeof(AspeedWDTClass), .abstract = true, }; +TYPE_INFO(aspeed_wdt_info) static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data) { @@ -301,6 +302,7 @@ static const TypeInfo aspeed_2400_wdt_info = { .instance_size = sizeof(AspeedWDTState), .class_init = aspeed_2400_wdt_class_init, }; +TYPE_INFO(aspeed_2400_wdt_info) static void aspeed_2500_wdt_reset_pulse(AspeedWDTState *s, uint32_t property) { @@ -336,6 +338,7 @@ static const TypeInfo aspeed_2500_wdt_info = { .instance_size = sizeof(AspeedWDTState), .class_init = aspeed_2500_wdt_class_init, }; +TYPE_INFO(aspeed_2500_wdt_info) static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data) { @@ -356,14 +359,11 @@ static const TypeInfo aspeed_2600_wdt_info = { .instance_size = sizeof(AspeedWDTState), .class_init = aspeed_2600_wdt_class_init, }; +TYPE_INFO(aspeed_2600_wdt_info) static void wdt_aspeed_register_types(void) { watchdog_add_model(&model); - type_register_static(&aspeed_wdt_info); - type_register_static(&aspeed_2400_wdt_info); - type_register_static(&aspeed_2500_wdt_info); - type_register_static(&aspeed_2600_wdt_info); } type_init(wdt_aspeed_register_types) diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c index 71a945f0bd..fb32d70be6 100644 --- a/hw/watchdog/wdt_diag288.c +++ b/hw/watchdog/wdt_diag288.c @@ -137,11 +137,11 @@ static const TypeInfo wdt_diag288_info = { .instance_size = sizeof(DIAG288State), .class_size = sizeof(DIAG288Class), }; +TYPE_INFO(wdt_diag288_info) static void wdt_diag288_register_types(void) { watchdog_add_model(&model); - type_register_static(&wdt_diag288_info); } type_init(wdt_diag288_register_types) diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 370cf92e85..989713fa4b 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -491,11 +491,11 @@ static const TypeInfo i6300esb_info = { { }, }, }; +TYPE_INFO(i6300esb_info) static void i6300esb_register_types(void) { watchdog_add_model(&model); - type_register_static(&i6300esb_info); } type_init(i6300esb_register_types) diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c index 985944a84a..ead7d0dbbd 100644 --- a/hw/watchdog/wdt_ib700.c +++ b/hw/watchdog/wdt_ib700.c @@ -146,11 +146,11 @@ static const TypeInfo wdt_ib700_info = { .instance_size = sizeof(IB700State), .class_init = wdt_ib700_class_init, }; +TYPE_INFO(wdt_ib700_info) static void wdt_ib700_register_types(void) { watchdog_add_model(&model); - type_register_static(&wdt_ib700_info); } type_init(wdt_ib700_register_types) diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c index a5fb76308f..0e71e54c02 100644 --- a/hw/watchdog/wdt_imx2.c +++ b/hw/watchdog/wdt_imx2.c @@ -290,6 +290,7 @@ static const TypeInfo imx2_wdt_info = { .instance_size = sizeof(IMX2WdtState), .class_init = imx2_wdt_class_init, }; +TYPE_INFO(imx2_wdt_info) static WatchdogTimerModel model = { .wdt_name = "imx2-watchdog", @@ -299,6 +300,5 @@ static WatchdogTimerModel model = { static void imx2_wdt_register_type(void) { watchdog_add_model(&model); - type_register_static(&imx2_wdt_info); } type_init(imx2_wdt_register_type) diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 9ce1c9540b..ff65360545 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -517,6 +517,7 @@ static const TypeInfo xen_bus_type_info = { { } }, }; +TYPE_INFO(xen_bus_type_info) void xen_device_backend_printf(XenDevice *xendev, const char *key, const char *fmt, ...) @@ -1349,6 +1350,7 @@ static const TypeInfo xen_device_type_info = { .class_size = sizeof(XenDeviceClass), .class_init = xen_device_class_init, }; +TYPE_INFO(xen_device_type_info) typedef struct XenBridge { SysBusDevice busdev; @@ -1361,15 +1363,9 @@ static const TypeInfo xen_bridge_type_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(XenBridge), }; +TYPE_INFO(xen_bridge_type_info) -static void xen_register_types(void) -{ - type_register_static(&xen_bridge_type_info); - type_register_static(&xen_bus_type_info); - type_register_static(&xen_device_type_info); -} -type_init(xen_register_types) void xen_bus_init(void) { diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c index b61a4855b7..2fdac398e1 100644 --- a/hw/xen/xen-legacy-backend.c +++ b/hw/xen/xen-legacy-backend.c @@ -797,6 +797,7 @@ static const TypeInfo xendev_type_info = { .class_init = xendev_class_init, .instance_size = sizeof(struct XenLegacyDevice), }; +TYPE_INFO(xendev_type_info) static void xen_sysbus_class_init(ObjectClass *klass, void *data) { @@ -814,6 +815,7 @@ static const TypeInfo xensysbus_info = { { } } }; +TYPE_INFO(xensysbus_info) static Property xen_sysdev_properties[] = { {/* end of property list */}, @@ -832,12 +834,6 @@ static const TypeInfo xensysdev_info = { .instance_size = sizeof(SysBusDevice), .class_init = xen_sysdev_class_init, }; +TYPE_INFO(xensysdev_info) -static void xenbe_register_types(void) -{ - type_register_static(&xensysbus_info); - type_register_static(&xensysdev_info); - type_register_static(&xendev_type_info); -} -type_init(xenbe_register_types) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 6d359ee486..e6a860c76b 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -994,10 +994,6 @@ static const TypeInfo xen_pci_passthrough_info = { { }, }, }; +TYPE_INFO(xen_pci_passthrough_info) -static void xen_pci_passthrough_register_types(void) -{ - type_register_static(&xen_pci_passthrough_info); -} -type_init(xen_pci_passthrough_register_types) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 10de15855a..1a611e883b 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -614,6 +614,7 @@ static const TypeInfo xtfpga_lx60_type = { .parent = TYPE_MACHINE, .class_init = xtfpga_lx60_class_init, }; +TYPE_INFO(xtfpga_lx60_type) static void xtfpga_lx60_nommu_class_init(ObjectClass *oc, void *data) { @@ -631,6 +632,7 @@ static const TypeInfo xtfpga_lx60_nommu_type = { .parent = TYPE_MACHINE, .class_init = xtfpga_lx60_nommu_class_init, }; +TYPE_INFO(xtfpga_lx60_nommu_type) static void xtfpga_lx200_class_init(ObjectClass *oc, void *data) { @@ -648,6 +650,7 @@ static const TypeInfo xtfpga_lx200_type = { .parent = TYPE_MACHINE, .class_init = xtfpga_lx200_class_init, }; +TYPE_INFO(xtfpga_lx200_type) static void xtfpga_lx200_nommu_class_init(ObjectClass *oc, void *data) { @@ -665,6 +668,7 @@ static const TypeInfo xtfpga_lx200_nommu_type = { .parent = TYPE_MACHINE, .class_init = xtfpga_lx200_nommu_class_init, }; +TYPE_INFO(xtfpga_lx200_nommu_type) static void xtfpga_ml605_class_init(ObjectClass *oc, void *data) { @@ -682,6 +686,7 @@ static const TypeInfo xtfpga_ml605_type = { .parent = TYPE_MACHINE, .class_init = xtfpga_ml605_class_init, }; +TYPE_INFO(xtfpga_ml605_type) static void xtfpga_ml605_nommu_class_init(ObjectClass *oc, void *data) { @@ -699,6 +704,7 @@ static const TypeInfo xtfpga_ml605_nommu_type = { .parent = TYPE_MACHINE, .class_init = xtfpga_ml605_nommu_class_init, }; +TYPE_INFO(xtfpga_ml605_nommu_type) static void xtfpga_kc705_class_init(ObjectClass *oc, void *data) { @@ -716,6 +722,7 @@ static const TypeInfo xtfpga_kc705_type = { .parent = TYPE_MACHINE, .class_init = xtfpga_kc705_class_init, }; +TYPE_INFO(xtfpga_kc705_type) static void xtfpga_kc705_nommu_class_init(ObjectClass *oc, void *data) { @@ -733,17 +740,6 @@ static const TypeInfo xtfpga_kc705_nommu_type = { .parent = TYPE_MACHINE, .class_init = xtfpga_kc705_nommu_class_init, }; +TYPE_INFO(xtfpga_kc705_nommu_type) -static void xtfpga_machines_init(void) -{ - type_register_static(&xtfpga_lx60_type); - type_register_static(&xtfpga_lx200_type); - type_register_static(&xtfpga_ml605_type); - type_register_static(&xtfpga_kc705_type); - type_register_static(&xtfpga_lx60_nommu_type); - type_register_static(&xtfpga_lx200_nommu_type); - type_register_static(&xtfpga_ml605_nommu_type); - type_register_static(&xtfpga_kc705_nommu_type); -} -type_init(xtfpga_machines_init) diff --git a/io/channel-buffer.c b/io/channel-buffer.c index 5402e0cced..efc86f94a6 100644 --- a/io/channel-buffer.c +++ b/io/channel-buffer.c @@ -242,10 +242,6 @@ static const TypeInfo qio_channel_buffer_info = { .instance_finalize = qio_channel_buffer_finalize, .class_init = qio_channel_buffer_class_init, }; +TYPE_INFO(qio_channel_buffer_info) -static void qio_channel_buffer_register_types(void) -{ - type_register_static(&qio_channel_buffer_info); -} -type_init(qio_channel_buffer_register_types); diff --git a/io/channel-command.c b/io/channel-command.c index 368dd62b7e..32382e2b91 100644 --- a/io/channel-command.c +++ b/io/channel-command.c @@ -383,10 +383,6 @@ static const TypeInfo qio_channel_command_info = { .instance_finalize = qio_channel_command_finalize, .class_init = qio_channel_command_class_init, }; +TYPE_INFO(qio_channel_command_info) -static void qio_channel_command_register_types(void) -{ - type_register_static(&qio_channel_command_info); -} -type_init(qio_channel_command_register_types); diff --git a/io/channel-file.c b/io/channel-file.c index dac21f6012..335773edf0 100644 --- a/io/channel-file.c +++ b/io/channel-file.c @@ -225,10 +225,6 @@ static const TypeInfo qio_channel_file_info = { .instance_finalize = qio_channel_file_finalize, .class_init = qio_channel_file_class_init, }; +TYPE_INFO(qio_channel_file_info) -static void qio_channel_file_register_types(void) -{ - type_register_static(&qio_channel_file_info); -} -type_init(qio_channel_file_register_types); diff --git a/io/channel-socket.c b/io/channel-socket.c index e1b4667087..e91b6b9756 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -797,10 +797,6 @@ static const TypeInfo qio_channel_socket_info = { .instance_finalize = qio_channel_socket_finalize, .class_init = qio_channel_socket_class_init, }; +TYPE_INFO(qio_channel_socket_info) -static void qio_channel_socket_register_types(void) -{ - type_register_static(&qio_channel_socket_info); -} -type_init(qio_channel_socket_register_types); diff --git a/io/channel-tls.c b/io/channel-tls.c index 7ec8ceff2f..4c330ae540 100644 --- a/io/channel-tls.c +++ b/io/channel-tls.c @@ -423,10 +423,6 @@ static const TypeInfo qio_channel_tls_info = { .instance_finalize = qio_channel_tls_finalize, .class_init = qio_channel_tls_class_init, }; +TYPE_INFO(qio_channel_tls_info) -static void qio_channel_tls_register_types(void) -{ - type_register_static(&qio_channel_tls_info); -} -type_init(qio_channel_tls_register_types); diff --git a/io/channel-websock.c b/io/channel-websock.c index 47a0e941d9..4b6ee3ddb8 100644 --- a/io/channel-websock.c +++ b/io/channel-websock.c @@ -1332,10 +1332,6 @@ static const TypeInfo qio_channel_websock_info = { .instance_finalize = qio_channel_websock_finalize, .class_init = qio_channel_websock_class_init, }; +TYPE_INFO(qio_channel_websock_info) -static void qio_channel_websock_register_types(void) -{ - type_register_static(&qio_channel_websock_info); -} -type_init(qio_channel_websock_register_types); diff --git a/io/channel.c b/io/channel.c index e4376eb0bc..236fa1e343 100644 --- a/io/channel.c +++ b/io/channel.c @@ -539,12 +539,8 @@ static const TypeInfo qio_channel_info = { .abstract = true, .class_size = sizeof(QIOChannelClass), }; +TYPE_INFO(qio_channel_info) -static void qio_channel_register_types(void) -{ - type_register_static(&qio_channel_info); -} -type_init(qio_channel_register_types); diff --git a/io/dns-resolver.c b/io/dns-resolver.c index 6ebe2a5650..2c79ea8949 100644 --- a/io/dns-resolver.c +++ b/io/dns-resolver.c @@ -269,12 +269,8 @@ static const TypeInfo qio_dns_resolver_info = { .instance_size = sizeof(QIODNSResolver), .class_size = sizeof(QIODNSResolverClass), }; +TYPE_INFO(qio_dns_resolver_info) -static void qio_dns_resolver_register_types(void) -{ - type_register_static(&qio_dns_resolver_info); -} -type_init(qio_dns_resolver_register_types); diff --git a/io/net-listener.c b/io/net-listener.c index 5d8a226872..7b06b60ff0 100644 --- a/io/net-listener.c +++ b/io/net-listener.c @@ -309,12 +309,8 @@ static const TypeInfo qio_net_listener_info = { .instance_finalize = qio_net_listener_finalize, .class_size = sizeof(QIONetListenerClass), }; +TYPE_INFO(qio_net_listener_info) -static void qio_net_listener_register_types(void) -{ - type_register_static(&qio_net_listener_info); -} -type_init(qio_net_listener_register_types); diff --git a/iothread.c b/iothread.c index 263ec6e5bc..c94d139e16 100644 --- a/iothread.c +++ b/iothread.c @@ -292,13 +292,9 @@ static const TypeInfo iothread_info = { {} }, }; +TYPE_INFO(iothread_info) -static void iothread_register_types(void) -{ - type_register_static(&iothread_info); -} -type_init(iothread_register_types) char *iothread_get_id(IOThread *iothread) { diff --git a/migration/migration.c b/migration/migration.c index 8fe36339db..1847320bb9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3814,10 +3814,6 @@ static const TypeInfo migration_type = { .instance_init = migration_instance_init, .instance_finalize = migration_instance_finalize, }; +TYPE_INFO(migration_type) -static void register_migration_types(void) -{ - type_register_static(&migration_type); -} -type_init(register_migration_types); diff --git a/migration/rdma.c b/migration/rdma.c index bea6532813..15ad985d26 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3942,13 +3942,9 @@ static const TypeInfo qio_channel_rdma_info = { .instance_finalize = qio_channel_rdma_finalize, .class_init = qio_channel_rdma_class_init, }; +TYPE_INFO(qio_channel_rdma_info) -static void qio_channel_rdma_register_types(void) -{ - type_register_static(&qio_channel_rdma_info); -} -type_init(qio_channel_rdma_register_types); static QEMUFile *qemu_fopen_rdma(RDMAContext *rdma, const char *mode) { diff --git a/net/can/can_core.c b/net/can/can_core.c index 90f4d8576a..9e7228cb9d 100644 --- a/net/can/can_core.c +++ b/net/can/can_core.c @@ -131,10 +131,6 @@ static const TypeInfo can_bus_info = { { } } }; +TYPE_INFO(can_bus_info) -static void can_bus_register_types(void) -{ - type_register_static(&can_bus_info); -} -type_init(can_bus_register_types); diff --git a/net/can/can_host.c b/net/can/can_host.c index be4547d913..8b57a40de6 100644 --- a/net/can/can_host.c +++ b/net/can/can_host.c @@ -104,10 +104,6 @@ static const TypeInfo can_host_info = { { } } }; +TYPE_INFO(can_host_info) -static void can_host_register_types(void) -{ - type_register_static(&can_host_info); -} -type_init(can_host_register_types); diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c index b7ef63ec0e..c083e92735 100644 --- a/net/can/can_socketcan.c +++ b/net/can/can_socketcan.c @@ -278,10 +278,6 @@ static const TypeInfo can_host_socketcan_info = { .instance_init = can_host_socketcan_instance_init, .class_init = can_host_socketcan_class_init, }; +TYPE_INFO(can_host_socketcan_info) -static void can_host_register_types(void) -{ - type_register_static(&can_host_socketcan_info); -} -type_init(can_host_register_types); diff --git a/net/colo-compare.c b/net/colo-compare.c index 2c20de1537..b6f56fc915 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -1495,10 +1495,6 @@ static const TypeInfo colo_compare_info = { { } } }; +TYPE_INFO(colo_compare_info) -static void register_types(void) -{ - type_register_static(&colo_compare_info); -} -type_init(register_types); diff --git a/net/dump.c b/net/dump.c index 11a737a4bc..ec9f20bea5 100644 --- a/net/dump.c +++ b/net/dump.c @@ -256,10 +256,6 @@ static const TypeInfo filter_dump_info = { .instance_finalize = filter_dump_instance_finalize, .instance_size = sizeof(NetFilterDumpState), }; +TYPE_INFO(filter_dump_info) -static void filter_dump_register_types(void) -{ - type_register_static(&filter_dump_info); -} -type_init(filter_dump_register_types); diff --git a/net/filter-buffer.c b/net/filter-buffer.c index dfa211794b..9a6b8132ea 100644 --- a/net/filter-buffer.c +++ b/net/filter-buffer.c @@ -197,10 +197,6 @@ static const TypeInfo filter_buffer_info = { .instance_init = filter_buffer_init, .instance_size = sizeof(FilterBufferState), }; +TYPE_INFO(filter_buffer_info) -static void register_types(void) -{ - type_register_static(&filter_buffer_info); -} -type_init(register_types); diff --git a/net/filter-mirror.c b/net/filter-mirror.c index e9379ce248..09cb97332d 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -438,6 +438,7 @@ static const TypeInfo filter_redirector_info = { .instance_finalize = filter_redirector_fini, .instance_size = sizeof(MirrorState), }; +TYPE_INFO(filter_redirector_info) static const TypeInfo filter_mirror_info = { .name = TYPE_FILTER_MIRROR, @@ -447,11 +448,6 @@ static const TypeInfo filter_mirror_info = { .instance_finalize = filter_mirror_fini, .instance_size = sizeof(MirrorState), }; +TYPE_INFO(filter_mirror_info) -static void register_types(void) -{ - type_register_static(&filter_mirror_info); - type_register_static(&filter_redirector_info); -} -type_init(register_types); diff --git a/net/filter-replay.c b/net/filter-replay.c index 9dda193928..9f95ee305b 100644 --- a/net/filter-replay.c +++ b/net/filter-replay.c @@ -82,10 +82,6 @@ static const TypeInfo filter_replay_info = { .instance_finalize = filter_replay_instance_finalize, .instance_size = sizeof(NetFilterReplayState), }; +TYPE_INFO(filter_replay_info) -static void filter_replay_register_types(void) -{ - type_register_static(&filter_replay_info); -} -type_init(filter_replay_register_types); diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index 1aaad101b6..891fa95264 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -433,10 +433,6 @@ static const TypeInfo colo_rewriter_info = { .instance_init = filter_rewriter_init, .instance_size = sizeof(RewriterState), }; +TYPE_INFO(colo_rewriter_info) -static void register_types(void) -{ - type_register_static(&colo_rewriter_info); -} -type_init(register_types); diff --git a/net/filter.c b/net/filter.c index eac8ba1e9c..8dd47bead0 100644 --- a/net/filter.c +++ b/net/filter.c @@ -368,10 +368,6 @@ static const TypeInfo netfilter_info = { { } } }; +TYPE_INFO(netfilter_info) -static void register_types(void) -{ - type_register_static(&netfilter_info); -} -type_init(register_types); diff --git a/qom/container.c b/qom/container.c index 455e8410c6..4c0f5fcce3 100644 --- a/qom/container.c +++ b/qom/container.c @@ -18,11 +18,8 @@ static const TypeInfo container_info = { .name = "container", .parent = TYPE_OBJECT, }; +TYPE_INFO(container_info) -static void container_register_types(void) -{ - type_register_static(&container_info); -} Object *container_get(Object *root, const char *path) { @@ -49,4 +46,3 @@ Object *container_get(Object *root, const char *path) } -type_init(container_register_types) diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c index 5acccfb4e3..466f11f4c8 100644 --- a/scsi/pr-manager-helper.c +++ b/scsi/pr-manager-helper.c @@ -320,10 +320,6 @@ static const TypeInfo pr_manager_helper_info = { .instance_finalize = pr_manager_helper_instance_finalize, .class_init = pr_manager_helper_class_init, }; +TYPE_INFO(pr_manager_helper_info) -static void pr_manager_helper_register_types(void) -{ - type_register_static(&pr_manager_helper_info); -} -type_init(pr_manager_helper_register_types); diff --git a/scsi/pr-manager.c b/scsi/pr-manager.c index 32b9287e68..f95f658b1c 100644 --- a/scsi/pr-manager.c +++ b/scsi/pr-manager.c @@ -83,6 +83,7 @@ static const TypeInfo pr_manager_info = { { } } }; +TYPE_INFO(pr_manager_info) PRManager *pr_manager_lookup(const char *id, Error **errp) { @@ -108,11 +109,6 @@ PRManager *pr_manager_lookup(const char *id, Error **errp) return pr_mgr; } -static void -pr_manager_register_types(void) -{ - type_register_static(&pr_manager_info); -} static int query_one_pr_manager(Object *object, void *opaque) { @@ -148,4 +144,3 @@ PRManagerInfoList *qmp_query_pr_managers(Error **errp) return head; } -type_init(pr_manager_register_types); diff --git a/softmmu/memory.c b/softmmu/memory.c index af25987518..e572a5ede2 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -3231,6 +3231,7 @@ static const TypeInfo memory_region_info = { .instance_init = memory_region_initfn, .instance_finalize = memory_region_finalize, }; +TYPE_INFO(memory_region_info) static const TypeInfo iommu_memory_region_info = { .parent = TYPE_MEMORY_REGION, @@ -3240,11 +3241,6 @@ static const TypeInfo iommu_memory_region_info = { .instance_init = iommu_memory_region_initfn, .abstract = true, }; +TYPE_INFO(iommu_memory_region_info) -static void memory_register_types(void) -{ - type_register_static(&memory_region_info); - type_register_static(&iommu_memory_region_info); -} -type_init(memory_register_types) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 111579554f..9b5f3ffcb1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2316,18 +2316,19 @@ static const TypeInfo arm_cpu_type_info = { .class_size = sizeof(ARMCPUClass), .class_init = arm_cpu_class_init, }; +TYPE_INFO(arm_cpu_type_info) static const TypeInfo idau_interface_type_info = { .name = TYPE_IDAU_INTERFACE, .parent = TYPE_INTERFACE, .class_size = sizeof(IDAUInterfaceClass), }; +TYPE_INFO(idau_interface_type_info) static void arm_cpu_register_types(void) { const size_t cpu_count = ARRAY_SIZE(arm_cpus); - type_register_static(&arm_cpu_type_info); #ifdef CONFIG_KVM type_register_static(&host_arm_cpu_type_info); @@ -2336,7 +2337,6 @@ static void arm_cpu_register_types(void) if (cpu_count) { size_t i; - type_register_static(&idau_interface_type_info); for (i = 0; i < cpu_count; ++i) { arm_cpu_register(&arm_cpus[i]); } diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index dd696183df..33a2fa6125 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -831,12 +831,12 @@ static const TypeInfo aarch64_cpu_type_info = { .class_size = sizeof(AArch64CPUClass), .class_init = aarch64_cpu_class_init, }; +TYPE_INFO(aarch64_cpu_type_info) static void aarch64_cpu_register_types(void) { size_t i; - type_register_static(&aarch64_cpu_type_info); for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) { aarch64_cpu_register(&aarch64_cpus[i]); diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 71b6aca45d..c04b9c814d 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -167,10 +167,6 @@ static const TypeInfo hppa_cpu_type_info = { .class_size = sizeof(HPPACPUClass), .class_init = hppa_cpu_class_init, }; +TYPE_INFO(hppa_cpu_type_info) -static void hppa_cpu_register_types(void) -{ - type_register_static(&hppa_cpu_type_info); -} -type_init(hppa_cpu_register_types) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 588f32e136..ce20b0dff0 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4335,6 +4335,7 @@ static const TypeInfo max_x86_cpu_type_info = { .instance_init = max_x86_cpu_initfn, .class_init = max_x86_cpu_class_init, }; +TYPE_INFO(max_x86_cpu_type_info) #if defined(CONFIG_KVM) || defined(CONFIG_HVF) static void host_x86_cpu_class_init(ObjectClass *oc, void *data) @@ -4358,6 +4359,7 @@ static const TypeInfo host_x86_cpu_type_info = { .parent = X86_CPU_TYPE_NAME("max"), .class_init = host_x86_cpu_class_init, }; +TYPE_INFO(host_x86_cpu_type_info) #endif @@ -7349,6 +7351,7 @@ static const TypeInfo x86_cpu_type_info = { .class_size = sizeof(X86CPUClass), .class_init = x86_cpu_common_class_init, }; +TYPE_INFO(x86_cpu_type_info) /* "base" CPU model, used by query-cpu-model-expansion */ @@ -7367,19 +7370,16 @@ static const TypeInfo x86_base_cpu_type_info = { .parent = TYPE_X86_CPU, .class_init = x86_cpu_base_class_init, }; +TYPE_INFO(x86_base_cpu_type_info) static void x86_cpu_register_types(void) { int i; - type_register_static(&x86_cpu_type_info); for (i = 0; i < ARRAY_SIZE(builtin_x86_defs); i++) { x86_register_cpudef_types(&builtin_x86_defs[i]); } - type_register_static(&max_x86_cpu_type_info); - type_register_static(&x86_base_cpu_type_info); #if defined(CONFIG_KVM) || defined(CONFIG_HVF) - type_register_static(&host_x86_cpu_type_info); #endif } diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c index c93bb23a44..377dfbf523 100644 --- a/target/i386/hax-all.c +++ b/target/i386/hax-all.c @@ -1141,10 +1141,6 @@ static const TypeInfo hax_accel_type = { .parent = TYPE_ACCEL, .class_init = hax_accel_class_init, }; +TYPE_INFO(hax_accel_type) -static void hax_type_init(void) -{ - type_register_static(&hax_accel_type); -} -type_init(hax_type_init); diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index d81f569aed..b82253e1d3 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -910,10 +910,6 @@ static const TypeInfo hvf_accel_type = { .parent = TYPE_ACCEL, .class_init = hvf_accel_class_init, }; +TYPE_INFO(hvf_accel_type) -static void hvf_type_init(void) -{ - type_register_static(&hvf_accel_type); -} -type_init(hvf_type_init); diff --git a/target/i386/sev.c b/target/i386/sev.c index c3ecf86704..404762b68f 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -332,6 +332,7 @@ static const TypeInfo sev_guest_info = { { } } }; +TYPE_INFO(sev_guest_info) static SevGuestState * lookup_sev_guest_info(const char *id) @@ -785,10 +786,4 @@ sev_encrypt_data(void *handle, uint8_t *ptr, uint64_t len) return 0; } -static void -sev_register_types(void) -{ - type_register_static(&sev_guest_info); -} -type_init(sev_register_types); diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index c78baac6df..64d8903e99 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -1608,11 +1608,8 @@ static const TypeInfo whpx_accel_type = { .parent = TYPE_ACCEL, .class_init = whpx_accel_class_init, }; +TYPE_INFO(whpx_accel_type) -static void whpx_type_init(void) -{ - type_register_static(&whpx_accel_type); -} bool init_whp_dispatch(void) { @@ -1645,4 +1642,3 @@ error: return false; } -type_init(whpx_type_init); diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 51e5c85b10..4e62a7cbcd 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -343,10 +343,6 @@ static const TypeInfo mb_cpu_type_info = { .class_size = sizeof(MicroBlazeCPUClass), .class_init = mb_cpu_class_init, }; +TYPE_INFO(mb_cpu_type_info) -static void mb_cpu_register_types(void) -{ - type_register_static(&mb_cpu_type_info); -} -type_init(mb_cpu_register_types) diff --git a/target/mips/cpu.c b/target/mips/cpu.c index e86cd06548..b4482a8594 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -225,6 +225,7 @@ static const TypeInfo mips_cpu_type_info = { .class_size = sizeof(MIPSCPUClass), .class_init = mips_cpu_class_init, }; +TYPE_INFO(mips_cpu_type_info) static void mips_cpu_cpudef_class_init(ObjectClass *oc, void *data) { @@ -250,7 +251,6 @@ static void mips_cpu_register_types(void) { int i; - type_register_static(&mips_cpu_type_info); for (i = 0; i < mips_defs_number; i++) { mips_register_cpudef_type(&mips_defs[i]); } diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index 8f7011fcb9..2b9385ee84 100644 --- a/target/nios2/cpu.c +++ b/target/nios2/cpu.c @@ -216,10 +216,6 @@ static const TypeInfo nios2_cpu_type_info = { .class_size = sizeof(Nios2CPUClass), .class_init = nios2_cpu_class_init, }; +TYPE_INFO(nios2_cpu_type_info) -static void nios2_cpu_register_types(void) -{ - type_register_static(&nios2_cpu_type_info); -} -type_init(nios2_cpu_register_types) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c index 7e66822b5d..1cd3a7b6f8 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -10936,6 +10936,7 @@ static const TypeInfo ppc_cpu_type_info = { .class_size = sizeof(PowerPCCPUClass), .class_init = ppc_cpu_class_init, }; +TYPE_INFO(ppc_cpu_type_info) #ifndef CONFIG_USER_ONLY static const TypeInfo ppc_vhyp_type_info = { @@ -10943,13 +10944,12 @@ static const TypeInfo ppc_vhyp_type_info = { .parent = TYPE_INTERFACE, .class_size = sizeof(PPCVirtualHypervisorClass), }; +TYPE_INFO(ppc_vhyp_type_info) #endif static void ppc_cpu_register_types(void) { - type_register_static(&ppc_cpu_type_info); #ifndef CONFIG_USER_ONLY - type_register_static(&ppc_vhyp_type_info); #endif } diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 219e05397b..35672a9670 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -210,16 +210,12 @@ static const TypeInfo rx_cpu_info = { .class_size = sizeof(RXCPUClass), .class_init = rx_cpu_class_init, }; +TYPE_INFO(rx_cpu_info) static const TypeInfo rx62n_rx_cpu_info = { .name = TYPE_RX62N_CPU, .parent = TYPE_RX_CPU, }; +TYPE_INFO(rx62n_rx_cpu_info) -static void rx_cpu_register_types(void) -{ - type_register_static(&rx_cpu_info); - type_register_static(&rx62n_rx_cpu_info); -} -type_init(rx_cpu_register_types) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 08eb674d22..bb48c652fa 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -523,10 +523,6 @@ static const TypeInfo s390_cpu_type_info = { .class_size = sizeof(S390CPUClass), .class_init = s390_cpu_class_init, }; +TYPE_INFO(s390_cpu_type_info) -static void s390_cpu_register_types(void) -{ - type_register_static(&s390_cpu_type_info); -} -type_init(s390_cpu_register_types) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index c2af226174..46aaad1f7e 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -1305,6 +1305,7 @@ static const TypeInfo qemu_s390_cpu_type_info = { .instance_finalize = s390_cpu_model_finalize, .class_init = s390_qemu_cpu_model_class_init, }; +TYPE_INFO(qemu_s390_cpu_type_info) static const TypeInfo max_s390_cpu_type_info = { .name = S390_CPU_TYPE_NAME("max"), @@ -1313,6 +1314,7 @@ static const TypeInfo max_s390_cpu_type_info = { .instance_finalize = s390_cpu_model_finalize, .class_init = s390_max_cpu_model_class_init, }; +TYPE_INFO(max_s390_cpu_type_info) #ifdef CONFIG_KVM static const TypeInfo host_s390_cpu_type_info = { @@ -1320,6 +1322,7 @@ static const TypeInfo host_s390_cpu_type_info = { .parent = S390_CPU_TYPE_NAME("max"), .class_init = s390_host_cpu_model_class_init, }; +TYPE_INFO(host_s390_cpu_type_info) #endif static void init_ignored_base_feat(void) @@ -1395,10 +1398,7 @@ static void register_types(void) g_free(name); } - type_register_static(&qemu_s390_cpu_type_info); - type_register_static(&max_s390_cpu_type_info); #ifdef CONFIG_KVM - type_register_static(&host_s390_cpu_type_info); #endif } diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index cf21efd85f..aed0cafb13 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -897,6 +897,7 @@ static const TypeInfo sparc_cpu_type_info = { .class_size = sizeof(SPARCCPUClass), .class_init = sparc_cpu_class_init, }; +TYPE_INFO(sparc_cpu_type_info) static void sparc_cpu_cpudef_class_init(ObjectClass *oc, void *data) { @@ -922,7 +923,6 @@ static void sparc_cpu_register_types(void) { int i; - type_register_static(&sparc_cpu_type_info); for (i = 0; i < ARRAY_SIZE(sparc_defs); i++) { sparc_register_cpudef_type(&sparc_defs[i]); } diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c index 1fee87c094..93070229de 100644 --- a/target/tilegx/cpu.c +++ b/target/tilegx/cpu.c @@ -164,10 +164,6 @@ static const TypeInfo tilegx_cpu_type_info = { .class_size = sizeof(TileGXCPUClass), .class_init = tilegx_cpu_class_init, }; +TYPE_INFO(tilegx_cpu_type_info) -static void tilegx_cpu_register_types(void) -{ - type_register_static(&tilegx_cpu_type_info); -} -type_init(tilegx_cpu_register_types) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 82c2ee0679..666b8050f7 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -216,10 +216,6 @@ static const TypeInfo xtensa_cpu_type_info = { .class_size = sizeof(XtensaCPUClass), .class_init = xtensa_cpu_class_init, }; +TYPE_INFO(xtensa_cpu_type_info) -static void xtensa_cpu_register_types(void) -{ - type_register_static(&xtensa_cpu_type_info); -} -type_init(xtensa_cpu_register_types) diff --git a/ui/console.c b/ui/console.c index 0579be792f..ae54bf6c1a 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2388,6 +2388,7 @@ static const TypeInfo qemu_console_info = { .instance_size = sizeof(QemuConsole), .class_size = sizeof(QemuConsoleClass), }; +TYPE_INFO(qemu_console_info) static void char_vc_class_init(ObjectClass *oc, void *data) { @@ -2414,9 +2415,4 @@ void qemu_console_early_init(void) } } -static void register_types(void) -{ - type_register_static(&qemu_console_info); -} -type_init(register_types); diff --git a/ui/input-barrier.c b/ui/input-barrier.c index 1cdf0c5f82..2082f5dd1e 100644 --- a/ui/input-barrier.c +++ b/ui/input-barrier.c @@ -741,10 +741,6 @@ static const TypeInfo input_barrier_info = { { } } }; +TYPE_INFO(input_barrier_info) -static void register_types(void) -{ - type_register_static(&input_barrier_info); -} -type_init(register_types); diff --git a/ui/input-linux.c b/ui/input-linux.c index 4925ce1af1..3709800898 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -532,10 +532,6 @@ static const TypeInfo input_linux_info = { { } } }; +TYPE_INFO(input_linux_info) -static void register_types(void) -{ - type_register_static(&input_linux_info); -} -type_init(register_types); From patchwork Thu Aug 13 22:26:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 275473 Return-Path: Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94FACC433DF for ; Thu, 13 Aug 2020 22:53:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA28020771 for ; Thu, 13 Aug 2020 22:53:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="g9D5TjGb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA28020771 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6M5t-0002mH-Pj for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:53:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Lh7-0006YI-56 for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:33 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32895 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgx-0002wh-Ue for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vYjIzPTEqunp5RE71HjyASTpelndbgaFEsHcxJVikOI=; b=g9D5TjGbw0ONvJ/AhoBqbm+CC3roU+XmJLoP23/b++lUE+honvPcVp15wCE53jSg4TVsP/ 6ul2gphcH6kSa3vInvt1gNQp7Cs6Apa5atxljWjrW7XwMeSTcF9hj7AGSXcyyhGrMaGSIf Tw7ledmVP21Z25/nfed9JM0t9ogcQbM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-KJc4murgPKCQ8msA25Clpg-1; Thu, 13 Aug 2020 18:27:16 -0400 X-MC-Unique: KJc4murgPKCQ8msA25Clpg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5414807326 for ; Thu, 13 Aug 2020 22:27:15 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id C55085C1A3; Thu, 13 Aug 2020 22:27:14 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 36/41] [automated] Use DECLARE_*CHECKER* macros Date: Thu, 13 Aug 2020 18:26:20 -0400 Message-Id: <20200813222625.243136-37-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" $ ./scripts/codeconverter/converter.py -i \ --pattern=TypeCheckMacro $(git grep -l '' -- '*.[ch]') Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. BerrangĂ© --- chardev/chardev-internal.h | 3 +- hw/9pfs/virtio-9p.h | 4 +- hw/audio/intel-hda.h | 11 ++-- hw/avr/atmega.h | 3 +- hw/block/nvme.h | 4 +- hw/display/ati_int.h | 3 +- hw/display/qxl.h | 3 +- hw/display/virtio-vga.h | 8 +-- hw/i386/amd_iommu.h | 4 +- hw/misc/tmp105.h | 3 +- hw/net/fsl_etsec/etsec.h | 4 +- hw/net/tulip.h | 3 +- hw/net/vmxnet3_defs.h | 3 +- hw/ppc/e500-ccsr.h | 3 +- hw/ppc/e500.h | 8 +-- hw/ppc/mac.h | 8 +-- hw/rdma/vmw/pvrdma.h | 3 +- hw/s390x/ccw-device.h | 7 +-- hw/s390x/ipl.h | 3 +- hw/s390x/s390-pci-bus.h | 16 +++--- hw/s390x/virtio-ccw.h | 68 +++++++++++------------- hw/usb/ccid.h | 8 +-- hw/usb/hcd-dwc2.h | 8 +-- hw/usb/hcd-ehci.h | 15 +++--- hw/usb/hcd-ohci.h | 3 +- hw/usb/hcd-xhci.h | 4 +- hw/virtio/virtio-mem-pci.h | 4 +- hw/virtio/virtio-pci.h | 16 ++---- hw/virtio/virtio-pmem-pci.h | 4 +- hw/xen/xen_pt.h | 4 +- include/authz/base.h | 11 +--- include/authz/list.h | 11 +--- include/authz/listfile.h | 11 +--- include/authz/pamacct.h | 11 +--- include/authz/simple.h | 11 +--- include/block/throttle-groups.h | 3 +- include/chardev/char-fd.h | 3 +- include/chardev/char-win.h | 3 +- include/chardev/spice.h | 3 +- include/crypto/secret.h | 4 +- include/crypto/secret_common.h | 10 +--- include/crypto/secret_keyring.h | 11 +--- include/crypto/tls-cipher-suites.h | 4 +- include/crypto/tlscreds.h | 4 +- include/crypto/tlscredsanon.h | 4 +- include/crypto/tlscredspsk.h | 4 +- include/crypto/tlscredsx509.h | 4 +- include/hw/acpi/acpi_dev_interface.h | 8 +-- include/hw/acpi/generic_event_device.h | 4 +- include/hw/acpi/vmgenid.h | 3 +- include/hw/adc/stm32f2xx_adc.h | 4 +- include/hw/arm/allwinner-a10.h | 3 +- include/hw/arm/allwinner-h3.h | 3 +- include/hw/arm/armv7m.h | 6 ++- include/hw/arm/aspeed.h | 8 +-- include/hw/arm/aspeed_soc.h | 7 +-- include/hw/arm/bcm2835_peripherals.h | 4 +- include/hw/arm/bcm2836.h | 7 +-- include/hw/arm/digic.h | 3 +- include/hw/arm/exynos4210.h | 4 +- include/hw/arm/fsl-imx25.h | 3 +- include/hw/arm/fsl-imx31.h | 3 +- include/hw/arm/fsl-imx6.h | 3 +- include/hw/arm/fsl-imx6ul.h | 3 +- include/hw/arm/fsl-imx7.h | 3 +- include/hw/arm/linux-boot-if.h | 6 +-- include/hw/arm/msf2-soc.h | 3 +- include/hw/arm/nrf51_soc.h | 4 +- include/hw/arm/omap.h | 7 +-- include/hw/arm/smmu-common.h | 7 +-- include/hw/arm/smmuv3.h | 7 +-- include/hw/arm/stm32f205_soc.h | 4 +- include/hw/arm/stm32f405_soc.h | 4 +- include/hw/arm/virt.h | 8 +-- include/hw/arm/xlnx-versal.h | 3 +- include/hw/arm/xlnx-zynqmp.h | 4 +- include/hw/block/flash.h | 8 +-- include/hw/block/swim.h | 6 ++- include/hw/char/avr_usart.h | 4 +- include/hw/char/bcm2835_aux.h | 3 +- include/hw/char/cadence_uart.h | 4 +- include/hw/char/cmsdk-apb-uart.h | 4 +- include/hw/char/digic-uart.h | 4 +- include/hw/char/escc.h | 3 +- include/hw/char/ibex_uart.h | 4 +- include/hw/char/imx_serial.h | 3 +- include/hw/char/nrf51_uart.h | 3 +- include/hw/char/pl011.h | 3 +- include/hw/char/renesas_sci.h | 3 +- include/hw/char/serial.h | 9 ++-- include/hw/char/stm32f2xx_usart.h | 4 +- include/hw/clock.h | 3 +- include/hw/core/cpu.h | 4 +- include/hw/core/generic-loader.h | 4 +- include/hw/core/split-irq.h | 3 +- include/hw/cpu/a15mpcore.h | 4 +- include/hw/cpu/a9mpcore.h | 4 +- include/hw/cpu/arm11mpcore.h | 4 +- include/hw/cpu/cluster.h | 4 +- include/hw/cpu/core.h | 4 +- include/hw/display/bcm2835_fb.h | 3 +- include/hw/display/dpcd.h | 3 +- include/hw/display/i2c-ddc.h | 3 +- include/hw/display/macfb.h | 4 +- include/hw/display/xlnx_dp.h | 3 +- include/hw/dma/bcm2835_dma.h | 4 +- include/hw/dma/pl080.h | 3 +- include/hw/dma/xlnx-zdma.h | 4 +- include/hw/dma/xlnx-zynq-devcfg.h | 4 +- include/hw/dma/xlnx_dpdma.h | 3 +- include/hw/fw-path-provider.h | 6 +-- include/hw/gpio/aspeed_gpio.h | 7 +-- include/hw/gpio/bcm2835_gpio.h | 4 +- include/hw/gpio/imx_gpio.h | 3 +- include/hw/gpio/nrf51_gpio.h | 3 +- include/hw/hotplug.h | 6 +-- include/hw/hyperv/vmbus-bridge.h | 3 +- include/hw/hyperv/vmbus.h | 8 +-- include/hw/i2c/arm_sbcon_i2c.h | 4 +- include/hw/i2c/aspeed_i2c.h | 8 +-- include/hw/i2c/i2c.h | 8 +-- include/hw/i2c/imx_i2c.h | 3 +- include/hw/i2c/microbit_i2c.h | 4 +- include/hw/i2c/ppc4xx_i2c.h | 3 +- include/hw/i2c/smbus_slave.h | 8 +-- include/hw/i386/apic_internal.h | 8 +-- include/hw/i386/ich9.h | 4 +- include/hw/i386/intel_iommu.h | 4 +- include/hw/i386/ioapic_internal.h | 8 +-- include/hw/i386/microvm.h | 8 +-- include/hw/i386/x86.h | 8 +-- include/hw/ide/internal.h | 11 ++-- include/hw/ide/pci.h | 3 +- include/hw/input/adb.h | 10 ++-- include/hw/intc/allwinner-a10-pic.h | 3 +- include/hw/intc/arm_gic_common.h | 8 +-- include/hw/intc/arm_gicv3_common.h | 8 +-- include/hw/intc/arm_gicv3_its_common.h | 8 +-- include/hw/intc/armv7m_nvic.h | 4 +- include/hw/intc/aspeed_vic.h | 3 +- include/hw/intc/bcm2835_ic.h | 3 +- include/hw/intc/bcm2836_control.h | 4 +- include/hw/intc/heathrow_pic.h | 3 +- include/hw/intc/ibex_plic.h | 4 +- include/hw/intc/imx_avic.h | 3 +- include/hw/intc/imx_gpcv2.h | 3 +- include/hw/intc/intc.h | 6 +-- include/hw/intc/mips_gic.h | 3 +- include/hw/intc/realview_gic.h | 4 +- include/hw/intc/rx_icu.h | 3 +- include/hw/intc/xlnx-pmu-iomod-intc.h | 4 +- include/hw/intc/xlnx-zynqmp-ipi.h | 4 +- include/hw/ipack/ipack.h | 11 ++-- include/hw/ipmi/ipmi.h | 18 +++---- include/hw/isa/i8259_internal.h | 8 +-- include/hw/isa/isa.h | 6 +-- include/hw/isa/pc87312.h | 3 +- include/hw/isa/superio.h | 8 +-- include/hw/m68k/mcf_fec.h | 3 +- include/hw/mem/memory-device.h | 6 +-- include/hw/mem/nvdimm.h | 6 +-- include/hw/mem/pc-dimm.h | 8 +-- include/hw/mips/cps.h | 3 +- include/hw/misc/a9scu.h | 3 +- include/hw/misc/allwinner-cpucfg.h | 4 +- include/hw/misc/allwinner-h3-ccu.h | 4 +- include/hw/misc/allwinner-h3-dramc.h | 4 +- include/hw/misc/allwinner-h3-sysctrl.h | 4 +- include/hw/misc/allwinner-sid.h | 4 +- include/hw/misc/arm11scu.h | 3 +- include/hw/misc/armsse-cpuid.h | 3 +- include/hw/misc/armsse-mhu.h | 3 +- include/hw/misc/aspeed_scu.h | 7 +-- include/hw/misc/aspeed_sdmc.h | 7 +-- include/hw/misc/aspeed_xdma.h | 3 +- include/hw/misc/auxbus.h | 7 +-- include/hw/misc/avr_power.h | 3 +- include/hw/misc/bcm2835_mbox.h | 4 +- include/hw/misc/bcm2835_mphi.h | 4 +- include/hw/misc/bcm2835_property.h | 4 +- include/hw/misc/bcm2835_rng.h | 4 +- include/hw/misc/bcm2835_thermal.h | 4 +- include/hw/misc/grlib_ahb_apb_pnp.h | 8 +-- include/hw/misc/imx25_ccm.h | 3 +- include/hw/misc/imx31_ccm.h | 3 +- include/hw/misc/imx6_ccm.h | 3 +- include/hw/misc/imx6_src.h | 3 +- include/hw/misc/imx6ul_ccm.h | 3 +- include/hw/misc/imx7_ccm.h | 6 ++- include/hw/misc/imx7_gpr.h | 3 +- include/hw/misc/imx7_snvs.h | 3 +- include/hw/misc/imx_rngc.h | 3 +- include/hw/misc/iotkit-secctl.h | 3 +- include/hw/misc/iotkit-sysctl.h | 4 +- include/hw/misc/iotkit-sysinfo.h | 4 +- include/hw/misc/mac_via.h | 11 ++-- include/hw/misc/macio/cuda.h | 7 +-- include/hw/misc/macio/gpio.h | 3 +- include/hw/misc/macio/macio.h | 17 +++--- include/hw/misc/macio/pmu.h | 7 +-- include/hw/misc/max111x.h | 4 +- include/hw/misc/mips_cmgcr.h | 3 +- include/hw/misc/mips_cpc.h | 3 +- include/hw/misc/mips_itu.h | 3 +- include/hw/misc/mps2-fpgaio.h | 3 +- include/hw/misc/mps2-scc.h | 3 +- include/hw/misc/msf2-sysreg.h | 3 +- include/hw/misc/nrf51_rng.h | 3 +- include/hw/misc/pca9552.h | 3 +- include/hw/misc/stm32f2xx_syscfg.h | 4 +- include/hw/misc/stm32f4xx_exti.h | 4 +- include/hw/misc/stm32f4xx_syscfg.h | 4 +- include/hw/misc/tz-mpc.h | 3 +- include/hw/misc/tz-msc.h | 3 +- include/hw/misc/tz-ppc.h | 3 +- include/hw/misc/unimp.h | 4 +- include/hw/misc/vmcoreinfo.h | 3 +- include/hw/misc/zynq-xadc.h | 4 +- include/hw/net/allwinner-sun8i-emac.h | 4 +- include/hw/net/allwinner_emac.h | 3 +- include/hw/net/cadence_gem.h | 3 +- include/hw/net/ftgmac100.h | 6 ++- include/hw/net/imx_fec.h | 3 +- include/hw/net/lance.h | 4 +- include/hw/net/lasi_82596.h | 4 +- include/hw/net/msf2-emac.h | 4 +- include/hw/nmi.h | 6 +-- include/hw/nubus/mac-nubus-bridge.h | 4 +- include/hw/nubus/nubus.h | 7 +-- include/hw/nvram/fw_cfg.h | 6 +-- include/hw/nvram/nrf51_nvm.h | 3 +- include/hw/or-irq.h | 3 +- include/hw/pci-bridge/simba.h | 4 +- include/hw/pci-host/designware.h | 8 +-- include/hw/pci-host/gpex.h | 8 +-- include/hw/pci-host/i440fx.h | 4 +- include/hw/pci-host/pnv_phb3.h | 9 ++-- include/hw/pci-host/pnv_phb4.h | 15 +++--- include/hw/pci-host/q35.h | 8 +-- include/hw/pci-host/sabre.h | 8 +-- include/hw/pci-host/spapr.h | 4 +- include/hw/pci-host/uninorth.h | 20 +++---- include/hw/pci-host/xilinx-pcie.h | 8 +-- include/hw/pci/pcie_port.h | 6 +-- include/hw/pcmcia.h | 8 +-- include/hw/platform-bus.h | 4 +- include/hw/ppc/mac_dbdma.h | 3 +- include/hw/ppc/openpic.h | 3 +- include/hw/ppc/pnv.h | 44 +++++++-------- include/hw/ppc/pnv_core.h | 12 ++--- include/hw/ppc/pnv_homer.h | 13 +++-- include/hw/ppc/pnv_lpc.h | 17 +++--- include/hw/ppc/pnv_occ.h | 13 +++-- include/hw/ppc/pnv_pnor.h | 3 +- include/hw/ppc/pnv_psi.h | 16 +++--- include/hw/ppc/pnv_xive.h | 7 +-- include/hw/ppc/pnv_xscom.h | 5 +- include/hw/ppc/spapr.h | 8 +-- include/hw/ppc/spapr_cpu_core.h | 8 +-- include/hw/ppc/spapr_drc.h | 67 ++++++----------------- include/hw/ppc/spapr_irq.h | 6 +-- include/hw/ppc/spapr_tpm_proxy.h | 4 +- include/hw/ppc/spapr_vio.h | 11 ++-- include/hw/ppc/spapr_xive.h | 7 +-- include/hw/ppc/xics.h | 23 +++----- include/hw/ppc/xive.h | 36 +++++-------- include/hw/register.h | 3 +- include/hw/resettable.h | 6 +-- include/hw/riscv/opentitan.h | 4 +- include/hw/riscv/riscv_hart.h | 4 +- include/hw/riscv/sifive_clint.h | 4 +- include/hw/riscv/sifive_e.h | 8 +-- include/hw/riscv/sifive_e_prci.h | 4 +- include/hw/riscv/sifive_gpio.h | 3 +- include/hw/riscv/sifive_plic.h | 4 +- include/hw/riscv/sifive_test.h | 4 +- include/hw/riscv/sifive_u.h | 8 +-- include/hw/riscv/sifive_u_otp.h | 4 +- include/hw/riscv/sifive_u_prci.h | 4 +- include/hw/riscv/sifive_uart.h | 4 +- include/hw/riscv/virt.h | 4 +- include/hw/rtc/allwinner-rtc.h | 8 +-- include/hw/rtc/aspeed_rtc.h | 3 +- include/hw/rtc/goldfish_rtc.h | 4 +- include/hw/rtc/m48t59.h | 6 +-- include/hw/rtc/mc146818rtc.h | 3 +- include/hw/rtc/pl031.h | 3 +- include/hw/rtc/xlnx-zynqmp-rtc.h | 4 +- include/hw/rx/rx62n.h | 3 +- include/hw/s390x/3270-ccw.h | 8 +-- include/hw/s390x/ap-device.h | 4 +- include/hw/s390x/css-bridge.h | 8 +-- include/hw/s390x/event-facility.h | 8 +-- include/hw/s390x/s390-ccw.h | 8 +-- include/hw/s390x/s390_flic.h | 16 +++--- include/hw/s390x/sclp.h | 5 +- include/hw/s390x/storage-attributes.h | 16 +++--- include/hw/s390x/storage-keys.h | 12 ++--- include/hw/s390x/tod.h | 7 +-- include/hw/s390x/vfio-ccw.h | 4 +- include/hw/scsi/esp.h | 3 +- include/hw/scsi/scsi.h | 11 ++-- include/hw/sd/allwinner-sdhost.h | 8 +-- include/hw/sd/aspeed_sdhci.h | 4 +- include/hw/sd/bcm2835_sdhost.h | 4 +- include/hw/sd/sd.h | 12 ++--- include/hw/sd/sdhci.h | 7 +-- include/hw/sparc/sparc32_dma.h | 16 +++--- include/hw/sparc/sun4m_iommu.h | 3 +- include/hw/sparc/sun4u_iommu.h | 3 +- include/hw/ssi/aspeed_smc.h | 7 +-- include/hw/ssi/imx_spi.h | 3 +- include/hw/ssi/mss-spi.h | 3 +- include/hw/ssi/pl022.h | 3 +- include/hw/ssi/ssi.h | 8 +-- include/hw/ssi/stm32f2xx_spi.h | 4 +- include/hw/ssi/xilinx_spips.h | 20 +++---- include/hw/stream.h | 6 +-- include/hw/sysbus.h | 8 +-- include/hw/timer/a9gtimer.h | 3 +- include/hw/timer/allwinner-a10-pit.h | 3 +- include/hw/timer/arm_mptimer.h | 4 +- include/hw/timer/armv7m_systick.h | 3 +- include/hw/timer/aspeed_timer.h | 8 +-- include/hw/timer/avr_timer16.h | 4 +- include/hw/timer/bcm2835_systmr.h | 4 +- include/hw/timer/cmsdk-apb-dualtimer.h | 4 +- include/hw/timer/cmsdk-apb-timer.h | 4 +- include/hw/timer/digic-timer.h | 3 +- include/hw/timer/i8254.h | 8 +-- include/hw/timer/imx_epit.h | 3 +- include/hw/timer/imx_gpt.h | 3 +- include/hw/timer/mss-timer.h | 4 +- include/hw/timer/nrf51_timer.h | 3 +- include/hw/timer/renesas_cmt.h | 3 +- include/hw/timer/renesas_tmr.h | 3 +- include/hw/timer/stm32f2xx_timer.h | 4 +- include/hw/usb.h | 11 ++-- include/hw/usb/chipidea.h | 3 +- include/hw/usb/imx-usb-phy.h | 3 +- include/hw/vfio/vfio-amd-xgbe.h | 10 +--- include/hw/vfio/vfio-calxeda-xgmac.h | 10 +--- include/hw/vfio/vfio-platform.h | 8 +-- include/hw/virtio/vhost-scsi-common.h | 4 +- include/hw/virtio/vhost-scsi.h | 4 +- include/hw/virtio/vhost-user-blk.h | 4 +- include/hw/virtio/vhost-user-fs.h | 4 +- include/hw/virtio/vhost-user-scsi.h | 4 +- include/hw/virtio/vhost-user-vsock.h | 4 +- include/hw/virtio/vhost-vsock-common.h | 4 +- include/hw/virtio/vhost-vsock.h | 4 +- include/hw/virtio/virtio-balloon.h | 4 +- include/hw/virtio/virtio-blk.h | 4 +- include/hw/virtio/virtio-bus.h | 7 +-- include/hw/virtio/virtio-crypto.h | 4 +- include/hw/virtio/virtio-gpu-pci.h | 4 +- include/hw/virtio/virtio-gpu.h | 12 ++--- include/hw/virtio/virtio-input.h | 20 +++---- include/hw/virtio/virtio-iommu.h | 4 +- include/hw/virtio/virtio-mem.h | 8 +-- include/hw/virtio/virtio-mmio.h | 4 +- include/hw/virtio/virtio-net.h | 4 +- include/hw/virtio/virtio-pmem.h | 8 +-- include/hw/virtio/virtio-rng.h | 4 +- include/hw/virtio/virtio-scsi.h | 8 +-- include/hw/virtio/virtio-serial.h | 12 ++--- include/hw/vmstate-if.h | 6 +-- include/hw/watchdog/cmsdk-apb-watchdog.h | 4 +- include/hw/watchdog/wdt_aspeed.h | 8 +-- include/hw/watchdog/wdt_diag288.h | 8 +-- include/hw/watchdog/wdt_imx2.h | 3 +- include/hw/xen/xen-block.h | 16 +++--- include/hw/xen/xen-bus.h | 16 ++---- include/io/channel-buffer.h | 4 +- include/io/channel-command.h | 4 +- include/io/channel-file.h | 4 +- include/io/channel-socket.h | 4 +- include/io/channel-tls.h | 4 +- include/io/channel-websock.h | 4 +- include/io/channel.h | 8 +-- include/io/dns-resolver.h | 8 +-- include/io/net-listener.h | 8 +-- include/net/can_emu.h | 4 +- include/net/can_host.h | 8 +-- include/qom/object_interfaces.h | 8 +-- include/scsi/pr-manager.h | 8 +-- include/sysemu/accel.h | 8 +-- include/sysemu/cryptodev.h | 11 +--- include/sysemu/hostmem.h | 8 +-- include/sysemu/hvf.h | 4 +- include/sysemu/iothread.h | 4 +- include/sysemu/rng-random.h | 3 +- include/sysemu/rng.h | 8 +-- include/sysemu/tpm.h | 6 +-- include/sysemu/tpm_backend.h | 8 +-- include/sysemu/vhost-user-backend.h | 8 +-- target/alpha/cpu-qom.h | 8 +-- target/arm/cpu-qom.h | 8 +-- target/arm/idau.h | 6 +-- target/avr/cpu-qom.h | 8 +-- target/cris/cpu-qom.h | 8 +-- target/hppa/cpu-qom.h | 8 +-- target/i386/cpu-qom.h | 8 +-- target/lm32/cpu-qom.h | 8 +-- target/m68k/cpu-qom.h | 8 +-- target/microblaze/cpu-qom.h | 8 +-- target/mips/cpu-qom.h | 8 +-- target/moxie/cpu.h | 8 +-- target/nios2/cpu.h | 8 +-- target/openrisc/cpu.h | 8 +-- target/ppc/cpu-qom.h | 8 +-- target/ppc/cpu.h | 10 +--- target/riscv/cpu.h | 8 +-- target/s390x/cpu-qom.h | 8 +-- target/sh4/cpu-qom.h | 8 +-- target/sparc/cpu-qom.h | 8 +-- target/tilegx/cpu.h | 8 +-- target/tricore/cpu-qom.h | 8 +-- target/unicore32/cpu-qom.h | 8 +-- target/xtensa/cpu-qom.h | 8 +-- accel/tcg/tcg-all.c | 4 +- backends/cryptodev-builtin.c | 5 +- backends/cryptodev-vhost-user.c | 5 +- backends/dbus-vmstate.c | 8 +-- backends/hostmem-file.c | 4 +- backends/hostmem-memfd.c | 4 +- backends/rng-builtin.c | 3 +- backends/rng-egd.c | 3 +- backends/tpm/tpm_emulator.c | 4 +- backends/tpm/tpm_passthrough.c | 4 +- chardev/baum.c | 3 +- chardev/char-parallel.c | 6 +-- chardev/char-pty.c | 3 +- chardev/char-ringbuf.c | 4 +- chardev/char-socket.c | 4 +- chardev/char-udp.c | 3 +- chardev/char-win-stdio.c | 4 +- chardev/msmouse.c | 4 +- chardev/testdev.c | 4 +- chardev/wctablet.c | 4 +- hw/acpi/piix4.c | 4 +- hw/alpha/typhoon.c | 4 +- hw/arm/collie.c | 4 +- hw/arm/highbank.c | 4 +- hw/arm/integratorcp.c | 12 ++--- hw/arm/microbit.c | 4 +- hw/arm/mps2-tz.c | 8 +-- hw/arm/mps2.c | 8 +-- hw/arm/musca.c | 8 +-- hw/arm/musicpal.c | 32 +++++------ hw/arm/palm.c | 4 +- hw/arm/pxa2xx.c | 12 ++--- hw/arm/pxa2xx_gpio.c | 4 +- hw/arm/pxa2xx_pic.c | 4 +- hw/arm/raspi.c | 8 +-- hw/arm/sbsa-ref.c | 4 +- hw/arm/spitz.c | 25 +++++---- hw/arm/stellaris.c | 12 ++--- hw/arm/strongarm.c | 24 ++++----- hw/arm/tosa.c | 7 +-- hw/arm/versatilepb.c | 4 +- hw/arm/vexpress.c | 8 +-- hw/arm/xilinx_zynq.c | 4 +- hw/arm/xlnx-versal-virt.c | 4 +- hw/arm/xlnx-zcu102.c | 4 +- hw/arm/z2.c | 6 ++- hw/audio/ac97.c | 4 +- hw/audio/adlib.c | 3 +- hw/audio/cs4231.c | 4 +- hw/audio/cs4231a.c | 3 +- hw/audio/es1370.c | 4 +- hw/audio/gus.c | 3 +- hw/audio/hda-codec.c | 3 +- hw/audio/intel-hda.c | 4 +- hw/audio/marvell_88w8618.c | 4 +- hw/audio/milkymist-ac97.c | 4 +- hw/audio/pcspk.c | 3 +- hw/audio/pl041.c | 3 +- hw/audio/sb16.c | 3 +- hw/audio/wm8750.c | 3 +- hw/avr/arduino.c | 8 +-- hw/avr/atmega.c | 6 +-- hw/block/fdc.c | 13 +++-- hw/block/m25p80.c | 8 +-- hw/block/nand.c | 4 +- hw/block/onenand.c | 3 +- hw/char/debugcon.c | 4 +- hw/char/etraxfs_ser.c | 4 +- hw/char/exynos4210_uart.c | 4 +- hw/char/grlib_apbuart.c | 4 +- hw/char/ipoctal232.c | 4 +- hw/char/lm32_juart.c | 3 +- hw/char/lm32_uart.c | 3 +- hw/char/mcf_uart.c | 3 +- hw/char/milkymist-uart.c | 4 +- hw/char/parallel.c | 4 +- hw/char/sclpconsole-lm.c | 4 +- hw/char/sclpconsole.c | 4 +- hw/char/serial-isa.c | 3 +- hw/char/serial-pci.c | 3 +- hw/char/spapr_vty.c | 4 +- hw/char/terminal3270.c | 4 +- hw/char/virtio-console.c | 4 +- hw/char/xilinx_uartlite.c | 4 +- hw/cpu/realview_mpcore.c | 4 +- hw/display/ads7846.c | 3 +- hw/display/artist.c | 3 +- hw/display/bochs-display.c | 4 +- hw/display/cg3.c | 3 +- hw/display/cirrus_vga.c | 4 +- hw/display/cirrus_vga_isa.c | 4 +- hw/display/exynos4210_fimd.c | 4 +- hw/display/g364fb.c | 3 +- hw/display/jazz_led.c | 3 +- hw/display/milkymist-tmu2.c | 4 +- hw/display/milkymist-vgafb.c | 4 +- hw/display/next-fb.c | 3 +- hw/display/pl110.c | 3 +- hw/display/ramfb-standalone.c | 3 +- hw/display/sii9022.c | 3 +- hw/display/sm501.c | 7 +-- hw/display/ssd0303.c | 3 +- hw/display/ssd0323.c | 3 +- hw/display/tcx.c | 3 +- hw/display/vga-isa.c | 3 +- hw/display/vga-pci.c | 3 +- hw/display/vhost-user-gpu-pci.c | 4 +- hw/display/vhost-user-vga.c | 4 +- hw/display/virtio-gpu-pci.c | 4 +- hw/display/virtio-vga.c | 4 +- hw/dma/i82374.c | 3 +- hw/dma/pl330.c | 3 +- hw/dma/puv3_dma.c | 3 +- hw/dma/pxa2xx_dma.c | 3 +- hw/dma/rc4030.c | 4 +- hw/dma/xilinx_axidma.c | 14 +++-- hw/gpio/gpio_key.c | 3 +- hw/gpio/max7310.c | 3 +- hw/gpio/mpc8xxx.c | 3 +- hw/gpio/pl061.c | 3 +- hw/gpio/puv3_gpio.c | 3 +- hw/gpio/zaurus.c | 3 +- hw/hppa/dino.c | 4 +- hw/hppa/lasi.c | 4 +- hw/hyperv/hyperv.c | 3 +- hw/hyperv/hyperv_testdev.c | 4 +- hw/i2c/bitbang_i2c.c | 3 +- hw/i2c/exynos4210_i2c.c | 4 +- hw/i2c/mpc_i2c.c | 4 +- hw/i2c/smbus_eeprom.c | 4 +- hw/i2c/smbus_ich9.c | 4 +- hw/i2c/versatile_i2c.c | 4 +- hw/i386/kvm/clock.c | 3 +- hw/i386/kvm/i8254.c | 7 +-- hw/i386/kvm/i8259.c | 6 +-- hw/i386/kvmvapic.c | 3 +- hw/i386/port92.c | 3 +- hw/i386/vmmouse.c | 3 +- hw/i386/vmport.c | 3 +- hw/i386/xen/xen_platform.c | 4 +- hw/i386/xen/xen_pvdevice.c | 4 +- hw/ide/isa.c | 3 +- hw/ide/microdrive.c | 3 +- hw/ide/mmio.c | 3 +- hw/ide/sii3112.c | 2 +- hw/input/adb-kbd.c | 7 +-- hw/input/adb-mouse.c | 7 +-- hw/input/lm832x.c | 3 +- hw/input/milkymist-softusb.c | 4 +- hw/input/pl050.c | 3 +- hw/intc/arm_gicv2m.c | 3 +- hw/intc/exynos4210_combiner.c | 4 +- hw/intc/exynos4210_gic.c | 8 +-- hw/intc/grlib_irqmp.c | 3 +- hw/intc/i8259.c | 4 +- hw/intc/lm32_pic.c | 3 +- hw/intc/nios2_iic.c | 4 +- hw/intc/ompic.c | 3 +- hw/intc/openpic_kvm.c | 4 +- hw/intc/pl190.c | 3 +- hw/intc/puv3_intc.c | 3 +- hw/intc/s390_flic_kvm.c | 6 +-- hw/intc/slavio_intctl.c | 4 +- hw/ipack/tpci200.c | 4 +- hw/ipmi/ipmi_bmc_extern.c | 4 +- hw/ipmi/isa_ipmi_bt.c | 4 +- hw/ipmi/isa_ipmi_kcs.c | 4 +- hw/ipmi/pci_ipmi_bt.c | 4 +- hw/ipmi/pci_ipmi_kcs.c | 4 +- hw/ipmi/smbus_ipmi.c | 3 +- hw/isa/i82378.c | 4 +- hw/isa/piix4.c | 4 +- hw/isa/vt82c686.c | 16 +++--- hw/m68k/mcf_intc.c | 3 +- hw/m68k/next-cube.c | 3 +- hw/m68k/next-kbd.c | 3 +- hw/microblaze/xlnx-zynqmp-pmu.c | 4 +- hw/mips/boston.c | 3 +- hw/mips/gt64xxx_pci.c | 4 +- hw/mips/malta.c | 3 +- hw/misc/applesmc.c | 3 +- hw/misc/arm_integrator_debug.c | 4 +- hw/misc/arm_l2x0.c | 3 +- hw/misc/arm_sysctl.c | 4 +- hw/misc/debugexit.c | 4 +- hw/misc/eccmemctl.c | 3 +- hw/misc/edu.c | 3 +- hw/misc/empty_slot.c | 3 +- hw/misc/exynos4210_clk.c | 4 +- hw/misc/exynos4210_pmu.c | 4 +- hw/misc/exynos4210_rng.c | 4 +- hw/misc/ivshmem.c | 16 +++--- hw/misc/milkymist-hpdmc.c | 4 +- hw/misc/milkymist-pfpu.c | 4 +- hw/misc/mst_fpga.c | 4 +- hw/misc/pc-testdev.c | 4 +- hw/misc/pca9552.c | 6 +-- hw/misc/pci-testdev.c | 4 +- hw/misc/puv3_pm.c | 3 +- hw/misc/pvpanic.c | 4 +- hw/misc/sga.c | 3 +- hw/misc/slavio_misc.c | 6 ++- hw/misc/tmp421.c | 7 +-- hw/misc/zynq_slcr.c | 3 +- hw/net/can/can_kvaser_pci.c | 4 +- hw/net/can/can_mioe3680_pci.c | 4 +- hw/net/can/can_pcm3680_pci.c | 4 +- hw/net/dp8393x.c | 3 +- hw/net/e1000.c | 8 +-- hw/net/e1000e.c | 3 +- hw/net/etraxfs_eth.c | 4 +- hw/net/lan9118.c | 3 +- hw/net/milkymist-minimac2.c | 4 +- hw/net/mipsnet.c | 3 +- hw/net/ne2000-isa.c | 3 +- hw/net/opencores_eth.c | 3 +- hw/net/pcnet-pci.c | 4 +- hw/net/rtl8139.c | 4 +- hw/net/smc91c111.c | 3 +- hw/net/spapr_llan.c | 4 +- hw/net/stellaris_enet.c | 4 +- hw/net/sungem.c | 3 +- hw/net/sunhme.c | 3 +- hw/net/vmxnet3.c | 6 +-- hw/net/xgmac.c | 3 +- hw/net/xilinx_axienet.c | 14 +++-- hw/nvram/ds1225y.c | 3 +- hw/nvram/eeprom_at24c.c | 3 +- hw/nvram/spapr_nvram.c | 4 +- hw/pci-bridge/dec.c | 3 +- hw/pci-bridge/gen_pcie_root_port.c | 4 +- hw/pci-bridge/pci_bridge_dev.c | 4 +- hw/pci-bridge/pci_expander_bridge.c | 12 +++-- hw/pci-bridge/pcie_pci_bridge.c | 4 +- hw/pci-host/bonito.c | 8 +-- hw/pci-host/grackle.c | 4 +- hw/pci-host/i440fx.c | 4 +- hw/pci-host/ppce500.c | 8 +-- hw/pci-host/prep.c | 8 +-- hw/pci-host/versatile.c | 4 +- hw/ppc/mpc8544_guts.c | 3 +- hw/ppc/ppc440_pcix.c | 4 +- hw/ppc/ppc440_uc.c | 4 +- hw/ppc/ppc4xx_pci.c | 4 +- hw/ppc/ppce500_spin.c | 3 +- hw/ppc/prep_systemio.c | 4 +- hw/ppc/rs6000_mc.c | 4 +- hw/ppc/spapr_rng.c | 4 +- hw/rtc/ds1338.c | 3 +- hw/rtc/exynos4210_rtc.c | 4 +- hw/rtc/m41t80.c | 3 +- hw/rtc/m48t59-isa.c | 8 +-- hw/rtc/m48t59.c | 8 +-- hw/rtc/sun4v-rtc.c | 3 +- hw/rtc/twl92230.c | 3 +- hw/rx/rx-gdbsim.c | 8 +-- hw/rx/rx62n.c | 6 +-- hw/scsi/esp-pci.c | 8 +-- hw/scsi/lsi53c895a.c | 4 +- hw/scsi/megasas.c | 8 +-- hw/scsi/scsi-disk.c | 8 +-- hw/scsi/spapr_vscsi.c | 4 +- hw/scsi/vmw_pvscsi.c | 7 +-- hw/sd/milkymist-memcard.c | 4 +- hw/sd/pl181.c | 3 +- hw/sd/ssi-sd.c | 3 +- hw/sh4/sh_pci.c | 4 +- hw/sparc/sun4m.c | 13 +++-- hw/sparc64/sun4u.c | 12 +++-- hw/ssi/xilinx_spi.c | 3 +- hw/timer/altera_timer.c | 4 +- hw/timer/arm_timer.c | 7 +-- hw/timer/cadence_ttc.c | 4 +- hw/timer/etraxfs_timer.c | 4 +- hw/timer/exynos4210_mct.c | 4 +- hw/timer/exynos4210_pwm.c | 4 +- hw/timer/grlib_gptimer.c | 4 +- hw/timer/hpet.c | 3 +- hw/timer/i8254.c | 4 +- hw/timer/lm32_timer.c | 3 +- hw/timer/milkymist-sysctl.c | 4 +- hw/timer/puv3_ost.c | 3 +- hw/timer/pxa2xx_timer.c | 4 +- hw/timer/slavio_timer.c | 4 +- hw/tpm/tpm_crb.c | 3 +- hw/tpm/tpm_spapr.c | 4 +- hw/tpm/tpm_tis_isa.c | 3 +- hw/tpm/tpm_tis_sysbus.c | 3 +- hw/usb/ccid-card-emulated.c | 4 +- hw/usb/ccid-card-passthru.c | 4 +- hw/usb/dev-audio.c | 3 +- hw/usb/dev-hid.c | 3 +- hw/usb/dev-hub.c | 3 +- hw/usb/dev-mtp.c | 3 +- hw/usb/dev-network.c | 3 +- hw/usb/dev-serial.c | 3 +- hw/usb/dev-smartcard-reader.c | 6 ++- hw/usb/dev-storage.c | 3 +- hw/usb/dev-uas.c | 3 +- hw/usb/dev-wacom.c | 3 +- hw/usb/hcd-ohci-pci.c | 3 +- hw/usb/hcd-uhci.c | 3 +- hw/usb/host-libusb.c | 4 +- hw/usb/redirect.c | 3 +- hw/usb/tusb6010.c | 3 +- hw/vfio/ap.c | 4 +- hw/virtio/vhost-scsi-pci.c | 4 +- hw/virtio/vhost-user-blk-pci.c | 4 +- hw/virtio/vhost-user-fs-pci.c | 4 +- hw/virtio/vhost-user-input-pci.c | 4 +- hw/virtio/vhost-user-scsi-pci.c | 4 +- hw/virtio/vhost-user-vsock-pci.c | 4 +- hw/virtio/vhost-vsock-pci.c | 4 +- hw/virtio/virtio-9p-pci.c | 4 +- hw/virtio/virtio-balloon-pci.c | 4 +- hw/virtio/virtio-blk-pci.c | 4 +- hw/virtio/virtio-crypto-pci.c | 4 +- hw/virtio/virtio-input-host-pci.c | 4 +- hw/virtio/virtio-input-pci.c | 8 +-- hw/virtio/virtio-iommu-pci.c | 4 +- hw/virtio/virtio-net-pci.c | 4 +- hw/virtio/virtio-rng-pci.c | 4 +- hw/virtio/virtio-scsi-pci.c | 4 +- hw/virtio/virtio-serial-pci.c | 4 +- hw/watchdog/wdt_i6300esb.c | 4 +- hw/watchdog/wdt_ib700.c | 3 +- iothread.c | 6 +-- migration/rdma.c | 4 +- net/can/can_socketcan.c | 4 +- net/colo-compare.c | 4 +- net/dump.c | 4 +- net/filter-buffer.c | 4 +- net/filter-mirror.c | 8 +-- net/filter-replay.c | 4 +- net/filter-rewriter.c | 4 +- scsi/pr-manager-helper.c | 5 +- target/i386/sev.c | 4 +- tests/check-qom-interface.c | 6 +-- tests/check-qom-proplist.c | 16 +++--- tests/test-qdev-global-props.c | 8 +-- ui/console.c | 3 +- ui/gtk.c | 3 +- ui/input-barrier.c | 8 +-- ui/input-linux.c | 8 +-- ui/spice-app.c | 3 +- 765 files changed, 1896 insertions(+), 2307 deletions(-) diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h index 2926a326e0..aba0240759 100644 --- a/chardev/chardev-internal.h +++ b/chardev/chardev-internal.h @@ -54,7 +54,8 @@ struct MuxChardev { }; typedef struct MuxChardev MuxChardev; -#define MUX_CHARDEV(obj) OBJECT_CHECK(MuxChardev, (obj), TYPE_CHARDEV_MUX) +DECLARE_INSTANCE_CHECKER(MuxChardev, MUX_CHARDEV, + TYPE_CHARDEV_MUX) #define CHARDEV_IS_MUX(chr) \ object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX) diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h index 6dd945ecda..ff70c5a971 100644 --- a/hw/9pfs/virtio-9p.h +++ b/hw/9pfs/virtio-9p.h @@ -16,7 +16,7 @@ struct V9fsVirtioState { typedef struct V9fsVirtioState V9fsVirtioState; #define TYPE_VIRTIO_9P "virtio-9p-device" -#define VIRTIO_9P(obj) \ - OBJECT_CHECK(V9fsVirtioState, (obj), TYPE_VIRTIO_9P) +DECLARE_INSTANCE_CHECKER(V9fsVirtioState, VIRTIO_9P, + TYPE_VIRTIO_9P) #endif diff --git a/hw/audio/intel-hda.h b/hw/audio/intel-hda.h index 44a2897fff..813a7a357d 100644 --- a/hw/audio/intel-hda.h +++ b/hw/audio/intel-hda.h @@ -10,16 +10,13 @@ #define TYPE_HDA_CODEC_DEVICE "hda-codec" typedef struct HDACodecDevice HDACodecDevice; typedef struct HDACodecDeviceClass HDACodecDeviceClass; -#define HDA_CODEC_DEVICE(obj) \ - OBJECT_CHECK(HDACodecDevice, (obj), TYPE_HDA_CODEC_DEVICE) -#define HDA_CODEC_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(HDACodecDeviceClass, (klass), TYPE_HDA_CODEC_DEVICE) -#define HDA_CODEC_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(HDACodecDeviceClass, (obj), TYPE_HDA_CODEC_DEVICE) +DECLARE_OBJ_CHECKERS(HDACodecDevice, HDACodecDeviceClass, + HDA_CODEC_DEVICE, TYPE_HDA_CODEC_DEVICE) #define TYPE_HDA_BUS "HDA" typedef struct HDACodecBus HDACodecBus; -#define HDA_BUS(obj) OBJECT_CHECK(HDACodecBus, (obj), TYPE_HDA_BUS) +DECLARE_INSTANCE_CHECKER(HDACodecBus, HDA_BUS, + TYPE_HDA_BUS) typedef void (*hda_codec_response_func)(HDACodecDevice *dev, diff --git a/hw/avr/atmega.h b/hw/avr/atmega.h index 2c46ecb904..a99ee15c7e 100644 --- a/hw/avr/atmega.h +++ b/hw/avr/atmega.h @@ -24,7 +24,8 @@ #define TYPE_ATMEGA2560_MCU "ATmega2560" typedef struct AtmegaMcuState AtmegaMcuState; -#define ATMEGA_MCU(obj) OBJECT_CHECK(AtmegaMcuState, (obj), TYPE_ATMEGA_MCU) +DECLARE_INSTANCE_CHECKER(AtmegaMcuState, ATMEGA_MCU, + TYPE_ATMEGA_MCU) #define POWER_MAX 2 #define USART_MAX 4 diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 02d576d7b2..a88a7736e1 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -76,8 +76,8 @@ static inline uint8_t nvme_ns_lbads(NvmeNamespace *ns) #define TYPE_NVME "nvme" typedef struct NvmeCtrl NvmeCtrl; -#define NVME(obj) \ - OBJECT_CHECK(NvmeCtrl, (obj), TYPE_NVME) +DECLARE_INSTANCE_CHECKER(NvmeCtrl, NVME, + TYPE_NVME) struct NvmeCtrl { PCIDevice parent_obj; diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h index 2a8a3306da..714005447d 100644 --- a/hw/display/ati_int.h +++ b/hw/display/ati_int.h @@ -31,7 +31,8 @@ #define TYPE_ATI_VGA "ati-vga" typedef struct ATIVGAState ATIVGAState; -#define ATI_VGA(obj) OBJECT_CHECK(ATIVGAState, (obj), TYPE_ATI_VGA) +DECLARE_INSTANCE_CHECKER(ATIVGAState, ATI_VGA, + TYPE_ATI_VGA) typedef struct ATIVGARegs { uint32_t mm_index; diff --git a/hw/display/qxl.h b/hw/display/qxl.h index 4ecb6b2934..714cd01b63 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -131,7 +131,8 @@ struct PCIQXLDevice { typedef struct PCIQXLDevice PCIQXLDevice; #define TYPE_PCI_QXL "pci-qxl" -#define PCI_QXL(obj) OBJECT_CHECK(PCIQXLDevice, (obj), TYPE_PCI_QXL) +DECLARE_INSTANCE_CHECKER(PCIQXLDevice, PCI_QXL, + TYPE_PCI_QXL) #define PANIC_ON(x) if ((x)) { \ printf("%s: PANIC %s failed\n", __func__, #x); \ diff --git a/hw/display/virtio-vga.h b/hw/display/virtio-vga.h index 2d3b765bf9..19f8af7356 100644 --- a/hw/display/virtio-vga.h +++ b/hw/display/virtio-vga.h @@ -11,12 +11,8 @@ #define TYPE_VIRTIO_VGA_BASE "virtio-vga-base" typedef struct VirtIOVGABase VirtIOVGABase; typedef struct VirtIOVGABaseClass VirtIOVGABaseClass; -#define VIRTIO_VGA_BASE(obj) \ - OBJECT_CHECK(VirtIOVGABase, (obj), TYPE_VIRTIO_VGA_BASE) -#define VIRTIO_VGA_BASE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtIOVGABaseClass, obj, TYPE_VIRTIO_VGA_BASE) -#define VIRTIO_VGA_BASE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtIOVGABaseClass, klass, TYPE_VIRTIO_VGA_BASE) +DECLARE_OBJ_CHECKERS(VirtIOVGABase, VirtIOVGABaseClass, + VIRTIO_VGA_BASE, TYPE_VIRTIO_VGA_BASE) struct VirtIOVGABase { VirtIOPCIProxy parent_obj; diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index 85860c36dd..fa5feb183c 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -298,8 +298,8 @@ struct irte_ga { #define TYPE_AMD_IOMMU_DEVICE "amd-iommu" typedef struct AMDVIState AMDVIState; -#define AMD_IOMMU_DEVICE(obj)\ - OBJECT_CHECK(AMDVIState, (obj), TYPE_AMD_IOMMU_DEVICE) +DECLARE_INSTANCE_CHECKER(AMDVIState, AMD_IOMMU_DEVICE, + TYPE_AMD_IOMMU_DEVICE) #define TYPE_AMD_IOMMU_PCI "AMDVI-PCI" diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h index 634bb4a0d6..7ee8a496ff 100644 --- a/hw/misc/tmp105.h +++ b/hw/misc/tmp105.h @@ -20,7 +20,8 @@ #define TYPE_TMP105 "tmp105" typedef struct TMP105State TMP105State; -#define TMP105(obj) OBJECT_CHECK(TMP105State, (obj), TYPE_TMP105) +DECLARE_INSTANCE_CHECKER(TMP105State, TMP105, + TYPE_TMP105) /** * TMP105State: diff --git a/hw/net/fsl_etsec/etsec.h b/hw/net/fsl_etsec/etsec.h index 132a87b1ba..0c929d9afd 100644 --- a/hw/net/fsl_etsec/etsec.h +++ b/hw/net/fsl_etsec/etsec.h @@ -150,8 +150,8 @@ struct eTSEC { typedef struct eTSEC eTSEC; #define TYPE_ETSEC_COMMON "eTSEC" -#define ETSEC_COMMON(obj) \ - OBJECT_CHECK(eTSEC, (obj), TYPE_ETSEC_COMMON) +DECLARE_INSTANCE_CHECKER(eTSEC, ETSEC_COMMON, + TYPE_ETSEC_COMMON) #define eTSEC_TRANSMIT 1 #define eTSEC_RECEIVE 2 diff --git a/hw/net/tulip.h b/hw/net/tulip.h index 5fe4aee87d..87e3ab79bc 100644 --- a/hw/net/tulip.h +++ b/hw/net/tulip.h @@ -7,7 +7,8 @@ #define TYPE_TULIP "tulip" typedef struct TULIPState TULIPState; -#define TULIP(obj) OBJECT_CHECK(TULIPState, (obj), TYPE_TULIP) +DECLARE_INSTANCE_CHECKER(TULIPState, TULIP, + TYPE_TULIP) #define CSR(_x) ((_x) << 3) diff --git a/hw/net/vmxnet3_defs.h b/hw/net/vmxnet3_defs.h index 1df1e4c3a6..71440509ca 100644 --- a/hw/net/vmxnet3_defs.h +++ b/hw/net/vmxnet3_defs.h @@ -23,7 +23,8 @@ #define TYPE_VMXNET3 "vmxnet3" typedef struct VMXNET3State VMXNET3State; -#define VMXNET3(obj) OBJECT_CHECK(VMXNET3State, (obj), TYPE_VMXNET3) +DECLARE_INSTANCE_CHECKER(VMXNET3State, VMXNET3, + TYPE_VMXNET3) /* Device state and helper functions */ #define VMXNET3_RX_RINGS_PER_QUEUE (2) diff --git a/hw/ppc/e500-ccsr.h b/hw/ppc/e500-ccsr.h index f7fd73fc0d..de4b9d2bc3 100644 --- a/hw/ppc/e500-ccsr.h +++ b/hw/ppc/e500-ccsr.h @@ -14,6 +14,7 @@ struct PPCE500CCSRState { typedef struct PPCE500CCSRState PPCE500CCSRState; #define TYPE_CCSR "e500-ccsr" -#define CCSR(obj) OBJECT_CHECK(PPCE500CCSRState, (obj), TYPE_CCSR) +DECLARE_INSTANCE_CHECKER(PPCE500CCSRState, CCSR, + TYPE_CCSR) #endif /* E500_CCSR_H */ diff --git a/hw/ppc/e500.h b/hw/ppc/e500.h index 5773460d5e..63870751ff 100644 --- a/hw/ppc/e500.h +++ b/hw/ppc/e500.h @@ -46,11 +46,7 @@ void ppce500_init(MachineState *machine); hwaddr booke206_page_size_to_tlb(uint64_t size); #define TYPE_PPCE500_MACHINE "ppce500-base-machine" -#define PPCE500_MACHINE(obj) \ - OBJECT_CHECK(PPCE500MachineState, (obj), TYPE_PPCE500_MACHINE) -#define PPCE500_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PPCE500MachineClass, obj, TYPE_PPCE500_MACHINE) -#define PPCE500_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PPCE500MachineClass, klass, TYPE_PPCE500_MACHINE) +DECLARE_OBJ_CHECKERS(PPCE500MachineState, PPCE500MachineClass, + PPCE500_MACHINE, TYPE_PPCE500_MACHINE) #endif diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index f4ef3f32b0..2b6425f600 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -73,8 +73,8 @@ /* Core99 machine */ #define TYPE_CORE99_MACHINE MACHINE_TYPE_NAME("mac99") typedef struct Core99MachineState Core99MachineState; -#define CORE99_MACHINE(obj) OBJECT_CHECK(Core99MachineState, (obj), \ - TYPE_CORE99_MACHINE) +DECLARE_INSTANCE_CHECKER(Core99MachineState, CORE99_MACHINE, + TYPE_CORE99_MACHINE) #define CORE99_VIA_CONFIG_CUDA 0x0 #define CORE99_VIA_CONFIG_PMU 0x1 @@ -93,8 +93,8 @@ struct Core99MachineState { /* Mac NVRAM */ #define TYPE_MACIO_NVRAM "macio-nvram" typedef struct MacIONVRAMState MacIONVRAMState; -#define MACIO_NVRAM(obj) \ - OBJECT_CHECK(MacIONVRAMState, (obj), TYPE_MACIO_NVRAM) +DECLARE_INSTANCE_CHECKER(MacIONVRAMState, MACIO_NVRAM, + TYPE_MACIO_NVRAM) struct MacIONVRAMState { /*< private >*/ diff --git a/hw/rdma/vmw/pvrdma.h b/hw/rdma/vmw/pvrdma.h index db9d9e2c73..1d36a76f1e 100644 --- a/hw/rdma/vmw/pvrdma.h +++ b/hw/rdma/vmw/pvrdma.h @@ -101,7 +101,8 @@ struct PVRDMADev { PVRDMADevStats stats; }; typedef struct PVRDMADev PVRDMADev; -#define PVRDMA_DEV(dev) OBJECT_CHECK(PVRDMADev, (dev), PVRDMA_HW_NAME) +DECLARE_INSTANCE_CHECKER(PVRDMADev, PVRDMA_DEV, + PVRDMA_HW_NAME) static inline int get_reg_val(PVRDMADev *dev, hwaddr addr, uint32_t *val) { diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h index 867547b4eb..cf7d492084 100644 --- a/hw/s390x/ccw-device.h +++ b/hw/s390x/ccw-device.h @@ -47,10 +47,7 @@ static inline CcwDevice *to_ccw_dev_fast(DeviceState *d) #define TYPE_CCW_DEVICE "ccw-device" -#define CCW_DEVICE(obj) OBJECT_CHECK(CcwDevice, (obj), TYPE_CCW_DEVICE) -#define CCW_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(CCWDeviceClass, (obj), TYPE_CCW_DEVICE) -#define CCW_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(CCWDeviceClass, (klass), TYPE_CCW_DEVICE) +DECLARE_OBJ_CHECKERS(CcwDevice, CCWDeviceClass, + CCW_DEVICE, TYPE_CCW_DEVICE) #endif diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index 282b22cc4f..9e6061a043 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -154,7 +154,8 @@ typedef struct QemuIplParameters QemuIplParameters; #define TYPE_S390_IPL "s390-ipl" typedef struct S390IPLState S390IPLState; -#define S390_IPL(obj) OBJECT_CHECK(S390IPLState, (obj), TYPE_S390_IPL) +DECLARE_INSTANCE_CHECKER(S390IPLState, S390_IPL, + TYPE_S390_IPL) struct S390IPLState { /*< private >*/ diff --git a/hw/s390x/s390-pci-bus.h b/hw/s390x/s390-pci-bus.h index 06f046e73a..045805980f 100644 --- a/hw/s390x/s390-pci-bus.h +++ b/hw/s390x/s390-pci-bus.h @@ -38,17 +38,17 @@ #define UID_CHECKING_ENABLED 0x01 typedef struct S390pciState S390pciState; -#define S390_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(S390pciState, (obj), TYPE_S390_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(S390pciState, S390_PCI_HOST_BRIDGE, + TYPE_S390_PCI_HOST_BRIDGE) typedef struct S390PCIBus S390PCIBus; -#define S390_PCI_BUS(obj) \ - OBJECT_CHECK(S390PCIBus, (obj), TYPE_S390_PCI_BUS) +DECLARE_INSTANCE_CHECKER(S390PCIBus, S390_PCI_BUS, + TYPE_S390_PCI_BUS) typedef struct S390PCIBusDevice S390PCIBusDevice; -#define S390_PCI_DEVICE(obj) \ - OBJECT_CHECK(S390PCIBusDevice, (obj), TYPE_S390_PCI_DEVICE) +DECLARE_INSTANCE_CHECKER(S390PCIBusDevice, S390_PCI_DEVICE, + TYPE_S390_PCI_DEVICE) typedef struct S390PCIIOMMU S390PCIIOMMU; -#define S390_PCI_IOMMU(obj) \ - OBJECT_CHECK(S390PCIIOMMU, (obj), TYPE_S390_PCI_IOMMU) +DECLARE_INSTANCE_CHECKER(S390PCIIOMMU, S390_PCI_IOMMU, + TYPE_S390_PCI_IOMMU) #define HP_EVENT_TO_CONFIGURED 0x0301 #define HP_EVENT_RESERVED_TO_STANDBY 0x0302 diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index c046c816c9..cea259685d 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -56,23 +56,15 @@ #define TYPE_VIRTIO_CCW_DEVICE "virtio-ccw-device" typedef struct VirtIOCCWDeviceClass VirtIOCCWDeviceClass; typedef struct VirtioCcwDevice VirtioCcwDevice; -#define VIRTIO_CCW_DEVICE(obj) \ - OBJECT_CHECK(VirtioCcwDevice, (obj), TYPE_VIRTIO_CCW_DEVICE) -#define VIRTIO_CCW_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtIOCCWDeviceClass, (klass), TYPE_VIRTIO_CCW_DEVICE) -#define VIRTIO_CCW_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtIOCCWDeviceClass, (obj), TYPE_VIRTIO_CCW_DEVICE) +DECLARE_OBJ_CHECKERS(VirtioCcwDevice, VirtIOCCWDeviceClass, + VIRTIO_CCW_DEVICE, TYPE_VIRTIO_CCW_DEVICE) typedef struct VirtioBusState VirtioCcwBusState; typedef struct VirtioBusClass VirtioCcwBusClass; #define TYPE_VIRTIO_CCW_BUS "virtio-ccw-bus" -#define VIRTIO_CCW_BUS(obj) \ - OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS) -#define VIRTIO_CCW_BUS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtioCcwBusClass, (obj), TYPE_VIRTIO_CCW_BUS) -#define VIRTIO_CCW_BUS_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtioCcwBusClass, klass, TYPE_VIRTIO_CCW_BUS) +DECLARE_OBJ_CHECKERS(VirtioCcwBusState, VirtioCcwBusClass, + VIRTIO_CCW_BUS, TYPE_VIRTIO_CCW_BUS) struct VirtIOCCWDeviceClass { @@ -114,8 +106,8 @@ static inline int virtio_ccw_rev_max(VirtioCcwDevice *dev) #define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw" typedef struct VirtIOSCSICcw VirtIOSCSICcw; -#define VIRTIO_SCSI_CCW(obj) \ - OBJECT_CHECK(VirtIOSCSICcw, (obj), TYPE_VIRTIO_SCSI_CCW) +DECLARE_INSTANCE_CHECKER(VirtIOSCSICcw, VIRTIO_SCSI_CCW, + TYPE_VIRTIO_SCSI_CCW) struct VirtIOSCSICcw { VirtioCcwDevice parent_obj; @@ -127,8 +119,8 @@ struct VirtIOSCSICcw { #define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw" typedef struct VHostSCSICcw VHostSCSICcw; -#define VHOST_SCSI_CCW(obj) \ - OBJECT_CHECK(VHostSCSICcw, (obj), TYPE_VHOST_SCSI_CCW) +DECLARE_INSTANCE_CHECKER(VHostSCSICcw, VHOST_SCSI_CCW, + TYPE_VHOST_SCSI_CCW) struct VHostSCSICcw { VirtioCcwDevice parent_obj; @@ -140,8 +132,8 @@ struct VHostSCSICcw { #define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw" typedef struct VirtIOBlkCcw VirtIOBlkCcw; -#define VIRTIO_BLK_CCW(obj) \ - OBJECT_CHECK(VirtIOBlkCcw, (obj), TYPE_VIRTIO_BLK_CCW) +DECLARE_INSTANCE_CHECKER(VirtIOBlkCcw, VIRTIO_BLK_CCW, + TYPE_VIRTIO_BLK_CCW) struct VirtIOBlkCcw { VirtioCcwDevice parent_obj; @@ -152,8 +144,8 @@ struct VirtIOBlkCcw { #define TYPE_VIRTIO_BALLOON_CCW "virtio-balloon-ccw" typedef struct VirtIOBalloonCcw VirtIOBalloonCcw; -#define VIRTIO_BALLOON_CCW(obj) \ - OBJECT_CHECK(VirtIOBalloonCcw, (obj), TYPE_VIRTIO_BALLOON_CCW) +DECLARE_INSTANCE_CHECKER(VirtIOBalloonCcw, VIRTIO_BALLOON_CCW, + TYPE_VIRTIO_BALLOON_CCW) struct VirtIOBalloonCcw { VirtioCcwDevice parent_obj; @@ -164,8 +156,8 @@ struct VirtIOBalloonCcw { #define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw" typedef struct VirtioSerialCcw VirtioSerialCcw; -#define VIRTIO_SERIAL_CCW(obj) \ - OBJECT_CHECK(VirtioSerialCcw, (obj), TYPE_VIRTIO_SERIAL_CCW) +DECLARE_INSTANCE_CHECKER(VirtioSerialCcw, VIRTIO_SERIAL_CCW, + TYPE_VIRTIO_SERIAL_CCW) struct VirtioSerialCcw { VirtioCcwDevice parent_obj; @@ -176,8 +168,8 @@ struct VirtioSerialCcw { #define TYPE_VIRTIO_NET_CCW "virtio-net-ccw" typedef struct VirtIONetCcw VirtIONetCcw; -#define VIRTIO_NET_CCW(obj) \ - OBJECT_CHECK(VirtIONetCcw, (obj), TYPE_VIRTIO_NET_CCW) +DECLARE_INSTANCE_CHECKER(VirtIONetCcw, VIRTIO_NET_CCW, + TYPE_VIRTIO_NET_CCW) struct VirtIONetCcw { VirtioCcwDevice parent_obj; @@ -188,8 +180,8 @@ struct VirtIONetCcw { #define TYPE_VIRTIO_RNG_CCW "virtio-rng-ccw" typedef struct VirtIORNGCcw VirtIORNGCcw; -#define VIRTIO_RNG_CCW(obj) \ - OBJECT_CHECK(VirtIORNGCcw, (obj), TYPE_VIRTIO_RNG_CCW) +DECLARE_INSTANCE_CHECKER(VirtIORNGCcw, VIRTIO_RNG_CCW, + TYPE_VIRTIO_RNG_CCW) struct VirtIORNGCcw { VirtioCcwDevice parent_obj; @@ -200,8 +192,8 @@ struct VirtIORNGCcw { #define TYPE_VIRTIO_CRYPTO_CCW "virtio-crypto-ccw" typedef struct VirtIOCryptoCcw VirtIOCryptoCcw; -#define VIRTIO_CRYPTO_CCW(obj) \ - OBJECT_CHECK(VirtIOCryptoCcw, (obj), TYPE_VIRTIO_CRYPTO_CCW) +DECLARE_INSTANCE_CHECKER(VirtIOCryptoCcw, VIRTIO_CRYPTO_CCW, + TYPE_VIRTIO_CRYPTO_CCW) struct VirtIOCryptoCcw { VirtioCcwDevice parent_obj; @@ -215,8 +207,8 @@ VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch); #define TYPE_VIRTIO_9P_CCW "virtio-9p-ccw" typedef struct V9fsCCWState V9fsCCWState; -#define VIRTIO_9P_CCW(obj) \ - OBJECT_CHECK(V9fsCCWState, (obj), TYPE_VIRTIO_9P_CCW) +DECLARE_INSTANCE_CHECKER(V9fsCCWState, VIRTIO_9P_CCW, + TYPE_VIRTIO_9P_CCW) struct V9fsCCWState { VirtioCcwDevice parent_obj; @@ -228,8 +220,8 @@ struct V9fsCCWState { #ifdef CONFIG_VHOST_VSOCK #define TYPE_VHOST_VSOCK_CCW "vhost-vsock-ccw" typedef struct VHostVSockCCWState VHostVSockCCWState; -#define VHOST_VSOCK_CCW(obj) \ - OBJECT_CHECK(VHostVSockCCWState, (obj), TYPE_VHOST_VSOCK_CCW) +DECLARE_INSTANCE_CHECKER(VHostVSockCCWState, VHOST_VSOCK_CCW, + TYPE_VHOST_VSOCK_CCW) struct VHostVSockCCWState { VirtioCcwDevice parent_obj; @@ -240,8 +232,8 @@ struct VHostVSockCCWState { #define TYPE_VIRTIO_GPU_CCW "virtio-gpu-ccw" typedef struct VirtIOGPUCcw VirtIOGPUCcw; -#define VIRTIO_GPU_CCW(obj) \ - OBJECT_CHECK(VirtIOGPUCcw, (obj), TYPE_VIRTIO_GPU_CCW) +DECLARE_INSTANCE_CHECKER(VirtIOGPUCcw, VIRTIO_GPU_CCW, + TYPE_VIRTIO_GPU_CCW) struct VirtIOGPUCcw { VirtioCcwDevice parent_obj; @@ -250,8 +242,8 @@ struct VirtIOGPUCcw { #define TYPE_VIRTIO_INPUT_CCW "virtio-input-ccw" typedef struct VirtIOInputCcw VirtIOInputCcw; -#define VIRTIO_INPUT_CCW(obj) \ - OBJECT_CHECK(VirtIOInputCcw, (obj), TYPE_VIRTIO_INPUT_CCW) +DECLARE_INSTANCE_CHECKER(VirtIOInputCcw, VIRTIO_INPUT_CCW, + TYPE_VIRTIO_INPUT_CCW) struct VirtIOInputCcw { VirtioCcwDevice parent_obj; @@ -263,8 +255,8 @@ struct VirtIOInputCcw { #define TYPE_VIRTIO_MOUSE_CCW "virtio-mouse-ccw" #define TYPE_VIRTIO_TABLET_CCW "virtio-tablet-ccw" typedef struct VirtIOInputHIDCcw VirtIOInputHIDCcw; -#define VIRTIO_INPUT_HID_CCW(obj) \ - OBJECT_CHECK(VirtIOInputHIDCcw, (obj), TYPE_VIRTIO_INPUT_HID_CCW) +DECLARE_INSTANCE_CHECKER(VirtIOInputHIDCcw, VIRTIO_INPUT_HID_CCW, + TYPE_VIRTIO_INPUT_HID_CCW) struct VirtIOInputHIDCcw { VirtioCcwDevice parent_obj; diff --git a/hw/usb/ccid.h b/hw/usb/ccid.h index b992d2ccf8..ef2bb3462d 100644 --- a/hw/usb/ccid.h +++ b/hw/usb/ccid.h @@ -18,12 +18,8 @@ typedef struct CCIDCardInfo CCIDCardInfo; #define TYPE_CCID_CARD "ccid-card" typedef struct CCIDCardClass CCIDCardClass; -#define CCID_CARD(obj) \ - OBJECT_CHECK(CCIDCardState, (obj), TYPE_CCID_CARD) -#define CCID_CARD_CLASS(klass) \ - OBJECT_CLASS_CHECK(CCIDCardClass, (klass), TYPE_CCID_CARD) -#define CCID_CARD_GET_CLASS(obj) \ - OBJECT_GET_CLASS(CCIDCardClass, (obj), TYPE_CCID_CARD) +DECLARE_OBJ_CHECKERS(CCIDCardState, CCIDCardClass, + CCID_CARD, TYPE_CCID_CARD) /* * callbacks to be used by the CCID device (hw/usb-ccid.c) to call diff --git a/hw/usb/hcd-dwc2.h b/hw/usb/hcd-dwc2.h index 71b40f0d8a..919e3e43b1 100644 --- a/hw/usb/hcd-dwc2.h +++ b/hw/usb/hcd-dwc2.h @@ -181,11 +181,7 @@ struct DWC2Class { }; #define TYPE_DWC2_USB "dwc2-usb" -#define DWC2_USB(obj) \ - OBJECT_CHECK(DWC2State, (obj), TYPE_DWC2_USB) -#define DWC2_USB_CLASS(klass) \ - OBJECT_CLASS_CHECK(DWC2Class, (klass), TYPE_DWC2_USB) -#define DWC2_USB_GET_CLASS(obj) \ - OBJECT_GET_CLASS(DWC2Class, (obj), TYPE_DWC2_USB) +DECLARE_OBJ_CHECKERS(DWC2State, DWC2Class, + DWC2_USB, TYPE_DWC2_USB) #endif diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index c12c9bae46..1301ce0be7 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -330,7 +330,8 @@ void ehci_reset(void *opaque); #define TYPE_PCI_EHCI "pci-ehci-usb" typedef struct EHCIPCIState EHCIPCIState; -#define PCI_EHCI(obj) OBJECT_CHECK(EHCIPCIState, (obj), TYPE_PCI_EHCI) +DECLARE_INSTANCE_CHECKER(EHCIPCIState, PCI_EHCI, + TYPE_PCI_EHCI) struct EHCIPCIState { /*< private >*/ @@ -351,12 +352,8 @@ struct EHCIPCIState { typedef struct EHCISysBusState EHCISysBusState; typedef struct SysBusEHCIClass SysBusEHCIClass; -#define SYS_BUS_EHCI(obj) \ - OBJECT_CHECK(EHCISysBusState, (obj), TYPE_SYS_BUS_EHCI) -#define SYS_BUS_EHCI_CLASS(class) \ - OBJECT_CLASS_CHECK(SysBusEHCIClass, (class), TYPE_SYS_BUS_EHCI) -#define SYS_BUS_EHCI_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SysBusEHCIClass, (obj), TYPE_SYS_BUS_EHCI) +DECLARE_OBJ_CHECKERS(EHCISysBusState, SysBusEHCIClass, + SYS_BUS_EHCI, TYPE_SYS_BUS_EHCI) struct EHCISysBusState { /*< private >*/ @@ -378,8 +375,8 @@ struct SysBusEHCIClass { }; typedef struct FUSBH200EHCIState FUSBH200EHCIState; -#define FUSBH200_EHCI(obj) \ - OBJECT_CHECK(FUSBH200EHCIState, (obj), TYPE_FUSBH200_EHCI) +DECLARE_INSTANCE_CHECKER(FUSBH200EHCIState, FUSBH200_EHCI, + TYPE_FUSBH200_EHCI) struct FUSBH200EHCIState { /*< private >*/ diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h index 3e9053fb26..6e28e97839 100644 --- a/hw/usb/hcd-ohci.h +++ b/hw/usb/hcd-ohci.h @@ -94,7 +94,8 @@ typedef struct OHCIState { #define TYPE_SYSBUS_OHCI "sysbus-ohci" typedef struct OHCISysBusState OHCISysBusState; -#define SYSBUS_OHCI(obj) OBJECT_CHECK(OHCISysBusState, (obj), TYPE_SYSBUS_OHCI) +DECLARE_INSTANCE_CHECKER(OHCISysBusState, SYSBUS_OHCI, + TYPE_SYSBUS_OHCI) struct OHCISysBusState { /*< private >*/ diff --git a/hw/usb/hcd-xhci.h b/hw/usb/hcd-xhci.h index 867388a061..2110c0399e 100644 --- a/hw/usb/hcd-xhci.h +++ b/hw/usb/hcd-xhci.h @@ -28,8 +28,8 @@ #define TYPE_QEMU_XHCI "qemu-xhci" typedef struct XHCIState XHCIState; -#define XHCI(obj) \ - OBJECT_CHECK(XHCIState, (obj), TYPE_XHCI) +DECLARE_INSTANCE_CHECKER(XHCIState, XHCI, + TYPE_XHCI) #define MAXPORTS_2 15 #define MAXPORTS_3 15 diff --git a/hw/virtio/virtio-mem-pci.h b/hw/virtio/virtio-mem-pci.h index 65b86beac7..e636e1a48d 100644 --- a/hw/virtio/virtio-mem-pci.h +++ b/hw/virtio/virtio-mem-pci.h @@ -23,8 +23,8 @@ typedef struct VirtIOMEMPCI VirtIOMEMPCI; * virtio-mem-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_MEM_PCI "virtio-mem-pci-base" -#define VIRTIO_MEM_PCI(obj) \ - OBJECT_CHECK(VirtIOMEMPCI, (obj), TYPE_VIRTIO_MEM_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOMEMPCI, VIRTIO_MEM_PCI, + TYPE_VIRTIO_MEM_PCI) struct VirtIOMEMPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 9175da6e81..df18fb6f33 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -27,12 +27,8 @@ typedef struct VirtioBusState VirtioPCIBusState; typedef struct VirtioBusClass VirtioPCIBusClass; #define TYPE_VIRTIO_PCI_BUS "virtio-pci-bus" -#define VIRTIO_PCI_BUS(obj) \ - OBJECT_CHECK(VirtioPCIBusState, (obj), TYPE_VIRTIO_PCI_BUS) -#define VIRTIO_PCI_BUS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtioPCIBusClass, obj, TYPE_VIRTIO_PCI_BUS) -#define VIRTIO_PCI_BUS_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS) +DECLARE_OBJ_CHECKERS(VirtioPCIBusState, VirtioPCIBusClass, + VIRTIO_PCI_BUS, TYPE_VIRTIO_PCI_BUS) enum { VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT, @@ -96,12 +92,8 @@ typedef struct { */ #define TYPE_VIRTIO_PCI "virtio-pci" typedef struct VirtioPCIClass VirtioPCIClass; -#define VIRTIO_PCI_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtioPCIClass, obj, TYPE_VIRTIO_PCI) -#define VIRTIO_PCI_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtioPCIClass, klass, TYPE_VIRTIO_PCI) -#define VIRTIO_PCI(obj) \ - OBJECT_CHECK(VirtIOPCIProxy, (obj), TYPE_VIRTIO_PCI) +DECLARE_OBJ_CHECKERS(VirtIOPCIProxy, VirtioPCIClass, + VIRTIO_PCI, TYPE_VIRTIO_PCI) struct VirtioPCIClass { PCIDeviceClass parent_class; diff --git a/hw/virtio/virtio-pmem-pci.h b/hw/virtio/virtio-pmem-pci.h index 5ac8099637..63cfe727f7 100644 --- a/hw/virtio/virtio-pmem-pci.h +++ b/hw/virtio/virtio-pmem-pci.h @@ -24,8 +24,8 @@ typedef struct VirtIOPMEMPCI VirtIOPMEMPCI; * virtio-pmem-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_PMEM_PCI "virtio-pmem-pci-base" -#define VIRTIO_PMEM_PCI(obj) \ - OBJECT_CHECK(VirtIOPMEMPCI, (obj), TYPE_VIRTIO_PMEM_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOPMEMPCI, VIRTIO_PMEM_PCI, + TYPE_VIRTIO_PMEM_PCI) struct VirtIOPMEMPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h index c367c7da27..f46971eac6 100644 --- a/hw/xen/xen_pt.h +++ b/hw/xen/xen_pt.h @@ -40,8 +40,8 @@ typedef struct XenPTReg XenPTReg; typedef struct XenPCIPassthroughState XenPCIPassthroughState; #define TYPE_XEN_PT_DEVICE "xen-pci-passthrough" -#define XEN_PT_DEVICE(obj) \ - OBJECT_CHECK(XenPCIPassthroughState, (obj), TYPE_XEN_PT_DEVICE) +DECLARE_INSTANCE_CHECKER(XenPCIPassthroughState, XEN_PT_DEVICE, + TYPE_XEN_PT_DEVICE) uint32_t igd_read_opregion(XenPCIPassthroughState *s); void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val); diff --git a/include/authz/base.h b/include/authz/base.h index c01946b4ce..8d8cf9fa5a 100644 --- a/include/authz/base.h +++ b/include/authz/base.h @@ -29,15 +29,8 @@ typedef struct QAuthZ QAuthZ; typedef struct QAuthZClass QAuthZClass; -#define QAUTHZ_CLASS(klass) \ - OBJECT_CLASS_CHECK(QAuthZClass, (klass), \ - TYPE_QAUTHZ) -#define QAUTHZ_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QAuthZClass, (obj), \ - TYPE_QAUTHZ) -#define QAUTHZ(obj) \ - OBJECT_CHECK(QAuthZ, (obj), \ - TYPE_QAUTHZ) +DECLARE_OBJ_CHECKERS(QAuthZ, QAuthZClass, + QAUTHZ, TYPE_QAUTHZ) /** diff --git a/include/authz/list.h b/include/authz/list.h index 5d5e8e803f..93d16876bc 100644 --- a/include/authz/list.h +++ b/include/authz/list.h @@ -29,15 +29,8 @@ typedef struct QAuthZList QAuthZList; typedef struct QAuthZListClass QAuthZListClass; -#define QAUTHZ_LIST_CLASS(klass) \ - OBJECT_CLASS_CHECK(QAuthZListClass, (klass), \ - TYPE_QAUTHZ_LIST) -#define QAUTHZ_LIST_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QAuthZListClass, (obj), \ - TYPE_QAUTHZ_LIST) -#define QAUTHZ_LIST(obj) \ - OBJECT_CHECK(QAuthZList, (obj), \ - TYPE_QAUTHZ_LIST) +DECLARE_OBJ_CHECKERS(QAuthZList, QAuthZListClass, + QAUTHZ_LIST, TYPE_QAUTHZ_LIST) diff --git a/include/authz/listfile.h b/include/authz/listfile.h index 11169ac882..2e4a629b6d 100644 --- a/include/authz/listfile.h +++ b/include/authz/listfile.h @@ -29,15 +29,8 @@ typedef struct QAuthZListFile QAuthZListFile; typedef struct QAuthZListFileClass QAuthZListFileClass; -#define QAUTHZ_LIST_FILE_CLASS(klass) \ - OBJECT_CLASS_CHECK(QAuthZListFileClass, (klass), \ - TYPE_QAUTHZ_LIST_FILE) -#define QAUTHZ_LIST_FILE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QAuthZListFileClass, (obj), \ - TYPE_QAUTHZ_LIST_FILE) -#define QAUTHZ_LIST_FILE(obj) \ - OBJECT_CHECK(QAuthZListFile, (obj), \ - TYPE_QAUTHZ_LIST_FILE) +DECLARE_OBJ_CHECKERS(QAuthZListFile, QAuthZListFileClass, + QAUTHZ_LIST_FILE, TYPE_QAUTHZ_LIST_FILE) diff --git a/include/authz/pamacct.h b/include/authz/pamacct.h index a14cf33fb4..98454ddc25 100644 --- a/include/authz/pamacct.h +++ b/include/authz/pamacct.h @@ -29,15 +29,8 @@ typedef struct QAuthZPAM QAuthZPAM; typedef struct QAuthZPAMClass QAuthZPAMClass; -#define QAUTHZ_PAM_CLASS(klass) \ - OBJECT_CLASS_CHECK(QAuthZPAMClass, (klass), \ - TYPE_QAUTHZ_PAM) -#define QAUTHZ_PAM_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QAuthZPAMClass, (obj), \ - TYPE_QAUTHZ_PAM) -#define QAUTHZ_PAM(obj) \ - OBJECT_CHECK(QAuthZPAM, (obj), \ - TYPE_QAUTHZ_PAM) +DECLARE_OBJ_CHECKERS(QAuthZPAM, QAuthZPAMClass, + QAUTHZ_PAM, TYPE_QAUTHZ_PAM) diff --git a/include/authz/simple.h b/include/authz/simple.h index df8c1bf39c..7a896fb94b 100644 --- a/include/authz/simple.h +++ b/include/authz/simple.h @@ -28,15 +28,8 @@ typedef struct QAuthZSimple QAuthZSimple; typedef struct QAuthZSimpleClass QAuthZSimpleClass; -#define QAUTHZ_SIMPLE_CLASS(klass) \ - OBJECT_CLASS_CHECK(QAuthZSimpleClass, (klass), \ - TYPE_QAUTHZ_SIMPLE) -#define QAUTHZ_SIMPLE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QAuthZSimpleClass, (obj), \ - TYPE_QAUTHZ_SIMPLE) -#define QAUTHZ_SIMPLE(obj) \ - OBJECT_CHECK(QAuthZSimple, (obj), \ - TYPE_QAUTHZ_SIMPLE) +DECLARE_OBJ_CHECKERS(QAuthZSimple, QAuthZSimpleClass, + QAUTHZ_SIMPLE, TYPE_QAUTHZ_SIMPLE) diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h index 7c6f572cf9..20b308f619 100644 --- a/include/block/throttle-groups.h +++ b/include/block/throttle-groups.h @@ -61,7 +61,8 @@ typedef struct ThrottleGroupMember { #define TYPE_THROTTLE_GROUP "throttle-group" typedef struct ThrottleGroup ThrottleGroup; -#define THROTTLE_GROUP(obj) OBJECT_CHECK(ThrottleGroup, (obj), TYPE_THROTTLE_GROUP) +DECLARE_INSTANCE_CHECKER(ThrottleGroup, THROTTLE_GROUP, + TYPE_THROTTLE_GROUP) const char *throttle_group_get_name(ThrottleGroupMember *tgm); diff --git a/include/chardev/char-fd.h b/include/chardev/char-fd.h index 1442dcaa62..9de0e440de 100644 --- a/include/chardev/char-fd.h +++ b/include/chardev/char-fd.h @@ -38,7 +38,8 @@ typedef struct FDChardev FDChardev; #define TYPE_CHARDEV_FD "chardev-fd" -#define FD_CHARDEV(obj) OBJECT_CHECK(FDChardev, (obj), TYPE_CHARDEV_FD) +DECLARE_INSTANCE_CHECKER(FDChardev, FD_CHARDEV, + TYPE_CHARDEV_FD) void qemu_chr_open_fd(Chardev *chr, int fd_in, int fd_out); int qmp_chardev_open_file_source(char *src, int flags, Error **errp); diff --git a/include/chardev/char-win.h b/include/chardev/char-win.h index f1632330f1..485521469c 100644 --- a/include/chardev/char-win.h +++ b/include/chardev/char-win.h @@ -44,7 +44,8 @@ typedef struct WinChardev WinChardev; #define NRECVBUF 2048 #define TYPE_CHARDEV_WIN "chardev-win" -#define WIN_CHARDEV(obj) OBJECT_CHECK(WinChardev, (obj), TYPE_CHARDEV_WIN) +DECLARE_INSTANCE_CHECKER(WinChardev, WIN_CHARDEV, + TYPE_CHARDEV_WIN) void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open); int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp); diff --git a/include/chardev/spice.h b/include/chardev/spice.h index 5bccc47392..99f26aedde 100644 --- a/include/chardev/spice.h +++ b/include/chardev/spice.h @@ -21,7 +21,8 @@ typedef struct SpiceChardev SpiceChardev; #define TYPE_CHARDEV_SPICEVMC "chardev-spicevmc" #define TYPE_CHARDEV_SPICEPORT "chardev-spiceport" -#define SPICE_CHARDEV(obj) OBJECT_CHECK(SpiceChardev, (obj), TYPE_CHARDEV_SPICE) +DECLARE_INSTANCE_CHECKER(SpiceChardev, SPICE_CHARDEV, + TYPE_CHARDEV_SPICE) void qemu_chr_open_spice_port(Chardev *chr, ChardevBackend *backend, bool *be_opened, Error **errp); diff --git a/include/crypto/secret.h b/include/crypto/secret.h index 8c03971e75..5d20ae6d2f 100644 --- a/include/crypto/secret.h +++ b/include/crypto/secret.h @@ -27,8 +27,8 @@ #define TYPE_QCRYPTO_SECRET "secret" typedef struct QCryptoSecret QCryptoSecret; -#define QCRYPTO_SECRET(obj) \ - OBJECT_CHECK(QCryptoSecret, (obj), TYPE_QCRYPTO_SECRET) +DECLARE_INSTANCE_CHECKER(QCryptoSecret, QCRYPTO_SECRET, + TYPE_QCRYPTO_SECRET) typedef struct QCryptoSecretClass QCryptoSecretClass; diff --git a/include/crypto/secret_common.h b/include/crypto/secret_common.h index db282a3872..dd3310ea5f 100644 --- a/include/crypto/secret_common.h +++ b/include/crypto/secret_common.h @@ -27,14 +27,8 @@ #define TYPE_QCRYPTO_SECRET_COMMON "secret_common" typedef struct QCryptoSecretCommon QCryptoSecretCommon; typedef struct QCryptoSecretCommonClass QCryptoSecretCommonClass; -#define QCRYPTO_SECRET_COMMON(obj) \ - OBJECT_CHECK(QCryptoSecretCommon, (obj), TYPE_QCRYPTO_SECRET_COMMON) -#define QCRYPTO_SECRET_COMMON_CLASS(class) \ - OBJECT_CLASS_CHECK(QCryptoSecretCommonClass, \ - (class), TYPE_QCRYPTO_SECRET_COMMON) -#define QCRYPTO_SECRET_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QCryptoSecretCommonClass, \ - (obj), TYPE_QCRYPTO_SECRET_COMMON) +DECLARE_OBJ_CHECKERS(QCryptoSecretCommon, QCryptoSecretCommonClass, + QCRYPTO_SECRET_COMMON, TYPE_QCRYPTO_SECRET_COMMON) struct QCryptoSecretCommon { diff --git a/include/crypto/secret_keyring.h b/include/crypto/secret_keyring.h index 8b3b8ee67d..9875f4cbf3 100644 --- a/include/crypto/secret_keyring.h +++ b/include/crypto/secret_keyring.h @@ -28,15 +28,8 @@ #define TYPE_QCRYPTO_SECRET_KEYRING "secret_keyring" typedef struct QCryptoSecretKeyring QCryptoSecretKeyring; typedef struct QCryptoSecretKeyringClass QCryptoSecretKeyringClass; -#define QCRYPTO_SECRET_KEYRING(obj) \ - OBJECT_CHECK(QCryptoSecretKeyring, (obj), \ - TYPE_QCRYPTO_SECRET_KEYRING) -#define QCRYPTO_SECRET_KEYRING_CLASS(class) \ - OBJECT_CLASS_CHECK(QCryptoSecretKeyringClass, \ - (class), TYPE_QCRYPTO_SECRET_KEYRING) -#define QCRYPTO_SECRET_KEYRING_GET_CLASS(class) \ - OBJECT_GET_CLASS(QCryptoSecretKeyringClass, \ - (class), TYPE_QCRYPTO_SECRET_KEYRING) +DECLARE_OBJ_CHECKERS(QCryptoSecretKeyring, QCryptoSecretKeyringClass, + QCRYPTO_SECRET_KEYRING, TYPE_QCRYPTO_SECRET_KEYRING) struct QCryptoSecretKeyring { diff --git a/include/crypto/tls-cipher-suites.h b/include/crypto/tls-cipher-suites.h index 23f031953f..bb9ee53e03 100644 --- a/include/crypto/tls-cipher-suites.h +++ b/include/crypto/tls-cipher-suites.h @@ -16,8 +16,8 @@ #define TYPE_QCRYPTO_TLS_CIPHER_SUITES "tls-cipher-suites" typedef struct QCryptoTLSCipherSuites QCryptoTLSCipherSuites; -#define QCRYPTO_TLS_CIPHER_SUITES(obj) \ - OBJECT_CHECK(QCryptoTLSCipherSuites, (obj), TYPE_QCRYPTO_TLS_CIPHER_SUITES) +DECLARE_INSTANCE_CHECKER(QCryptoTLSCipherSuites, QCRYPTO_TLS_CIPHER_SUITES, + TYPE_QCRYPTO_TLS_CIPHER_SUITES) struct QCryptoTLSCipherSuites { /* */ diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h index 9f065a4def..079e376047 100644 --- a/include/crypto/tlscreds.h +++ b/include/crypto/tlscreds.h @@ -30,8 +30,8 @@ #define TYPE_QCRYPTO_TLS_CREDS "tls-creds" typedef struct QCryptoTLSCreds QCryptoTLSCreds; -#define QCRYPTO_TLS_CREDS(obj) \ - OBJECT_CHECK(QCryptoTLSCreds, (obj), TYPE_QCRYPTO_TLS_CREDS) +DECLARE_INSTANCE_CHECKER(QCryptoTLSCreds, QCRYPTO_TLS_CREDS, + TYPE_QCRYPTO_TLS_CREDS) typedef struct QCryptoTLSCredsClass QCryptoTLSCredsClass; diff --git a/include/crypto/tlscredsanon.h b/include/crypto/tlscredsanon.h index 034ebd3fd9..3f464a3809 100644 --- a/include/crypto/tlscredsanon.h +++ b/include/crypto/tlscredsanon.h @@ -26,8 +26,8 @@ #define TYPE_QCRYPTO_TLS_CREDS_ANON "tls-creds-anon" typedef struct QCryptoTLSCredsAnon QCryptoTLSCredsAnon; -#define QCRYPTO_TLS_CREDS_ANON(obj) \ - OBJECT_CHECK(QCryptoTLSCredsAnon, (obj), TYPE_QCRYPTO_TLS_CREDS_ANON) +DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsAnon, QCRYPTO_TLS_CREDS_ANON, + TYPE_QCRYPTO_TLS_CREDS_ANON) typedef struct QCryptoTLSCredsAnonClass QCryptoTLSCredsAnonClass; diff --git a/include/crypto/tlscredspsk.h b/include/crypto/tlscredspsk.h index 6e361366eb..d7e6bdb5ed 100644 --- a/include/crypto/tlscredspsk.h +++ b/include/crypto/tlscredspsk.h @@ -26,8 +26,8 @@ #define TYPE_QCRYPTO_TLS_CREDS_PSK "tls-creds-psk" typedef struct QCryptoTLSCredsPSK QCryptoTLSCredsPSK; -#define QCRYPTO_TLS_CREDS_PSK(obj) \ - OBJECT_CHECK(QCryptoTLSCredsPSK, (obj), TYPE_QCRYPTO_TLS_CREDS_PSK) +DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsPSK, QCRYPTO_TLS_CREDS_PSK, + TYPE_QCRYPTO_TLS_CREDS_PSK) typedef struct QCryptoTLSCredsPSKClass QCryptoTLSCredsPSKClass; diff --git a/include/crypto/tlscredsx509.h b/include/crypto/tlscredsx509.h index e4d44ea22d..c6d89b7881 100644 --- a/include/crypto/tlscredsx509.h +++ b/include/crypto/tlscredsx509.h @@ -26,8 +26,8 @@ #define TYPE_QCRYPTO_TLS_CREDS_X509 "tls-creds-x509" typedef struct QCryptoTLSCredsX509 QCryptoTLSCredsX509; -#define QCRYPTO_TLS_CREDS_X509(obj) \ - OBJECT_CHECK(QCryptoTLSCredsX509, (obj), TYPE_QCRYPTO_TLS_CREDS_X509) +DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsX509, QCRYPTO_TLS_CREDS_X509, + TYPE_QCRYPTO_TLS_CREDS_X509) typedef struct QCryptoTLSCredsX509Class QCryptoTLSCredsX509Class; diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h index 4ef44d6fe8..9adf1e4706 100644 --- a/include/hw/acpi/acpi_dev_interface.h +++ b/include/hw/acpi/acpi_dev_interface.h @@ -19,12 +19,8 @@ typedef enum { #define TYPE_ACPI_DEVICE_IF "acpi-device-interface" typedef struct AcpiDeviceIfClass AcpiDeviceIfClass; -#define ACPI_DEVICE_IF_CLASS(klass) \ - OBJECT_CLASS_CHECK(AcpiDeviceIfClass, (klass), \ - TYPE_ACPI_DEVICE_IF) -#define ACPI_DEVICE_IF_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AcpiDeviceIfClass, (obj), \ - TYPE_ACPI_DEVICE_IF) +DECLARE_CLASS_CHECKERS(AcpiDeviceIfClass, ACPI_DEVICE_IF, + TYPE_ACPI_DEVICE_IF) #define ACPI_DEVICE_IF(obj) \ INTERFACE_CHECK(AcpiDeviceIf, (obj), \ TYPE_ACPI_DEVICE_IF) diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h index 2208f0b939..1be05a3c0f 100644 --- a/include/hw/acpi/generic_event_device.h +++ b/include/hw/acpi/generic_event_device.h @@ -68,8 +68,8 @@ #define TYPE_ACPI_GED "acpi-ged" typedef struct AcpiGedState AcpiGedState; -#define ACPI_GED(obj) \ - OBJECT_CHECK(AcpiGedState, (obj), TYPE_ACPI_GED) +DECLARE_INSTANCE_CHECKER(AcpiGedState, ACPI_GED, + TYPE_ACPI_GED) #define ACPI_GED_EVT_SEL_OFFSET 0x0 #define ACPI_GED_EVT_SEL_LEN 0x4 diff --git a/include/hw/acpi/vmgenid.h b/include/hw/acpi/vmgenid.h index 0286fc0f09..86cd1da605 100644 --- a/include/hw/acpi/vmgenid.h +++ b/include/hw/acpi/vmgenid.h @@ -17,7 +17,8 @@ */ typedef struct VmGenIdState VmGenIdState; -#define VMGENID(obj) OBJECT_CHECK(VmGenIdState, (obj), VMGENID_DEVICE) +DECLARE_INSTANCE_CHECKER(VmGenIdState, VMGENID, + VMGENID_DEVICE) struct VmGenIdState { DeviceClass parent_obj; diff --git a/include/hw/adc/stm32f2xx_adc.h b/include/hw/adc/stm32f2xx_adc.h index 60d4b65570..6a4f8e955b 100644 --- a/include/hw/adc/stm32f2xx_adc.h +++ b/include/hw/adc/stm32f2xx_adc.h @@ -60,8 +60,8 @@ #define TYPE_STM32F2XX_ADC "stm32f2xx-adc" typedef struct STM32F2XXADCState STM32F2XXADCState; -#define STM32F2XX_ADC(obj) \ - OBJECT_CHECK(STM32F2XXADCState, (obj), TYPE_STM32F2XX_ADC) +DECLARE_INSTANCE_CHECKER(STM32F2XXADCState, STM32F2XX_ADC, + TYPE_STM32F2XX_ADC) struct STM32F2XXADCState { /* */ diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h index 631454f1c7..d13b6cf50f 100644 --- a/include/hw/arm/allwinner-a10.h +++ b/include/hw/arm/allwinner-a10.h @@ -23,7 +23,8 @@ #define TYPE_AW_A10 "allwinner-a10" typedef struct AwA10State AwA10State; -#define AW_A10(obj) OBJECT_CHECK(AwA10State, (obj), TYPE_AW_A10) +DECLARE_INSTANCE_CHECKER(AwA10State, AW_A10, + TYPE_AW_A10) struct AwA10State { /*< private >*/ diff --git a/include/hw/arm/allwinner-h3.h b/include/hw/arm/allwinner-h3.h index 5fda95066f..a93e019521 100644 --- a/include/hw/arm/allwinner-h3.h +++ b/include/hw/arm/allwinner-h3.h @@ -107,7 +107,8 @@ enum { /** Convert input object to Allwinner H3 state object */ typedef struct AwH3State AwH3State; -#define AW_H3(obj) OBJECT_CHECK(AwH3State, (obj), TYPE_AW_H3) +DECLARE_INSTANCE_CHECKER(AwH3State, AW_H3, + TYPE_AW_H3) /** @} */ diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h index c820d32ad5..dcb891d9cc 100644 --- a/include/hw/arm/armv7m.h +++ b/include/hw/arm/armv7m.h @@ -17,7 +17,8 @@ #define TYPE_BITBAND "ARM,bitband-memory" typedef struct BitBandState BitBandState; -#define BITBAND(obj) OBJECT_CHECK(BitBandState, (obj), TYPE_BITBAND) +DECLARE_INSTANCE_CHECKER(BitBandState, BITBAND, + TYPE_BITBAND) struct BitBandState { /*< private >*/ @@ -32,7 +33,8 @@ struct BitBandState { #define TYPE_ARMV7M "armv7m" typedef struct ARMv7MState ARMv7MState; -#define ARMV7M(obj) OBJECT_CHECK(ARMv7MState, (obj), TYPE_ARMV7M) +DECLARE_INSTANCE_CHECKER(ARMv7MState, ARMV7M, + TYPE_ARMV7M) #define ARMV7M_NUM_BITBANDS 2 diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index 4e5ec37acb..c9747b15fc 100644 --- a/include/hw/arm/aspeed.h +++ b/include/hw/arm/aspeed.h @@ -16,18 +16,14 @@ typedef struct AspeedMachineState AspeedMachineState; #define TYPE_ASPEED_MACHINE MACHINE_TYPE_NAME("aspeed") typedef struct AspeedMachineClass AspeedMachineClass; -#define ASPEED_MACHINE(obj) \ - OBJECT_CHECK(AspeedMachineState, (obj), TYPE_ASPEED_MACHINE) +DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass, + ASPEED_MACHINE, TYPE_ASPEED_MACHINE) #define ASPEED_MAC0_ON (1 << 0) #define ASPEED_MAC1_ON (1 << 1) #define ASPEED_MAC2_ON (1 << 2) #define ASPEED_MAC3_ON (1 << 3) -#define ASPEED_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedMachineClass, (klass), TYPE_ASPEED_MACHINE) -#define ASPEED_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedMachineClass, (obj), TYPE_ASPEED_MACHINE) struct AspeedMachineClass { MachineClass parent_obj; diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 31679ee42e..05c7d53df3 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -66,7 +66,8 @@ typedef struct AspeedSoCState AspeedSoCState; #define TYPE_ASPEED_SOC "aspeed-soc" typedef struct AspeedSoCClass AspeedSoCClass; -#define ASPEED_SOC(obj) OBJECT_CHECK(AspeedSoCState, (obj), TYPE_ASPEED_SOC) +DECLARE_OBJ_CHECKERS(AspeedSoCState, AspeedSoCClass, + ASPEED_SOC, TYPE_ASPEED_SOC) struct AspeedSoCClass { DeviceClass parent_class; @@ -84,10 +85,6 @@ struct AspeedSoCClass { uint32_t num_cpus; }; -#define ASPEED_SOC_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedSoCClass, (klass), TYPE_ASPEED_SOC) -#define ASPEED_SOC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedSoCClass, (obj), TYPE_ASPEED_SOC) enum { ASPEED_DEV_IOMEM, diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h index 67f5a5f8f5..b4d3ae121a 100644 --- a/include/hw/arm/bcm2835_peripherals.h +++ b/include/hw/arm/bcm2835_peripherals.h @@ -33,8 +33,8 @@ #define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals" typedef struct BCM2835PeripheralState BCM2835PeripheralState; -#define BCM2835_PERIPHERALS(obj) \ - OBJECT_CHECK(BCM2835PeripheralState, (obj), TYPE_BCM2835_PERIPHERALS) +DECLARE_INSTANCE_CHECKER(BCM2835PeripheralState, BCM2835_PERIPHERALS, + TYPE_BCM2835_PERIPHERALS) struct BCM2835PeripheralState { /*< private >*/ diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h index cf22dc96a0..181d9563d0 100644 --- a/include/hw/arm/bcm2836.h +++ b/include/hw/arm/bcm2836.h @@ -20,7 +20,8 @@ #define TYPE_BCM283X "bcm283x" typedef struct BCM283XClass BCM283XClass; typedef struct BCM283XState BCM283XState; -#define BCM283X(obj) OBJECT_CHECK(BCM283XState, (obj), TYPE_BCM283X) +DECLARE_OBJ_CHECKERS(BCM283XState, BCM283XClass, + BCM283X, TYPE_BCM283X) #define BCM283X_NCPUS 4 @@ -52,9 +53,5 @@ struct BCM283XClass { const BCM283XInfo *info; }; -#define BCM283X_CLASS(klass) \ - OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X) -#define BCM283X_GET_CLASS(obj) \ - OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X) #endif /* BCM2836_H */ diff --git a/include/hw/arm/digic.h b/include/hw/arm/digic.h index f77833f6e3..f3ba398914 100644 --- a/include/hw/arm/digic.h +++ b/include/hw/arm/digic.h @@ -26,7 +26,8 @@ #define TYPE_DIGIC "digic" typedef struct DigicState DigicState; -#define DIGIC(obj) OBJECT_CHECK(DigicState, (obj), TYPE_DIGIC) +DECLARE_INSTANCE_CHECKER(DigicState, DIGIC, + TYPE_DIGIC) #define DIGIC4_NB_TIMERS 3 diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index 114c594cd2..c2de1dc102 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -106,8 +106,8 @@ struct Exynos4210State { typedef struct Exynos4210State Exynos4210State; #define TYPE_EXYNOS4210_SOC "exynos4210" -#define EXYNOS4210_SOC(obj) \ - OBJECT_CHECK(Exynos4210State, obj, TYPE_EXYNOS4210_SOC) +DECLARE_INSTANCE_CHECKER(Exynos4210State, EXYNOS4210_SOC, + TYPE_EXYNOS4210_SOC) void exynos4210_write_secondary(ARMCPU *cpu, const struct arm_boot_info *info); diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h index 8b4c974f09..e239505724 100644 --- a/include/hw/arm/fsl-imx25.h +++ b/include/hw/arm/fsl-imx25.h @@ -36,7 +36,8 @@ #define TYPE_FSL_IMX25 "fsl,imx25" typedef struct FslIMX25State FslIMX25State; -#define FSL_IMX25(obj) OBJECT_CHECK(FslIMX25State, (obj), TYPE_FSL_IMX25) +DECLARE_INSTANCE_CHECKER(FslIMX25State, FSL_IMX25, + TYPE_FSL_IMX25) #define FSL_IMX25_NUM_UARTS 5 #define FSL_IMX25_NUM_GPTS 4 diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h index 12368f2c8f..64b4ca07b7 100644 --- a/include/hw/arm/fsl-imx31.h +++ b/include/hw/arm/fsl-imx31.h @@ -32,7 +32,8 @@ #define TYPE_FSL_IMX31 "fsl,imx31" typedef struct FslIMX31State FslIMX31State; -#define FSL_IMX31(obj) OBJECT_CHECK(FslIMX31State, (obj), TYPE_FSL_IMX31) +DECLARE_INSTANCE_CHECKER(FslIMX31State, FSL_IMX31, + TYPE_FSL_IMX31) #define FSL_IMX31_NUM_UARTS 2 #define FSL_IMX31_NUM_EPITS 2 diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h index e66ea1e917..602b9aff36 100644 --- a/include/hw/arm/fsl-imx6.h +++ b/include/hw/arm/fsl-imx6.h @@ -38,7 +38,8 @@ #define TYPE_FSL_IMX6 "fsl,imx6" typedef struct FslIMX6State FslIMX6State; -#define FSL_IMX6(obj) OBJECT_CHECK(FslIMX6State, (obj), TYPE_FSL_IMX6) +DECLARE_INSTANCE_CHECKER(FslIMX6State, FSL_IMX6, + TYPE_FSL_IMX6) #define FSL_IMX6_NUM_CPUS 4 #define FSL_IMX6_NUM_UARTS 5 diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h index e95c4820c6..e4862fdb2c 100644 --- a/include/hw/arm/fsl-imx6ul.h +++ b/include/hw/arm/fsl-imx6ul.h @@ -42,7 +42,8 @@ #define TYPE_FSL_IMX6UL "fsl,imx6ul" typedef struct FslIMX6ULState FslIMX6ULState; -#define FSL_IMX6UL(obj) OBJECT_CHECK(FslIMX6ULState, (obj), TYPE_FSL_IMX6UL) +DECLARE_INSTANCE_CHECKER(FslIMX6ULState, FSL_IMX6UL, + TYPE_FSL_IMX6UL) enum FslIMX6ULConfiguration { FSL_IMX6UL_NUM_CPUS = 1, diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h index 8095e5544b..434d1d0641 100644 --- a/include/hw/arm/fsl-imx7.h +++ b/include/hw/arm/fsl-imx7.h @@ -43,7 +43,8 @@ #define TYPE_FSL_IMX7 "fsl,imx7" typedef struct FslIMX7State FslIMX7State; -#define FSL_IMX7(obj) OBJECT_CHECK(FslIMX7State, (obj), TYPE_FSL_IMX7) +DECLARE_INSTANCE_CHECKER(FslIMX7State, FSL_IMX7, + TYPE_FSL_IMX7) enum FslIMX7Configuration { FSL_IMX7_NUM_CPUS = 2, diff --git a/include/hw/arm/linux-boot-if.h b/include/hw/arm/linux-boot-if.h index 6d9e13fd36..c85f33b2c5 100644 --- a/include/hw/arm/linux-boot-if.h +++ b/include/hw/arm/linux-boot-if.h @@ -10,10 +10,8 @@ #define TYPE_ARM_LINUX_BOOT_IF "arm-linux-boot-if" typedef struct ARMLinuxBootIfClass ARMLinuxBootIfClass; -#define ARM_LINUX_BOOT_IF_CLASS(klass) \ - OBJECT_CLASS_CHECK(ARMLinuxBootIfClass, (klass), TYPE_ARM_LINUX_BOOT_IF) -#define ARM_LINUX_BOOT_IF_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ARMLinuxBootIfClass, (obj), TYPE_ARM_LINUX_BOOT_IF) +DECLARE_CLASS_CHECKERS(ARMLinuxBootIfClass, ARM_LINUX_BOOT_IF, + TYPE_ARM_LINUX_BOOT_IF) #define ARM_LINUX_BOOT_IF(obj) \ INTERFACE_CHECK(ARMLinuxBootIf, (obj), TYPE_ARM_LINUX_BOOT_IF) diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h index b4bc5ef96a..9b93d0d64e 100644 --- a/include/hw/arm/msf2-soc.h +++ b/include/hw/arm/msf2-soc.h @@ -34,7 +34,8 @@ #define TYPE_MSF2_SOC "msf2-soc" typedef struct MSF2State MSF2State; -#define MSF2_SOC(obj) OBJECT_CHECK(MSF2State, (obj), TYPE_MSF2_SOC) +DECLARE_INSTANCE_CHECKER(MSF2State, MSF2_SOC, + TYPE_MSF2_SOC) #define MSF2_NUM_SPIS 2 #define MSF2_NUM_UARTS 2 diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h index 727ac1ae04..b69492b29d 100644 --- a/include/hw/arm/nrf51_soc.h +++ b/include/hw/arm/nrf51_soc.h @@ -21,8 +21,8 @@ #define TYPE_NRF51_SOC "nrf51-soc" typedef struct NRF51State NRF51State; -#define NRF51_SOC(obj) \ - OBJECT_CHECK(NRF51State, (obj), TYPE_NRF51_SOC) +DECLARE_INSTANCE_CHECKER(NRF51State, NRF51_SOC, + TYPE_NRF51_SOC) #define NRF51_NUM_TIMERS 3 diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h index 0d365edeec..5eb51df8e9 100644 --- a/include/hw/arm/omap.h +++ b/include/hw/arm/omap.h @@ -71,8 +71,8 @@ void omap_clk_reparent(omap_clk clk, omap_clk parent); /* omap_intc.c */ #define TYPE_OMAP_INTC "common-omap-intc" typedef struct omap_intr_handler_s omap_intr_handler; -#define OMAP_INTC(obj) \ - OBJECT_CHECK(omap_intr_handler, (obj), TYPE_OMAP_INTC) +DECLARE_INSTANCE_CHECKER(omap_intr_handler, OMAP_INTC, + TYPE_OMAP_INTC) /* @@ -95,7 +95,8 @@ void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk); /* omap_i2c.c */ #define TYPE_OMAP_I2C "omap_i2c" typedef struct OMAPI2CState OMAPI2CState; -#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C) +DECLARE_INSTANCE_CHECKER(OMAPI2CState, OMAP_I2C, + TYPE_OMAP_I2C) /* TODO: clock framework (see above) */ diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h index 832f216e1e..aa8c5e80df 100644 --- a/include/hw/arm/smmu-common.h +++ b/include/hw/arm/smmu-common.h @@ -123,11 +123,8 @@ struct SMMUBaseClass { typedef struct SMMUBaseClass SMMUBaseClass; #define TYPE_ARM_SMMU "arm-smmu" -#define ARM_SMMU(obj) OBJECT_CHECK(SMMUState, (obj), TYPE_ARM_SMMU) -#define ARM_SMMU_CLASS(klass) \ - OBJECT_CLASS_CHECK(SMMUBaseClass, (klass), TYPE_ARM_SMMU) -#define ARM_SMMU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SMMUBaseClass, (obj), TYPE_ARM_SMMU) +DECLARE_OBJ_CHECKERS(SMMUState, SMMUBaseClass, + ARM_SMMU, TYPE_ARM_SMMU) /* Return the SMMUPciBus handle associated to a PCI bus number */ SMMUPciBus *smmu_find_smmu_pcibus(SMMUState *s, uint8_t bus_num); diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h index 905a501044..c75e52f2d7 100644 --- a/include/hw/arm/smmuv3.h +++ b/include/hw/arm/smmuv3.h @@ -82,10 +82,7 @@ struct SMMUv3Class { typedef struct SMMUv3Class SMMUv3Class; #define TYPE_ARM_SMMUV3 "arm-smmuv3" -#define ARM_SMMUV3(obj) OBJECT_CHECK(SMMUv3State, (obj), TYPE_ARM_SMMUV3) -#define ARM_SMMUV3_CLASS(klass) \ - OBJECT_CLASS_CHECK(SMMUv3Class, (klass), TYPE_ARM_SMMUV3) -#define ARM_SMMUV3_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SMMUv3Class, (obj), TYPE_ARM_SMMUV3) +DECLARE_OBJ_CHECKERS(SMMUv3State, SMMUv3Class, + ARM_SMMUV3, TYPE_ARM_SMMUV3) #endif diff --git a/include/hw/arm/stm32f205_soc.h b/include/hw/arm/stm32f205_soc.h index 6d86937e07..9c2f4818a6 100644 --- a/include/hw/arm/stm32f205_soc.h +++ b/include/hw/arm/stm32f205_soc.h @@ -36,8 +36,8 @@ #define TYPE_STM32F205_SOC "stm32f205-soc" typedef struct STM32F205State STM32F205State; -#define STM32F205_SOC(obj) \ - OBJECT_CHECK(STM32F205State, (obj), TYPE_STM32F205_SOC) +DECLARE_INSTANCE_CHECKER(STM32F205State, STM32F205_SOC, + TYPE_STM32F205_SOC) #define STM_NUM_USARTS 6 #define STM_NUM_TIMERS 4 diff --git a/include/hw/arm/stm32f405_soc.h b/include/hw/arm/stm32f405_soc.h index 8f44fb2046..f1a22763f4 100644 --- a/include/hw/arm/stm32f405_soc.h +++ b/include/hw/arm/stm32f405_soc.h @@ -37,8 +37,8 @@ #define TYPE_STM32F405_SOC "stm32f405-soc" typedef struct STM32F405State STM32F405State; -#define STM32F405_SOC(obj) \ - OBJECT_CHECK(STM32F405State, (obj), TYPE_STM32F405_SOC) +DECLARE_INSTANCE_CHECKER(STM32F405State, STM32F405_SOC, + TYPE_STM32F405_SOC) #define STM_NUM_USARTS 7 #define STM_NUM_TIMERS 4 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 49ad860943..392b0bd571 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -170,12 +170,8 @@ typedef struct VirtMachineState VirtMachineState; #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM) #define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt") -#define VIRT_MACHINE(obj) \ - OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE) -#define VIRT_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_VIRT_MACHINE) -#define VIRT_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE) +DECLARE_OBJ_CHECKERS(VirtMachineState, VirtMachineClass, + VIRT_MACHINE, TYPE_VIRT_MACHINE) void virt_acpi_setup(VirtMachineState *vms); bool virt_is_acpi_enabled(VirtMachineState *vms); diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index a960619ec9..eaa9023fd6 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -24,7 +24,8 @@ #define TYPE_XLNX_VERSAL "xlnx-versal" typedef struct Versal Versal; -#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL) +DECLARE_INSTANCE_CHECKER(Versal, XLNX_VERSAL, + TYPE_XLNX_VERSAL) #define XLNX_VERSAL_NR_ACPUS 2 #define XLNX_VERSAL_NR_UARTS 2 diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h index 6a24216abf..4cc97b4610 100644 --- a/include/hw/arm/xlnx-zynqmp.h +++ b/include/hw/arm/xlnx-zynqmp.h @@ -36,8 +36,8 @@ #define TYPE_XLNX_ZYNQMP "xlnx,zynqmp" typedef struct XlnxZynqMPState XlnxZynqMPState; -#define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \ - TYPE_XLNX_ZYNQMP) +DECLARE_INSTANCE_CHECKER(XlnxZynqMPState, XLNX_ZYNQMP, + TYPE_XLNX_ZYNQMP) #define XLNX_ZYNQMP_NUM_APU_CPUS 4 #define XLNX_ZYNQMP_NUM_RPU_CPUS 2 diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index 9b2fa7e92c..3e26303705 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -10,8 +10,8 @@ #define TYPE_PFLASH_CFI01 "cfi.pflash01" typedef struct PFlashCFI01 PFlashCFI01; -#define PFLASH_CFI01(obj) \ - OBJECT_CHECK(PFlashCFI01, (obj), TYPE_PFLASH_CFI01) +DECLARE_INSTANCE_CHECKER(PFlashCFI01, PFLASH_CFI01, + TYPE_PFLASH_CFI01) PFlashCFI01 *pflash_cfi01_register(hwaddr base, @@ -31,8 +31,8 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *dev, DriveInfo *dinfo); #define TYPE_PFLASH_CFI02 "cfi.pflash02" typedef struct PFlashCFI02 PFlashCFI02; -#define PFLASH_CFI02(obj) \ - OBJECT_CHECK(PFlashCFI02, (obj), TYPE_PFLASH_CFI02) +DECLARE_INSTANCE_CHECKER(PFlashCFI02, PFLASH_CFI02, + TYPE_PFLASH_CFI02) PFlashCFI02 *pflash_cfi02_register(hwaddr base, diff --git a/include/hw/block/swim.h b/include/hw/block/swim.h index 6eab9cf208..08f9a38005 100644 --- a/include/hw/block/swim.h +++ b/include/hw/block/swim.h @@ -22,7 +22,8 @@ typedef struct SWIMBus SWIMBus; typedef struct SWIMCtrl SWIMCtrl; #define TYPE_SWIM_DRIVE "swim-drive" -#define SWIM_DRIVE(obj) OBJECT_CHECK(SWIMDrive, (obj), TYPE_SWIM_DRIVE) +DECLARE_INSTANCE_CHECKER(SWIMDrive, SWIM_DRIVE, + TYPE_SWIM_DRIVE) struct SWIMDrive { DeviceState qdev; @@ -31,7 +32,8 @@ struct SWIMDrive { }; #define TYPE_SWIM_BUS "swim-bus" -#define SWIM_BUS(obj) OBJECT_CHECK(SWIMBus, (obj), TYPE_SWIM_BUS) +DECLARE_INSTANCE_CHECKER(SWIMBus, SWIM_BUS, + TYPE_SWIM_BUS) struct SWIMBus { BusState bus; diff --git a/include/hw/char/avr_usart.h b/include/hw/char/avr_usart.h index 67ad345edd..5202f152b0 100644 --- a/include/hw/char/avr_usart.h +++ b/include/hw/char/avr_usart.h @@ -59,8 +59,8 @@ #define TYPE_AVR_USART "avr-usart" typedef struct AVRUsartState AVRUsartState; -#define AVR_USART(obj) \ - OBJECT_CHECK(AVRUsartState, (obj), TYPE_AVR_USART) +DECLARE_INSTANCE_CHECKER(AVRUsartState, AVR_USART, + TYPE_AVR_USART) struct AVRUsartState { /* */ diff --git a/include/hw/char/bcm2835_aux.h b/include/hw/char/bcm2835_aux.h index 2647becc52..a08795c47f 100644 --- a/include/hw/char/bcm2835_aux.h +++ b/include/hw/char/bcm2835_aux.h @@ -15,7 +15,8 @@ #define TYPE_BCM2835_AUX "bcm2835-aux" typedef struct BCM2835AuxState BCM2835AuxState; -#define BCM2835_AUX(obj) OBJECT_CHECK(BCM2835AuxState, (obj), TYPE_BCM2835_AUX) +DECLARE_INSTANCE_CHECKER(BCM2835AuxState, BCM2835_AUX, + TYPE_BCM2835_AUX) #define BCM2835_AUX_RX_FIFO_LEN 8 diff --git a/include/hw/char/cadence_uart.h b/include/hw/char/cadence_uart.h index 3918ee8136..b89245a29d 100644 --- a/include/hw/char/cadence_uart.h +++ b/include/hw/char/cadence_uart.h @@ -33,8 +33,8 @@ #define TYPE_CADENCE_UART "cadence_uart" typedef struct CadenceUARTState CadenceUARTState; -#define CADENCE_UART(obj) OBJECT_CHECK(CadenceUARTState, (obj), \ - TYPE_CADENCE_UART) +DECLARE_INSTANCE_CHECKER(CadenceUARTState, CADENCE_UART, + TYPE_CADENCE_UART) struct CadenceUARTState { /*< private >*/ diff --git a/include/hw/char/cmsdk-apb-uart.h b/include/hw/char/cmsdk-apb-uart.h index 32c0df9df3..2c3869aa16 100644 --- a/include/hw/char/cmsdk-apb-uart.h +++ b/include/hw/char/cmsdk-apb-uart.h @@ -19,8 +19,8 @@ #define TYPE_CMSDK_APB_UART "cmsdk-apb-uart" typedef struct CMSDKAPBUART CMSDKAPBUART; -#define CMSDK_APB_UART(obj) OBJECT_CHECK(CMSDKAPBUART, (obj), \ - TYPE_CMSDK_APB_UART) +DECLARE_INSTANCE_CHECKER(CMSDKAPBUART, CMSDK_APB_UART, + TYPE_CMSDK_APB_UART) struct CMSDKAPBUART { /*< private >*/ diff --git a/include/hw/char/digic-uart.h b/include/hw/char/digic-uart.h index 7c6ec2a5c5..01d406833d 100644 --- a/include/hw/char/digic-uart.h +++ b/include/hw/char/digic-uart.h @@ -24,8 +24,8 @@ #define TYPE_DIGIC_UART "digic-uart" typedef struct DigicUartState DigicUartState; -#define DIGIC_UART(obj) \ - OBJECT_CHECK(DigicUartState, (obj), TYPE_DIGIC_UART) +DECLARE_INSTANCE_CHECKER(DigicUartState, DIGIC_UART, + TYPE_DIGIC_UART) enum { R_TX = 0x00, diff --git a/include/hw/char/escc.h b/include/hw/char/escc.h index 5de2a39e77..5eaec507da 100644 --- a/include/hw/char/escc.h +++ b/include/hw/char/escc.h @@ -12,7 +12,8 @@ #define ESCC_SIZE 4 typedef struct ESCCState ESCCState; -#define ESCC(obj) OBJECT_CHECK(ESCCState, (obj), TYPE_ESCC) +DECLARE_INSTANCE_CHECKER(ESCCState, ESCC, + TYPE_ESCC) typedef enum { escc_chn_a, escc_chn_b, diff --git a/include/hw/char/ibex_uart.h b/include/hw/char/ibex_uart.h index ec9fcde8f0..36eb75fc4c 100644 --- a/include/hw/char/ibex_uart.h +++ b/include/hw/char/ibex_uart.h @@ -71,8 +71,8 @@ REG32(TIMEOUT_CTRL, 0x2c) #define TYPE_IBEX_UART "ibex-uart" typedef struct IbexUartState IbexUartState; -#define IBEX_UART(obj) \ - OBJECT_CHECK(IbexUartState, (obj), TYPE_IBEX_UART) +DECLARE_INSTANCE_CHECKER(IbexUartState, IBEX_UART, + TYPE_IBEX_UART) struct IbexUartState { /* */ diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h index bfaf8ec695..200f1ec33a 100644 --- a/include/hw/char/imx_serial.h +++ b/include/hw/char/imx_serial.h @@ -24,7 +24,8 @@ #define TYPE_IMX_SERIAL "imx.serial" typedef struct IMXSerialState IMXSerialState; -#define IMX_SERIAL(obj) OBJECT_CHECK(IMXSerialState, (obj), TYPE_IMX_SERIAL) +DECLARE_INSTANCE_CHECKER(IMXSerialState, IMX_SERIAL, + TYPE_IMX_SERIAL) #define URXD_CHARRDY (1<<15) /* character read is valid */ #define URXD_ERR (1<<14) /* Character has error */ diff --git a/include/hw/char/nrf51_uart.h b/include/hw/char/nrf51_uart.h index 20560ba6dc..0cf3c4e328 100644 --- a/include/hw/char/nrf51_uart.h +++ b/include/hw/char/nrf51_uart.h @@ -21,7 +21,8 @@ #define TYPE_NRF51_UART "nrf51_soc.uart" typedef struct NRF51UARTState NRF51UARTState; -#define NRF51_UART(obj) OBJECT_CHECK(NRF51UARTState, (obj), TYPE_NRF51_UART) +DECLARE_INSTANCE_CHECKER(NRF51UARTState, NRF51_UART, + TYPE_NRF51_UART) REG32(UART_STARTRX, 0x000) REG32(UART_STOPRX, 0x004) diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h index ddbd8ad45b..80de4ecde6 100644 --- a/include/hw/char/pl011.h +++ b/include/hw/char/pl011.h @@ -23,7 +23,8 @@ #define TYPE_PL011 "pl011" typedef struct PL011State PL011State; -#define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011) +DECLARE_INSTANCE_CHECKER(PL011State, PL011, + TYPE_PL011) /* This shares the same struct (and cast macro) as the base pl011 device */ #define TYPE_PL011_LUMINARY "pl011_luminary" diff --git a/include/hw/char/renesas_sci.h b/include/hw/char/renesas_sci.h index 5a5ebfd28c..a4764e3eee 100644 --- a/include/hw/char/renesas_sci.h +++ b/include/hw/char/renesas_sci.h @@ -15,7 +15,8 @@ #define TYPE_RENESAS_SCI "renesas-sci" typedef struct RSCIState RSCIState; -#define RSCI(obj) OBJECT_CHECK(RSCIState, (obj), TYPE_RENESAS_SCI) +DECLARE_INSTANCE_CHECKER(RSCIState, RSCI, + TYPE_RENESAS_SCI) enum { ERI = 0, diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index dbeef43676..264f529a7f 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -104,13 +104,16 @@ extern const MemoryRegionOps serial_io_ops; void serial_set_frequency(SerialState *s, uint32_t frequency); #define TYPE_SERIAL "serial" -#define SERIAL(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL) +DECLARE_INSTANCE_CHECKER(SerialState, SERIAL, + TYPE_SERIAL) #define TYPE_SERIAL_MM "serial-mm" -#define SERIAL_MM(s) OBJECT_CHECK(SerialMM, (s), TYPE_SERIAL_MM) +DECLARE_INSTANCE_CHECKER(SerialMM, SERIAL_MM, + TYPE_SERIAL_MM) #define TYPE_SERIAL_IO "serial-io" -#define SERIAL_IO(s) OBJECT_CHECK(SerialIO, (s), TYPE_SERIAL_IO) +DECLARE_INSTANCE_CHECKER(SerialIO, SERIAL_IO, + TYPE_SERIAL_IO) SerialMM *serial_mm_init(MemoryRegion *address_space, hwaddr base, int regshift, diff --git a/include/hw/char/stm32f2xx_usart.h b/include/hw/char/stm32f2xx_usart.h index c44faca751..1670c076d4 100644 --- a/include/hw/char/stm32f2xx_usart.h +++ b/include/hw/char/stm32f2xx_usart.h @@ -55,8 +55,8 @@ #define TYPE_STM32F2XX_USART "stm32f2xx-usart" typedef struct STM32F2XXUsartState STM32F2XXUsartState; -#define STM32F2XX_USART(obj) \ - OBJECT_CHECK(STM32F2XXUsartState, (obj), TYPE_STM32F2XX_USART) +DECLARE_INSTANCE_CHECKER(STM32F2XXUsartState, STM32F2XX_USART, + TYPE_STM32F2XX_USART) struct STM32F2XXUsartState { /* */ diff --git a/include/hw/clock.h b/include/hw/clock.h index cde89b3ef4..22a37ba1dd 100644 --- a/include/hw/clock.h +++ b/include/hw/clock.h @@ -19,7 +19,8 @@ #define TYPE_CLOCK "clock" typedef struct Clock Clock; -#define CLOCK(obj) OBJECT_CHECK(Clock, (obj), TYPE_CLOCK) +DECLARE_INSTANCE_CHECKER(Clock, CLOCK, + TYPE_CLOCK) typedef void ClockCallback(void *opaque); diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 5f319b9d22..59ff021228 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -63,8 +63,8 @@ typedef uint64_t vaddr; #define CPU(obj) ((CPUState *)(obj)) typedef struct CPUClass CPUClass; -#define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU) -#define CPU_GET_CLASS(obj) OBJECT_GET_CLASS(CPUClass, (obj), TYPE_CPU) +DECLARE_CLASS_CHECKERS(CPUClass, CPU, + TYPE_CPU) typedef enum MMUAccessType { MMU_DATA_LOAD = 0, diff --git a/include/hw/core/generic-loader.h b/include/hw/core/generic-loader.h index f435af1884..8e86532df6 100644 --- a/include/hw/core/generic-loader.h +++ b/include/hw/core/generic-loader.h @@ -43,7 +43,7 @@ struct GenericLoaderState { typedef struct GenericLoaderState GenericLoaderState; #define TYPE_GENERIC_LOADER "loader" -#define GENERIC_LOADER(obj) OBJECT_CHECK(GenericLoaderState, (obj), \ - TYPE_GENERIC_LOADER) +DECLARE_INSTANCE_CHECKER(GenericLoaderState, GENERIC_LOADER, + TYPE_GENERIC_LOADER) #endif diff --git a/include/hw/core/split-irq.h b/include/hw/core/split-irq.h index 872a39aa4f..76d42b29aa 100644 --- a/include/hw/core/split-irq.h +++ b/include/hw/core/split-irq.h @@ -44,7 +44,8 @@ typedef struct SplitIRQ SplitIRQ; -#define SPLIT_IRQ(obj) OBJECT_CHECK(SplitIRQ, (obj), TYPE_SPLIT_IRQ) +DECLARE_INSTANCE_CHECKER(SplitIRQ, SPLIT_IRQ, + TYPE_SPLIT_IRQ) struct SplitIRQ { DeviceState parent_obj; diff --git a/include/hw/cpu/a15mpcore.h b/include/hw/cpu/a15mpcore.h index 01415728d0..58d8ac7415 100644 --- a/include/hw/cpu/a15mpcore.h +++ b/include/hw/cpu/a15mpcore.h @@ -28,8 +28,8 @@ #define TYPE_A15MPCORE_PRIV "a15mpcore_priv" typedef struct A15MPPrivState A15MPPrivState; -#define A15MPCORE_PRIV(obj) \ - OBJECT_CHECK(A15MPPrivState, (obj), TYPE_A15MPCORE_PRIV) +DECLARE_INSTANCE_CHECKER(A15MPPrivState, A15MPCORE_PRIV, + TYPE_A15MPCORE_PRIV) struct A15MPPrivState { /*< private >*/ diff --git a/include/hw/cpu/a9mpcore.h b/include/hw/cpu/a9mpcore.h index 1a3b32cc4c..37e5cfce08 100644 --- a/include/hw/cpu/a9mpcore.h +++ b/include/hw/cpu/a9mpcore.h @@ -19,8 +19,8 @@ #define TYPE_A9MPCORE_PRIV "a9mpcore_priv" typedef struct A9MPPrivState A9MPPrivState; -#define A9MPCORE_PRIV(obj) \ - OBJECT_CHECK(A9MPPrivState, (obj), TYPE_A9MPCORE_PRIV) +DECLARE_INSTANCE_CHECKER(A9MPPrivState, A9MPCORE_PRIV, + TYPE_A9MPCORE_PRIV) struct A9MPPrivState { /*< private >*/ diff --git a/include/hw/cpu/arm11mpcore.h b/include/hw/cpu/arm11mpcore.h index 5a5575b86d..411d7e6659 100644 --- a/include/hw/cpu/arm11mpcore.h +++ b/include/hw/cpu/arm11mpcore.h @@ -18,8 +18,8 @@ #define TYPE_ARM11MPCORE_PRIV "arm11mpcore_priv" typedef struct ARM11MPCorePriveState ARM11MPCorePriveState; -#define ARM11MPCORE_PRIV(obj) \ - OBJECT_CHECK(ARM11MPCorePriveState, (obj), TYPE_ARM11MPCORE_PRIV) +DECLARE_INSTANCE_CHECKER(ARM11MPCorePriveState, ARM11MPCORE_PRIV, + TYPE_ARM11MPCORE_PRIV) struct ARM11MPCorePriveState { SysBusDevice parent_obj; diff --git a/include/hw/cpu/cluster.h b/include/hw/cpu/cluster.h index faacf9757e..1c807c5902 100644 --- a/include/hw/cpu/cluster.h +++ b/include/hw/cpu/cluster.h @@ -56,8 +56,8 @@ #define TYPE_CPU_CLUSTER "cpu-cluster" typedef struct CPUClusterState CPUClusterState; -#define CPU_CLUSTER(obj) \ - OBJECT_CHECK(CPUClusterState, (obj), TYPE_CPU_CLUSTER) +DECLARE_INSTANCE_CHECKER(CPUClusterState, CPU_CLUSTER, + TYPE_CPU_CLUSTER) /* * This limit is imposed by TCG, which puts the cluster ID into an diff --git a/include/hw/cpu/core.h b/include/hw/cpu/core.h index 850191527e..61ea3481f8 100644 --- a/include/hw/cpu/core.h +++ b/include/hw/cpu/core.h @@ -15,8 +15,8 @@ #define TYPE_CPU_CORE "cpu-core" typedef struct CPUCore CPUCore; -#define CPU_CORE(obj) \ - OBJECT_CHECK(CPUCore, (obj), TYPE_CPU_CORE) +DECLARE_INSTANCE_CHECKER(CPUCore, CPU_CORE, + TYPE_CPU_CORE) struct CPUCore { /*< private >*/ diff --git a/include/hw/display/bcm2835_fb.h b/include/hw/display/bcm2835_fb.h index 5fc4d74a06..226d77a264 100644 --- a/include/hw/display/bcm2835_fb.h +++ b/include/hw/display/bcm2835_fb.h @@ -18,7 +18,8 @@ #define TYPE_BCM2835_FB "bcm2835-fb" typedef struct BCM2835FBState BCM2835FBState; -#define BCM2835_FB(obj) OBJECT_CHECK(BCM2835FBState, (obj), TYPE_BCM2835_FB) +DECLARE_INSTANCE_CHECKER(BCM2835FBState, BCM2835_FB, + TYPE_BCM2835_FB) /* * Configuration information about the fb which the guest can program diff --git a/include/hw/display/dpcd.h b/include/hw/display/dpcd.h index 6b96a463a7..09304dd1f6 100644 --- a/include/hw/display/dpcd.h +++ b/include/hw/display/dpcd.h @@ -29,7 +29,8 @@ typedef struct DPCDState DPCDState; #define TYPE_DPCD "dpcd" -#define DPCD(obj) OBJECT_CHECK(DPCDState, (obj), TYPE_DPCD) +DECLARE_INSTANCE_CHECKER(DPCDState, DPCD, + TYPE_DPCD) /* DCPD Revision. */ #define DPCD_REVISION 0x00 diff --git a/include/hw/display/i2c-ddc.h b/include/hw/display/i2c-ddc.h index 8ab50641aa..fbabfea5a9 100644 --- a/include/hw/display/i2c-ddc.h +++ b/include/hw/display/i2c-ddc.h @@ -37,6 +37,7 @@ struct I2CDDCState { typedef struct I2CDDCState I2CDDCState; #define TYPE_I2CDDC "i2c-ddc" -#define I2CDDC(obj) OBJECT_CHECK(I2CDDCState, (obj), TYPE_I2CDDC) +DECLARE_INSTANCE_CHECKER(I2CDDCState, I2CDDC, + TYPE_I2CDDC) #endif /* I2C_DDC_H */ diff --git a/include/hw/display/macfb.h b/include/hw/display/macfb.h index bccfee260f..a67aec0783 100644 --- a/include/hw/display/macfb.h +++ b/include/hw/display/macfb.h @@ -33,8 +33,8 @@ typedef struct MacfbState { #define TYPE_MACFB "sysbus-macfb" typedef struct MacfbSysBusState MacfbSysBusState; -#define MACFB(obj) \ - OBJECT_CHECK(MacfbSysBusState, (obj), TYPE_MACFB) +DECLARE_INSTANCE_CHECKER(MacfbSysBusState, MACFB, + TYPE_MACFB) struct MacfbSysBusState { SysBusDevice busdev; diff --git a/include/hw/display/xlnx_dp.h b/include/hw/display/xlnx_dp.h index f76bde2e77..3b7d9e5a2a 100644 --- a/include/hw/display/xlnx_dp.h +++ b/include/hw/display/xlnx_dp.h @@ -106,6 +106,7 @@ struct XlnxDPState { typedef struct XlnxDPState XlnxDPState; #define TYPE_XLNX_DP "xlnx.v-dp" -#define XLNX_DP(obj) OBJECT_CHECK(XlnxDPState, (obj), TYPE_XLNX_DP) +DECLARE_INSTANCE_CHECKER(XlnxDPState, XLNX_DP, + TYPE_XLNX_DP) #endif diff --git a/include/hw/dma/bcm2835_dma.h b/include/hw/dma/bcm2835_dma.h index 31f335ec5b..b94dae779a 100644 --- a/include/hw/dma/bcm2835_dma.h +++ b/include/hw/dma/bcm2835_dma.h @@ -27,8 +27,8 @@ typedef struct { #define TYPE_BCM2835_DMA "bcm2835-dma" typedef struct BCM2835DMAState BCM2835DMAState; -#define BCM2835_DMA(obj) \ - OBJECT_CHECK(BCM2835DMAState, (obj), TYPE_BCM2835_DMA) +DECLARE_INSTANCE_CHECKER(BCM2835DMAState, BCM2835_DMA, + TYPE_BCM2835_DMA) #define BCM2835_DMA_NCHANS 16 diff --git a/include/hw/dma/pl080.h b/include/hw/dma/pl080.h index 55a645b055..e9669bf5ae 100644 --- a/include/hw/dma/pl080.h +++ b/include/hw/dma/pl080.h @@ -44,7 +44,8 @@ typedef struct { #define TYPE_PL080 "pl080" #define TYPE_PL081 "pl081" typedef struct PL080State PL080State; -#define PL080(obj) OBJECT_CHECK(PL080State, (obj), TYPE_PL080) +DECLARE_INSTANCE_CHECKER(PL080State, PL080, + TYPE_PL080) struct PL080State { SysBusDevice parent_obj; diff --git a/include/hw/dma/xlnx-zdma.h b/include/hw/dma/xlnx-zdma.h index 8be9ee5cc2..f638abe568 100644 --- a/include/hw/dma/xlnx-zdma.h +++ b/include/hw/dma/xlnx-zdma.h @@ -80,7 +80,7 @@ typedef struct XlnxZDMA XlnxZDMA; #define TYPE_XLNX_ZDMA "xlnx.zdma" -#define XLNX_ZDMA(obj) \ - OBJECT_CHECK(XlnxZDMA, (obj), TYPE_XLNX_ZDMA) +DECLARE_INSTANCE_CHECKER(XlnxZDMA, XLNX_ZDMA, + TYPE_XLNX_ZDMA) #endif /* XLNX_ZDMA_H */ diff --git a/include/hw/dma/xlnx-zynq-devcfg.h b/include/hw/dma/xlnx-zynq-devcfg.h index 52ba61b653..e16b08f9c5 100644 --- a/include/hw/dma/xlnx-zynq-devcfg.h +++ b/include/hw/dma/xlnx-zynq-devcfg.h @@ -34,8 +34,8 @@ #define TYPE_XLNX_ZYNQ_DEVCFG "xlnx.ps7-dev-cfg" typedef struct XlnxZynqDevcfg XlnxZynqDevcfg; -#define XLNX_ZYNQ_DEVCFG(obj) \ - OBJECT_CHECK(XlnxZynqDevcfg, (obj), TYPE_XLNX_ZYNQ_DEVCFG) +DECLARE_INSTANCE_CHECKER(XlnxZynqDevcfg, XLNX_ZYNQ_DEVCFG, + TYPE_XLNX_ZYNQ_DEVCFG) #define XLNX_ZYNQ_DEVCFG_R_MAX (0x100 / 4) diff --git a/include/hw/dma/xlnx_dpdma.h b/include/hw/dma/xlnx_dpdma.h index 50952dd7ce..94b01cad0a 100644 --- a/include/hw/dma/xlnx_dpdma.h +++ b/include/hw/dma/xlnx_dpdma.h @@ -46,7 +46,8 @@ struct XlnxDPDMAState { typedef struct XlnxDPDMAState XlnxDPDMAState; #define TYPE_XLNX_DPDMA "xlnx.dpdma" -#define XLNX_DPDMA(obj) OBJECT_CHECK(XlnxDPDMAState, (obj), TYPE_XLNX_DPDMA) +DECLARE_INSTANCE_CHECKER(XlnxDPDMAState, XLNX_DPDMA, + TYPE_XLNX_DPDMA) /* * xlnx_dpdma_start_operation: Start the operation on the specified channel. The diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h index 1231cca63b..8e1d45651c 100644 --- a/include/hw/fw-path-provider.h +++ b/include/hw/fw-path-provider.h @@ -23,10 +23,8 @@ #define TYPE_FW_PATH_PROVIDER "fw-path-provider" typedef struct FWPathProviderClass FWPathProviderClass; -#define FW_PATH_PROVIDER_CLASS(klass) \ - OBJECT_CLASS_CHECK(FWPathProviderClass, (klass), TYPE_FW_PATH_PROVIDER) -#define FW_PATH_PROVIDER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(FWPathProviderClass, (obj), TYPE_FW_PATH_PROVIDER) +DECLARE_CLASS_CHECKERS(FWPathProviderClass, FW_PATH_PROVIDER, + TYPE_FW_PATH_PROVIDER) #define FW_PATH_PROVIDER(obj) \ INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER) diff --git a/include/hw/gpio/aspeed_gpio.h b/include/hw/gpio/aspeed_gpio.h index 4dc0bc3f3d..2582e6e0dc 100644 --- a/include/hw/gpio/aspeed_gpio.h +++ b/include/hw/gpio/aspeed_gpio.h @@ -16,11 +16,8 @@ #define TYPE_ASPEED_GPIO "aspeed.gpio" typedef struct AspeedGPIOClass AspeedGPIOClass; typedef struct AspeedGPIOState AspeedGPIOState; -#define ASPEED_GPIO(obj) OBJECT_CHECK(AspeedGPIOState, (obj), TYPE_ASPEED_GPIO) -#define ASPEED_GPIO_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedGPIOClass, (klass), TYPE_ASPEED_GPIO) -#define ASPEED_GPIO_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedGPIOClass, (obj), TYPE_ASPEED_GPIO) +DECLARE_OBJ_CHECKERS(AspeedGPIOState, AspeedGPIOClass, + ASPEED_GPIO, TYPE_ASPEED_GPIO) #define ASPEED_GPIO_MAX_NR_SETS 8 #define ASPEED_REGS_PER_BANK 14 diff --git a/include/hw/gpio/bcm2835_gpio.h b/include/hw/gpio/bcm2835_gpio.h index d8268f1461..e06e08a0fe 100644 --- a/include/hw/gpio/bcm2835_gpio.h +++ b/include/hw/gpio/bcm2835_gpio.h @@ -36,7 +36,7 @@ struct BCM2835GpioState { typedef struct BCM2835GpioState BCM2835GpioState; #define TYPE_BCM2835_GPIO "bcm2835_gpio" -#define BCM2835_GPIO(obj) \ - OBJECT_CHECK(BCM2835GpioState, (obj), TYPE_BCM2835_GPIO) +DECLARE_INSTANCE_CHECKER(BCM2835GpioState, BCM2835_GPIO, + TYPE_BCM2835_GPIO) #endif diff --git a/include/hw/gpio/imx_gpio.h b/include/hw/gpio/imx_gpio.h index b7dc689f73..a72b272ace 100644 --- a/include/hw/gpio/imx_gpio.h +++ b/include/hw/gpio/imx_gpio.h @@ -25,7 +25,8 @@ #define TYPE_IMX_GPIO "imx.gpio" typedef struct IMXGPIOState IMXGPIOState; -#define IMX_GPIO(obj) OBJECT_CHECK(IMXGPIOState, (obj), TYPE_IMX_GPIO) +DECLARE_INSTANCE_CHECKER(IMXGPIOState, IMX_GPIO, + TYPE_IMX_GPIO) #define IMX_GPIO_MEM_SIZE 0x20 diff --git a/include/hw/gpio/nrf51_gpio.h b/include/hw/gpio/nrf51_gpio.h index 0c37dd74c0..55d7d24a52 100644 --- a/include/hw/gpio/nrf51_gpio.h +++ b/include/hw/gpio/nrf51_gpio.h @@ -30,7 +30,8 @@ #include "qom/object.h" #define TYPE_NRF51_GPIO "nrf51_soc.gpio" typedef struct NRF51GPIOState NRF51GPIOState; -#define NRF51_GPIO(obj) OBJECT_CHECK(NRF51GPIOState, (obj), TYPE_NRF51_GPIO) +DECLARE_INSTANCE_CHECKER(NRF51GPIOState, NRF51_GPIO, + TYPE_NRF51_GPIO) #define NRF51_GPIO_PINS 32 diff --git a/include/hw/hotplug.h b/include/hw/hotplug.h index 6536bb01a3..e15f59c8b3 100644 --- a/include/hw/hotplug.h +++ b/include/hw/hotplug.h @@ -17,10 +17,8 @@ #define TYPE_HOTPLUG_HANDLER "hotplug-handler" typedef struct HotplugHandlerClass HotplugHandlerClass; -#define HOTPLUG_HANDLER_CLASS(klass) \ - OBJECT_CLASS_CHECK(HotplugHandlerClass, (klass), TYPE_HOTPLUG_HANDLER) -#define HOTPLUG_HANDLER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(HotplugHandlerClass, (obj), TYPE_HOTPLUG_HANDLER) +DECLARE_CLASS_CHECKERS(HotplugHandlerClass, HOTPLUG_HANDLER, + TYPE_HOTPLUG_HANDLER) #define HOTPLUG_HANDLER(obj) \ INTERFACE_CHECK(HotplugHandler, (obj), TYPE_HOTPLUG_HANDLER) diff --git a/include/hw/hyperv/vmbus-bridge.h b/include/hw/hyperv/vmbus-bridge.h index 4e09e6813a..eec3fb7373 100644 --- a/include/hw/hyperv/vmbus-bridge.h +++ b/include/hw/hyperv/vmbus-bridge.h @@ -26,7 +26,8 @@ struct VMBusBridge { }; typedef struct VMBusBridge VMBusBridge; -#define VMBUS_BRIDGE(obj) OBJECT_CHECK(VMBusBridge, (obj), TYPE_VMBUS_BRIDGE) +DECLARE_INSTANCE_CHECKER(VMBusBridge, VMBUS_BRIDGE, + TYPE_VMBUS_BRIDGE) static inline VMBusBridge *vmbus_bridge_find(void) { diff --git a/include/hw/hyperv/vmbus.h b/include/hw/hyperv/vmbus.h index a25dd15762..a079baab06 100644 --- a/include/hw/hyperv/vmbus.h +++ b/include/hw/hyperv/vmbus.h @@ -22,12 +22,8 @@ typedef struct VMBusDevice VMBusDevice; typedef struct VMBusDeviceClass VMBusDeviceClass; -#define VMBUS_DEVICE(obj) \ - OBJECT_CHECK(VMBusDevice, (obj), TYPE_VMBUS_DEVICE) -#define VMBUS_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VMBusDeviceClass, (klass), TYPE_VMBUS_DEVICE) -#define VMBUS_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VMBusDeviceClass, (obj), TYPE_VMBUS_DEVICE) +DECLARE_OBJ_CHECKERS(VMBusDevice, VMBusDeviceClass, + VMBUS_DEVICE, TYPE_VMBUS_DEVICE) /* * Object wrapping a GPADL -- GPA Descriptor List -- an array of guest physical diff --git a/include/hw/i2c/arm_sbcon_i2c.h b/include/hw/i2c/arm_sbcon_i2c.h index ca54867964..ad96781e7a 100644 --- a/include/hw/i2c/arm_sbcon_i2c.h +++ b/include/hw/i2c/arm_sbcon_i2c.h @@ -20,8 +20,8 @@ #define TYPE_ARM_SBCON_I2C TYPE_VERSATILE_I2C typedef struct ArmSbconI2CState ArmSbconI2CState; -#define ARM_SBCON_I2C(obj) \ - OBJECT_CHECK(ArmSbconI2CState, (obj), TYPE_ARM_SBCON_I2C) +DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, ARM_SBCON_I2C, + TYPE_ARM_SBCON_I2C) struct ArmSbconI2CState { /*< private >*/ diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h index 2c0198e314..695e1c0928 100644 --- a/include/hw/i2c/aspeed_i2c.h +++ b/include/hw/i2c/aspeed_i2c.h @@ -31,8 +31,8 @@ #define TYPE_ASPEED_2600_I2C TYPE_ASPEED_I2C "-ast2600" typedef struct AspeedI2CClass AspeedI2CClass; typedef struct AspeedI2CState AspeedI2CState; -#define ASPEED_I2C(obj) \ - OBJECT_CHECK(AspeedI2CState, (obj), TYPE_ASPEED_I2C) +DECLARE_OBJ_CHECKERS(AspeedI2CState, AspeedI2CClass, + ASPEED_I2C, TYPE_ASPEED_I2C) #define ASPEED_I2C_NR_BUSSES 16 #define ASPEED_I2C_MAX_POOL_SIZE 0x800 @@ -75,10 +75,6 @@ struct AspeedI2CState { AddressSpace dram_as; }; -#define ASPEED_I2C_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedI2CClass, (klass), TYPE_ASPEED_I2C) -#define ASPEED_I2C_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedI2CClass, (obj), TYPE_ASPEED_I2C) struct AspeedI2CClass { SysBusDeviceClass parent_class; diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h index bf501b9ac4..164e86ee83 100644 --- a/include/hw/i2c/i2c.h +++ b/include/hw/i2c/i2c.h @@ -20,12 +20,8 @@ typedef struct I2CSlave I2CSlave; #define TYPE_I2C_SLAVE "i2c-slave" typedef struct I2CSlaveClass I2CSlaveClass; -#define I2C_SLAVE(obj) \ - OBJECT_CHECK(I2CSlave, (obj), TYPE_I2C_SLAVE) -#define I2C_SLAVE_CLASS(klass) \ - OBJECT_CLASS_CHECK(I2CSlaveClass, (klass), TYPE_I2C_SLAVE) -#define I2C_SLAVE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(I2CSlaveClass, (obj), TYPE_I2C_SLAVE) +DECLARE_OBJ_CHECKERS(I2CSlave, I2CSlaveClass, + I2C_SLAVE, TYPE_I2C_SLAVE) struct I2CSlaveClass { DeviceClass parent_class; diff --git a/include/hw/i2c/imx_i2c.h b/include/hw/i2c/imx_i2c.h index 285a8f40a4..e7f09104cf 100644 --- a/include/hw/i2c/imx_i2c.h +++ b/include/hw/i2c/imx_i2c.h @@ -26,7 +26,8 @@ #define TYPE_IMX_I2C "imx.i2c" typedef struct IMXI2CState IMXI2CState; -#define IMX_I2C(obj) OBJECT_CHECK(IMXI2CState, (obj), TYPE_IMX_I2C) +DECLARE_INSTANCE_CHECKER(IMXI2CState, IMX_I2C, + TYPE_IMX_I2C) #define IMX_I2C_MEM_SIZE 0x14 diff --git a/include/hw/i2c/microbit_i2c.h b/include/hw/i2c/microbit_i2c.h index 76ffaff47a..69d70287d7 100644 --- a/include/hw/i2c/microbit_i2c.h +++ b/include/hw/i2c/microbit_i2c.h @@ -28,8 +28,8 @@ #define TYPE_MICROBIT_I2C "microbit.i2c" typedef struct MicrobitI2CState MicrobitI2CState; -#define MICROBIT_I2C(obj) \ - OBJECT_CHECK(MicrobitI2CState, (obj), TYPE_MICROBIT_I2C) +DECLARE_INSTANCE_CHECKER(MicrobitI2CState, MICROBIT_I2C, + TYPE_MICROBIT_I2C) #define MICROBIT_I2C_NREGS (NRF51_PERIPHERAL_SIZE / sizeof(uint32_t)) diff --git a/include/hw/i2c/ppc4xx_i2c.h b/include/hw/i2c/ppc4xx_i2c.h index 3698e054b1..7cbcdaf12f 100644 --- a/include/hw/i2c/ppc4xx_i2c.h +++ b/include/hw/i2c/ppc4xx_i2c.h @@ -33,7 +33,8 @@ #define TYPE_PPC4xx_I2C "ppc4xx-i2c" typedef struct PPC4xxI2CState PPC4xxI2CState; -#define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C) +DECLARE_INSTANCE_CHECKER(PPC4xxI2CState, PPC4xx_I2C, + TYPE_PPC4xx_I2C) struct PPC4xxI2CState { /*< private >*/ diff --git a/include/hw/i2c/smbus_slave.h b/include/hw/i2c/smbus_slave.h index 17f2cd2d8d..8d16e4bcd9 100644 --- a/include/hw/i2c/smbus_slave.h +++ b/include/hw/i2c/smbus_slave.h @@ -31,12 +31,8 @@ #define TYPE_SMBUS_DEVICE "smbus-device" typedef struct SMBusDevice SMBusDevice; typedef struct SMBusDeviceClass SMBusDeviceClass; -#define SMBUS_DEVICE(obj) \ - OBJECT_CHECK(SMBusDevice, (obj), TYPE_SMBUS_DEVICE) -#define SMBUS_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SMBusDeviceClass, (klass), TYPE_SMBUS_DEVICE) -#define SMBUS_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SMBusDeviceClass, (obj), TYPE_SMBUS_DEVICE) +DECLARE_OBJ_CHECKERS(SMBusDevice, SMBusDeviceClass, + SMBUS_DEVICE, TYPE_SMBUS_DEVICE) struct SMBusDeviceClass { diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h index 124f1fad6f..da38541627 100644 --- a/include/hw/i386/apic_internal.h +++ b/include/hw/i386/apic_internal.h @@ -127,12 +127,8 @@ typedef struct APICCommonState APICCommonState; #define TYPE_APIC_COMMON "apic-common" typedef struct APICCommonClass APICCommonClass; -#define APIC_COMMON(obj) \ - OBJECT_CHECK(APICCommonState, (obj), TYPE_APIC_COMMON) -#define APIC_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(APICCommonClass, (klass), TYPE_APIC_COMMON) -#define APIC_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(APICCommonClass, (obj), TYPE_APIC_COMMON) +DECLARE_OBJ_CHECKERS(APICCommonState, APICCommonClass, + APIC_COMMON, TYPE_APIC_COMMON) struct APICCommonClass { DeviceClass parent_class; diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index 8fdac227f2..e750d67975 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -25,8 +25,8 @@ void ich9_generate_smi(void); #define TYPE_ICH9_LPC_DEVICE "ICH9-LPC" typedef struct ICH9LPCState ICH9LPCState; -#define ICH9_LPC_DEVICE(obj) \ - OBJECT_CHECK(ICH9LPCState, (obj), TYPE_ICH9_LPC_DEVICE) +DECLARE_INSTANCE_CHECKER(ICH9LPCState, ICH9_LPC_DEVICE, + TYPE_ICH9_LPC_DEVICE) struct ICH9LPCState { /* ICH9 LPC PCI to ISA bridge */ diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index 53e5d32d54..98cfc77723 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -28,8 +28,8 @@ #define TYPE_INTEL_IOMMU_DEVICE "intel-iommu" typedef struct IntelIOMMUState IntelIOMMUState; -#define INTEL_IOMMU_DEVICE(obj) \ - OBJECT_CHECK(IntelIOMMUState, (obj), TYPE_INTEL_IOMMU_DEVICE) +DECLARE_INSTANCE_CHECKER(IntelIOMMUState, INTEL_IOMMU_DEVICE, + TYPE_INTEL_IOMMU_DEVICE) #define TYPE_INTEL_IOMMU_MEMORY_REGION "intel-iommu-iommu-memory-region" diff --git a/include/hw/i386/ioapic_internal.h b/include/hw/i386/ioapic_internal.h index 29ae150727..e9cc2eaf54 100644 --- a/include/hw/i386/ioapic_internal.h +++ b/include/hw/i386/ioapic_internal.h @@ -86,12 +86,8 @@ typedef struct IOAPICCommonState IOAPICCommonState; #define TYPE_IOAPIC_COMMON "ioapic-common" typedef struct IOAPICCommonClass IOAPICCommonClass; -#define IOAPIC_COMMON(obj) \ - OBJECT_CHECK(IOAPICCommonState, (obj), TYPE_IOAPIC_COMMON) -#define IOAPIC_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(IOAPICCommonClass, (klass), TYPE_IOAPIC_COMMON) -#define IOAPIC_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(IOAPICCommonClass, (obj), TYPE_IOAPIC_COMMON) +DECLARE_OBJ_CHECKERS(IOAPICCommonState, IOAPICCommonClass, + IOAPIC_COMMON, TYPE_IOAPIC_COMMON) struct IOAPICCommonClass { SysBusDeviceClass parent_class; diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h index 0556f64206..36dbcdd123 100644 --- a/include/hw/i386/microvm.h +++ b/include/hw/i386/microvm.h @@ -64,11 +64,7 @@ struct MicrovmMachineState { typedef struct MicrovmMachineState MicrovmMachineState; #define TYPE_MICROVM_MACHINE MACHINE_TYPE_NAME("microvm") -#define MICROVM_MACHINE(obj) \ - OBJECT_CHECK(MicrovmMachineState, (obj), TYPE_MICROVM_MACHINE) -#define MICROVM_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MicrovmMachineClass, obj, TYPE_MICROVM_MACHINE) -#define MICROVM_MACHINE_CLASS(class) \ - OBJECT_CLASS_CHECK(MicrovmMachineClass, class, TYPE_MICROVM_MACHINE) +DECLARE_OBJ_CHECKERS(MicrovmMachineState, MicrovmMachineClass, + MICROVM_MACHINE, TYPE_MICROVM_MACHINE) #endif diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 7084bb24e6..f2319862ae 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -86,12 +86,8 @@ typedef struct X86MachineState X86MachineState; #define X86_MACHINE_ACPI "acpi" #define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86") -#define X86_MACHINE(obj) \ - OBJECT_CHECK(X86MachineState, (obj), TYPE_X86_MACHINE) -#define X86_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(X86MachineClass, obj, TYPE_X86_MACHINE) -#define X86_MACHINE_CLASS(class) \ - OBJECT_CLASS_CHECK(X86MachineClass, class, TYPE_X86_MACHINE) +DECLARE_OBJ_CHECKERS(X86MachineState, X86MachineClass, + X86_MACHINE, TYPE_X86_MACHINE) void init_topo_info(X86CPUTopoInfo *topo_info, const X86MachineState *x86ms); diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 74ea1e324c..eb9eb4e0ae 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -26,7 +26,8 @@ typedef struct IDEDMA IDEDMA; typedef struct IDEDMAOps IDEDMAOps; #define TYPE_IDE_BUS "IDE" -#define IDE_BUS(obj) OBJECT_CHECK(IDEBus, (obj), TYPE_IDE_BUS) +DECLARE_INSTANCE_CHECKER(IDEBus, IDE_BUS, + TYPE_IDE_BUS) #define MAX_IDE_DEVS 2 @@ -488,12 +489,8 @@ struct IDEBus { #define TYPE_IDE_DEVICE "ide-device" typedef struct IDEDeviceClass IDEDeviceClass; -#define IDE_DEVICE(obj) \ - OBJECT_CHECK(IDEDevice, (obj), TYPE_IDE_DEVICE) -#define IDE_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(IDEDeviceClass, (klass), TYPE_IDE_DEVICE) -#define IDE_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(IDEDeviceClass, (obj), TYPE_IDE_DEVICE) +DECLARE_OBJ_CHECKERS(IDEDevice, IDEDeviceClass, + IDE_DEVICE, TYPE_IDE_DEVICE) struct IDEDeviceClass { DeviceClass parent_class; diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h index 7ed1fa101d..b8d7270ec8 100644 --- a/include/hw/ide/pci.h +++ b/include/hw/ide/pci.h @@ -41,7 +41,8 @@ typedef struct BMDMAState { #define TYPE_PCI_IDE "pci-ide" typedef struct PCIIDEState PCIIDEState; -#define PCI_IDE(obj) OBJECT_CHECK(PCIIDEState, (obj), TYPE_PCI_IDE) +DECLARE_INSTANCE_CHECKER(PCIIDEState, PCI_IDE, + TYPE_PCI_IDE) struct PCIIDEState { /*< private >*/ diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h index ad89a21176..285f70db55 100644 --- a/include/hw/input/adb.h +++ b/include/hw/input/adb.h @@ -44,7 +44,8 @@ typedef bool ADBDeviceHasData(ADBDevice *d); #define TYPE_ADB_DEVICE "adb-device" typedef struct ADBDeviceClass ADBDeviceClass; -#define ADB_DEVICE(obj) OBJECT_CHECK(ADBDevice, (obj), TYPE_ADB_DEVICE) +DECLARE_OBJ_CHECKERS(ADBDevice, ADBDeviceClass, + ADB_DEVICE, TYPE_ADB_DEVICE) struct ADBDevice { /*< private >*/ @@ -55,10 +56,6 @@ struct ADBDevice { int handler; }; -#define ADB_DEVICE_CLASS(cls) \ - OBJECT_CLASS_CHECK(ADBDeviceClass, (cls), TYPE_ADB_DEVICE) -#define ADB_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ADBDeviceClass, (obj), TYPE_ADB_DEVICE) struct ADBDeviceClass { /*< private >*/ @@ -70,7 +67,8 @@ struct ADBDeviceClass { }; #define TYPE_ADB_BUS "apple-desktop-bus" -#define ADB_BUS(obj) OBJECT_CHECK(ADBBusState, (obj), TYPE_ADB_BUS) +DECLARE_INSTANCE_CHECKER(ADBBusState, ADB_BUS, + TYPE_ADB_BUS) #define ADB_STATUS_BUSTIMEOUT 0x1 #define ADB_STATUS_POLLREPLY 0x2 diff --git a/include/hw/intc/allwinner-a10-pic.h b/include/hw/intc/allwinner-a10-pic.h index 692d2a88d0..4d7199480a 100644 --- a/include/hw/intc/allwinner-a10-pic.h +++ b/include/hw/intc/allwinner-a10-pic.h @@ -6,7 +6,8 @@ #define TYPE_AW_A10_PIC "allwinner-a10-pic" typedef struct AwA10PICState AwA10PICState; -#define AW_A10_PIC(obj) OBJECT_CHECK(AwA10PICState, (obj), TYPE_AW_A10_PIC) +DECLARE_INSTANCE_CHECKER(AwA10PICState, AW_A10_PIC, + TYPE_AW_A10_PIC) #define AW_A10_PIC_VECTOR 0 #define AW_A10_PIC_BASE_ADDR 4 diff --git a/include/hw/intc/arm_gic_common.h b/include/hw/intc/arm_gic_common.h index 2cbde9b7a9..7080375008 100644 --- a/include/hw/intc/arm_gic_common.h +++ b/include/hw/intc/arm_gic_common.h @@ -149,12 +149,8 @@ typedef struct GICState GICState; #define TYPE_ARM_GIC_COMMON "arm_gic_common" typedef struct ARMGICCommonClass ARMGICCommonClass; -#define ARM_GIC_COMMON(obj) \ - OBJECT_CHECK(GICState, (obj), TYPE_ARM_GIC_COMMON) -#define ARM_GIC_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(ARMGICCommonClass, (klass), TYPE_ARM_GIC_COMMON) -#define ARM_GIC_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ARMGICCommonClass, (obj), TYPE_ARM_GIC_COMMON) +DECLARE_OBJ_CHECKERS(GICState, ARMGICCommonClass, + ARM_GIC_COMMON, TYPE_ARM_GIC_COMMON) struct ARMGICCommonClass { /*< private >*/ diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h index 86fb060320..0331b0ffdb 100644 --- a/include/hw/intc/arm_gicv3_common.h +++ b/include/hw/intc/arm_gicv3_common.h @@ -281,12 +281,8 @@ GICV3_BITMAP_ACCESSORS(edge_trigger) #define TYPE_ARM_GICV3_COMMON "arm-gicv3-common" typedef struct ARMGICv3CommonClass ARMGICv3CommonClass; -#define ARM_GICV3_COMMON(obj) \ - OBJECT_CHECK(GICv3State, (obj), TYPE_ARM_GICV3_COMMON) -#define ARM_GICV3_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(ARMGICv3CommonClass, (klass), TYPE_ARM_GICV3_COMMON) -#define ARM_GICV3_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ARMGICv3CommonClass, (obj), TYPE_ARM_GICV3_COMMON) +DECLARE_OBJ_CHECKERS(GICv3State, ARMGICv3CommonClass, + ARM_GICV3_COMMON, TYPE_ARM_GICV3_COMMON) struct ARMGICv3CommonClass { /*< private >*/ diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_gicv3_its_common.h index 03a0fa335b..5a0952b404 100644 --- a/include/hw/intc/arm_gicv3_its_common.h +++ b/include/hw/intc/arm_gicv3_its_common.h @@ -66,12 +66,8 @@ void gicv3_its_init_mmio(GICv3ITSState *s, const MemoryRegionOps *ops); #define TYPE_ARM_GICV3_ITS_COMMON "arm-gicv3-its-common" typedef struct GICv3ITSCommonClass GICv3ITSCommonClass; -#define ARM_GICV3_ITS_COMMON(obj) \ - OBJECT_CHECK(GICv3ITSState, (obj), TYPE_ARM_GICV3_ITS_COMMON) -#define ARM_GICV3_ITS_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(GICv3ITSCommonClass, (klass), TYPE_ARM_GICV3_ITS_COMMON) -#define ARM_GICV3_ITS_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(GICv3ITSCommonClass, (obj), TYPE_ARM_GICV3_ITS_COMMON) +DECLARE_OBJ_CHECKERS(GICv3ITSState, GICv3ITSCommonClass, + ARM_GICV3_ITS_COMMON, TYPE_ARM_GICV3_ITS_COMMON) struct GICv3ITSCommonClass { /*< private >*/ diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h index 63098822fa..bb087b23c3 100644 --- a/include/hw/intc/armv7m_nvic.h +++ b/include/hw/intc/armv7m_nvic.h @@ -18,8 +18,8 @@ #define TYPE_NVIC "armv7m_nvic" typedef struct NVICState NVICState; -#define NVIC(obj) \ - OBJECT_CHECK(NVICState, (obj), TYPE_NVIC) +DECLARE_INSTANCE_CHECKER(NVICState, NVIC, + TYPE_NVIC) /* Highest permitted number of exceptions (architectural limit) */ #define NVIC_MAX_VECTORS 512 diff --git a/include/hw/intc/aspeed_vic.h b/include/hw/intc/aspeed_vic.h index f8844b3327..8f2e67db5a 100644 --- a/include/hw/intc/aspeed_vic.h +++ b/include/hw/intc/aspeed_vic.h @@ -18,7 +18,8 @@ #define TYPE_ASPEED_VIC "aspeed.vic" typedef struct AspeedVICState AspeedVICState; -#define ASPEED_VIC(obj) OBJECT_CHECK(AspeedVICState, (obj), TYPE_ASPEED_VIC) +DECLARE_INSTANCE_CHECKER(AspeedVICState, ASPEED_VIC, + TYPE_ASPEED_VIC) #define ASPEED_VIC_NR_IRQS 51 diff --git a/include/hw/intc/bcm2835_ic.h b/include/hw/intc/bcm2835_ic.h index 4a9f093025..fd4a767845 100644 --- a/include/hw/intc/bcm2835_ic.h +++ b/include/hw/intc/bcm2835_ic.h @@ -13,7 +13,8 @@ #define TYPE_BCM2835_IC "bcm2835-ic" typedef struct BCM2835ICState BCM2835ICState; -#define BCM2835_IC(obj) OBJECT_CHECK(BCM2835ICState, (obj), TYPE_BCM2835_IC) +DECLARE_INSTANCE_CHECKER(BCM2835ICState, BCM2835_IC, + TYPE_BCM2835_IC) #define BCM2835_IC_GPU_IRQ "gpu-irq" #define BCM2835_IC_ARM_IRQ "arm-irq" diff --git a/include/hw/intc/bcm2836_control.h b/include/hw/intc/bcm2836_control.h index 7d8a51fc72..f23292776e 100644 --- a/include/hw/intc/bcm2836_control.h +++ b/include/hw/intc/bcm2836_control.h @@ -25,8 +25,8 @@ #define TYPE_BCM2836_CONTROL "bcm2836-control" typedef struct BCM2836ControlState BCM2836ControlState; -#define BCM2836_CONTROL(obj) \ - OBJECT_CHECK(BCM2836ControlState, (obj), TYPE_BCM2836_CONTROL) +DECLARE_INSTANCE_CHECKER(BCM2836ControlState, BCM2836_CONTROL, + TYPE_BCM2836_CONTROL) struct BCM2836ControlState { /*< private >*/ diff --git a/include/hw/intc/heathrow_pic.h b/include/hw/intc/heathrow_pic.h index bd9fc115a8..f8c9bc20ab 100644 --- a/include/hw/intc/heathrow_pic.h +++ b/include/hw/intc/heathrow_pic.h @@ -31,7 +31,8 @@ #define TYPE_HEATHROW "heathrow" typedef struct HeathrowState HeathrowState; -#define HEATHROW(obj) OBJECT_CHECK(HeathrowState, (obj), TYPE_HEATHROW) +DECLARE_INSTANCE_CHECKER(HeathrowState, HEATHROW, + TYPE_HEATHROW) typedef struct HeathrowPICState { uint32_t events; diff --git a/include/hw/intc/ibex_plic.h b/include/hw/intc/ibex_plic.h index de94a41ee7..61e502eff3 100644 --- a/include/hw/intc/ibex_plic.h +++ b/include/hw/intc/ibex_plic.h @@ -24,8 +24,8 @@ #define TYPE_IBEX_PLIC "ibex-plic" typedef struct IbexPlicState IbexPlicState; -#define IBEX_PLIC(obj) \ - OBJECT_CHECK(IbexPlicState, (obj), TYPE_IBEX_PLIC) +DECLARE_INSTANCE_CHECKER(IbexPlicState, IBEX_PLIC, + TYPE_IBEX_PLIC) struct IbexPlicState { /*< private >*/ diff --git a/include/hw/intc/imx_avic.h b/include/hw/intc/imx_avic.h index 124f29f763..621742533c 100644 --- a/include/hw/intc/imx_avic.h +++ b/include/hw/intc/imx_avic.h @@ -22,7 +22,8 @@ #define TYPE_IMX_AVIC "imx.avic" typedef struct IMXAVICState IMXAVICState; -#define IMX_AVIC(obj) OBJECT_CHECK(IMXAVICState, (obj), TYPE_IMX_AVIC) +DECLARE_INSTANCE_CHECKER(IMXAVICState, IMX_AVIC, + TYPE_IMX_AVIC) #define IMX_AVIC_NUM_IRQS 64 diff --git a/include/hw/intc/imx_gpcv2.h b/include/hw/intc/imx_gpcv2.h index 66befda3fd..2d8075e527 100644 --- a/include/hw/intc/imx_gpcv2.h +++ b/include/hw/intc/imx_gpcv2.h @@ -19,6 +19,7 @@ struct IMXGPCv2State { typedef struct IMXGPCv2State IMXGPCv2State; #define TYPE_IMX_GPCV2 "imx-gpcv2" -#define IMX_GPCV2(obj) OBJECT_CHECK(IMXGPCv2State, (obj), TYPE_IMX_GPCV2) +DECLARE_INSTANCE_CHECKER(IMXGPCv2State, IMX_GPCV2, + TYPE_IMX_GPCV2) #endif /* IMX_GPCV2_H */ diff --git a/include/hw/intc/intc.h b/include/hw/intc/intc.h index b51c0ac0f4..7018f608ca 100644 --- a/include/hw/intc/intc.h +++ b/include/hw/intc/intc.h @@ -6,12 +6,8 @@ #define TYPE_INTERRUPT_STATS_PROVIDER "intctrl" typedef struct InterruptStatsProviderClass InterruptStatsProviderClass; -#define INTERRUPT_STATS_PROVIDER_CLASS(klass) \ - OBJECT_CLASS_CHECK(InterruptStatsProviderClass, (klass), \ +DECLARE_CLASS_CHECKERS(InterruptStatsProviderClass, INTERRUPT_STATS_PROVIDER, TYPE_INTERRUPT_STATS_PROVIDER) -#define INTERRUPT_STATS_PROVIDER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(InterruptStatsProviderClass, (obj), \ - TYPE_INTERRUPT_STATS_PROVIDER) #define INTERRUPT_STATS_PROVIDER(obj) \ INTERFACE_CHECK(InterruptStatsProvider, (obj), \ TYPE_INTERRUPT_STATS_PROVIDER) diff --git a/include/hw/intc/mips_gic.h b/include/hw/intc/mips_gic.h index 5670421e62..65aa3a9a5e 100644 --- a/include/hw/intc/mips_gic.h +++ b/include/hw/intc/mips_gic.h @@ -172,7 +172,8 @@ #define TYPE_MIPS_GIC "mips-gic" typedef struct MIPSGICState MIPSGICState; -#define MIPS_GIC(obj) OBJECT_CHECK(MIPSGICState, (obj), TYPE_MIPS_GIC) +DECLARE_INSTANCE_CHECKER(MIPSGICState, MIPS_GIC, + TYPE_MIPS_GIC) /* Support up to 32 VPs and 256 IRQs */ #define GIC_MAX_VPS 32 diff --git a/include/hw/intc/realview_gic.h b/include/hw/intc/realview_gic.h index e633992b9c..a93ace87c8 100644 --- a/include/hw/intc/realview_gic.h +++ b/include/hw/intc/realview_gic.h @@ -16,8 +16,8 @@ #define TYPE_REALVIEW_GIC "realview_gic" typedef struct RealViewGICState RealViewGICState; -#define REALVIEW_GIC(obj) \ - OBJECT_CHECK(RealViewGICState, (obj), TYPE_REALVIEW_GIC) +DECLARE_INSTANCE_CHECKER(RealViewGICState, REALVIEW_GIC, + TYPE_REALVIEW_GIC) struct RealViewGICState { SysBusDevice parent_obj; diff --git a/include/hw/intc/rx_icu.h b/include/hw/intc/rx_icu.h index 5660cb4e7f..ec02df35e3 100644 --- a/include/hw/intc/rx_icu.h +++ b/include/hw/intc/rx_icu.h @@ -72,6 +72,7 @@ struct RXICUState { typedef struct RXICUState RXICUState; #define TYPE_RX_ICU "rx-icu" -#define RX_ICU(obj) OBJECT_CHECK(RXICUState, (obj), TYPE_RX_ICU) +DECLARE_INSTANCE_CHECKER(RXICUState, RX_ICU, + TYPE_RX_ICU) #endif /* RX_ICU_H */ diff --git a/include/hw/intc/xlnx-pmu-iomod-intc.h b/include/hw/intc/xlnx-pmu-iomod-intc.h index fce35ac941..7a560e97af 100644 --- a/include/hw/intc/xlnx-pmu-iomod-intc.h +++ b/include/hw/intc/xlnx-pmu-iomod-intc.h @@ -32,8 +32,8 @@ #define TYPE_XLNX_PMU_IO_INTC "xlnx.pmu_io_intc" typedef struct XlnxPMUIOIntc XlnxPMUIOIntc; -#define XLNX_PMU_IO_INTC(obj) \ - OBJECT_CHECK(XlnxPMUIOIntc, (obj), TYPE_XLNX_PMU_IO_INTC) +DECLARE_INSTANCE_CHECKER(XlnxPMUIOIntc, XLNX_PMU_IO_INTC, + TYPE_XLNX_PMU_IO_INTC) /* This is R_PIT3_CONTROL + 1 */ #define XLNXPMUIOINTC_R_MAX (0x78 + 1) diff --git a/include/hw/intc/xlnx-zynqmp-ipi.h b/include/hw/intc/xlnx-zynqmp-ipi.h index 9044ca5afe..29c48db307 100644 --- a/include/hw/intc/xlnx-zynqmp-ipi.h +++ b/include/hw/intc/xlnx-zynqmp-ipi.h @@ -32,8 +32,8 @@ #define TYPE_XLNX_ZYNQMP_IPI "xlnx.zynqmp_ipi" typedef struct XlnxZynqMPIPI XlnxZynqMPIPI; -#define XLNX_ZYNQMP_IPI(obj) \ - OBJECT_CHECK(XlnxZynqMPIPI, (obj), TYPE_XLNX_ZYNQMP_IPI) +DECLARE_INSTANCE_CHECKER(XlnxZynqMPIPI, XLNX_ZYNQMP_IPI, + TYPE_XLNX_ZYNQMP_IPI) /* This is R_IPI_IDR + 1 */ #define R_XLNX_ZYNQMP_IPI_MAX ((0x1c / 4) + 1) diff --git a/include/hw/ipack/ipack.h b/include/hw/ipack/ipack.h index ac6105ff8b..a2304c1b3e 100644 --- a/include/hw/ipack/ipack.h +++ b/include/hw/ipack/ipack.h @@ -17,7 +17,8 @@ typedef struct IPackBus IPackBus; #define TYPE_IPACK_BUS "IndustryPack" -#define IPACK_BUS(obj) OBJECT_CHECK(IPackBus, (obj), TYPE_IPACK_BUS) +DECLARE_INSTANCE_CHECKER(IPackBus, IPACK_BUS, + TYPE_IPACK_BUS) struct IPackBus { /*< private >*/ @@ -33,12 +34,8 @@ typedef struct IPackDevice IPackDevice; typedef struct IPackDeviceClass IPackDeviceClass; #define TYPE_IPACK_DEVICE "ipack-device" -#define IPACK_DEVICE(obj) \ - OBJECT_CHECK(IPackDevice, (obj), TYPE_IPACK_DEVICE) -#define IPACK_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(IPackDeviceClass, (klass), TYPE_IPACK_DEVICE) -#define IPACK_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(IPackDeviceClass, (obj), TYPE_IPACK_DEVICE) +DECLARE_OBJ_CHECKERS(IPackDevice, IPackDeviceClass, + IPACK_DEVICE, TYPE_IPACK_DEVICE) struct IPackDeviceClass { /*< private >*/ diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h index 742c400533..d2ed0a9fc4 100644 --- a/include/hw/ipmi/ipmi.h +++ b/include/hw/ipmi/ipmi.h @@ -111,10 +111,8 @@ uint32_t ipmi_next_uuid(void); #define IPMI_INTERFACE(obj) \ INTERFACE_CHECK(IPMIInterface, (obj), TYPE_IPMI_INTERFACE) typedef struct IPMIInterfaceClass IPMIInterfaceClass; -#define IPMI_INTERFACE_CLASS(class) \ - OBJECT_CLASS_CHECK(IPMIInterfaceClass, (class), TYPE_IPMI_INTERFACE) -#define IPMI_INTERFACE_GET_CLASS(class) \ - OBJECT_GET_CLASS(IPMIInterfaceClass, (class), TYPE_IPMI_INTERFACE) +DECLARE_CLASS_CHECKERS(IPMIInterfaceClass, IPMI_INTERFACE, + TYPE_IPMI_INTERFACE) typedef struct IPMIInterface IPMIInterface; @@ -179,12 +177,8 @@ struct IPMIInterfaceClass { #define TYPE_IPMI_BMC "ipmi-bmc" typedef struct IPMIBmc IPMIBmc; typedef struct IPMIBmcClass IPMIBmcClass; -#define IPMI_BMC(obj) \ - OBJECT_CHECK(IPMIBmc, (obj), TYPE_IPMI_BMC) -#define IPMI_BMC_CLASS(obj_class) \ - OBJECT_CLASS_CHECK(IPMIBmcClass, (obj_class), TYPE_IPMI_BMC) -#define IPMI_BMC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(IPMIBmcClass, (obj), TYPE_IPMI_BMC) +DECLARE_OBJ_CHECKERS(IPMIBmc, IPMIBmcClass, + IPMI_BMC, TYPE_IPMI_BMC) struct IPMIBmc { DeviceState parent; @@ -272,8 +266,8 @@ void ipmi_bmc_gen_event(IPMIBmc *b, uint8_t *evt, bool log); #define TYPE_IPMI_BMC_SIMULATOR "ipmi-bmc-sim" typedef struct IPMIBmcSim IPMIBmcSim; -#define IPMI_BMC_SIMULATOR(obj) OBJECT_CHECK(IPMIBmcSim, (obj), \ - TYPE_IPMI_BMC_SIMULATOR) +DECLARE_INSTANCE_CHECKER(IPMIBmcSim, IPMI_BMC_SIMULATOR, + TYPE_IPMI_BMC_SIMULATOR) typedef struct RspBuffer { diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_internal.h index 69170df6f8..cd050bb9f2 100644 --- a/include/hw/isa/i8259_internal.h +++ b/include/hw/isa/i8259_internal.h @@ -34,12 +34,8 @@ typedef struct PICCommonState PICCommonState; #define TYPE_PIC_COMMON "pic-common" typedef struct PICCommonClass PICCommonClass; -#define PIC_COMMON(obj) \ - OBJECT_CHECK(PICCommonState, (obj), TYPE_PIC_COMMON) -#define PIC_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(PICCommonClass, (klass), TYPE_PIC_COMMON) -#define PIC_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PICCommonClass, (obj), TYPE_PIC_COMMON) +DECLARE_OBJ_CHECKERS(PICCommonState, PICCommonClass, + PIC_COMMON, TYPE_PIC_COMMON) struct PICCommonClass { ISADeviceClass parent_class; diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index c7f27d5aa9..491e67de99 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -39,10 +39,8 @@ static inline uint16_t applesmc_port(void) #define TYPE_ISADMA "isa-dma" typedef struct IsaDmaClass IsaDmaClass; -#define ISADMA_CLASS(klass) \ - OBJECT_CLASS_CHECK(IsaDmaClass, (klass), TYPE_ISADMA) -#define ISADMA_GET_CLASS(obj) \ - OBJECT_GET_CLASS(IsaDmaClass, (obj), TYPE_ISADMA) +DECLARE_CLASS_CHECKERS(IsaDmaClass, ISADMA, + TYPE_ISADMA) #define ISADMA(obj) \ INTERFACE_CHECK(IsaDma, (obj), TYPE_ISADMA) diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index c8e98ea029..a65168a157 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -31,7 +31,8 @@ #define TYPE_PC87312_SUPERIO "pc87312" typedef struct PC87312State PC87312State; -#define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERIO) +DECLARE_INSTANCE_CHECKER(PC87312State, PC87312, + TYPE_PC87312_SUPERIO) struct PC87312State { /*< private >*/ diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index c782c8b64e..b9f5c19155 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -17,12 +17,8 @@ #define TYPE_ISA_SUPERIO "isa-superio" typedef struct ISASuperIOClass ISASuperIOClass; typedef struct ISASuperIODevice ISASuperIODevice; -#define ISA_SUPERIO(obj) \ - OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO) -#define ISA_SUPERIO_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO) -#define ISA_SUPERIO_CLASS(klass) \ - OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO) +DECLARE_OBJ_CHECKERS(ISASuperIODevice, ISASuperIOClass, + ISA_SUPERIO, TYPE_ISA_SUPERIO) #define SUPERIO_MAX_SERIAL_PORTS 4 diff --git a/include/hw/m68k/mcf_fec.h b/include/hw/m68k/mcf_fec.h index c8ece3cb4b..840c5bbf53 100644 --- a/include/hw/m68k/mcf_fec.h +++ b/include/hw/m68k/mcf_fec.h @@ -13,7 +13,8 @@ #define TYPE_MCF_FEC_NET "mcf-fec" typedef struct mcf_fec_state mcf_fec_state; -#define MCF_FEC_NET(obj) OBJECT_CHECK(mcf_fec_state, (obj), TYPE_MCF_FEC_NET) +DECLARE_INSTANCE_CHECKER(mcf_fec_state, MCF_FEC_NET, + TYPE_MCF_FEC_NET) #define FEC_NUM_IRQ 13 diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h index d19bca5942..cde52e83c9 100644 --- a/include/hw/mem/memory-device.h +++ b/include/hw/mem/memory-device.h @@ -20,10 +20,8 @@ #define TYPE_MEMORY_DEVICE "memory-device" typedef struct MemoryDeviceClass MemoryDeviceClass; -#define MEMORY_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(MemoryDeviceClass, (klass), TYPE_MEMORY_DEVICE) -#define MEMORY_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MemoryDeviceClass, (obj), TYPE_MEMORY_DEVICE) +DECLARE_CLASS_CHECKERS(MemoryDeviceClass, MEMORY_DEVICE, + TYPE_MEMORY_DEVICE) #define MEMORY_DEVICE(obj) \ INTERFACE_CHECK(MemoryDeviceState, (obj), TYPE_MEMORY_DEVICE) diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h index 4b4a4b5b17..19e3d3092d 100644 --- a/include/hw/mem/nvdimm.h +++ b/include/hw/mem/nvdimm.h @@ -48,10 +48,8 @@ #define TYPE_NVDIMM "nvdimm" typedef struct NVDIMMClass NVDIMMClass; typedef struct NVDIMMDevice NVDIMMDevice; -#define NVDIMM(obj) OBJECT_CHECK(NVDIMMDevice, (obj), TYPE_NVDIMM) -#define NVDIMM_CLASS(oc) OBJECT_CLASS_CHECK(NVDIMMClass, (oc), TYPE_NVDIMM) -#define NVDIMM_GET_CLASS(obj) OBJECT_GET_CLASS(NVDIMMClass, (obj), \ - TYPE_NVDIMM) +DECLARE_OBJ_CHECKERS(NVDIMMDevice, NVDIMMClass, + NVDIMM, TYPE_NVDIMM) #define NVDIMM_LABEL_SIZE_PROP "label-size" #define NVDIMM_UUID_PROP "uuid" diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h index 41d4ff39ba..86e3010243 100644 --- a/include/hw/mem/pc-dimm.h +++ b/include/hw/mem/pc-dimm.h @@ -23,12 +23,8 @@ #define TYPE_PC_DIMM "pc-dimm" typedef struct PCDIMMDevice PCDIMMDevice; typedef struct PCDIMMDeviceClass PCDIMMDeviceClass; -#define PC_DIMM(obj) \ - OBJECT_CHECK(PCDIMMDevice, (obj), TYPE_PC_DIMM) -#define PC_DIMM_CLASS(oc) \ - OBJECT_CLASS_CHECK(PCDIMMDeviceClass, (oc), TYPE_PC_DIMM) -#define PC_DIMM_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PCDIMMDeviceClass, (obj), TYPE_PC_DIMM) +DECLARE_OBJ_CHECKERS(PCDIMMDevice, PCDIMMDeviceClass, + PC_DIMM, TYPE_PC_DIMM) #define PC_DIMM_ADDR_PROP "addr" #define PC_DIMM_SLOT_PROP "slot" diff --git a/include/hw/mips/cps.h b/include/hw/mips/cps.h index ab79a66b1d..849e640570 100644 --- a/include/hw/mips/cps.h +++ b/include/hw/mips/cps.h @@ -30,7 +30,8 @@ #define TYPE_MIPS_CPS "mips-cps" typedef struct MIPSCPSState MIPSCPSState; -#define MIPS_CPS(obj) OBJECT_CHECK(MIPSCPSState, (obj), TYPE_MIPS_CPS) +DECLARE_INSTANCE_CHECKER(MIPSCPSState, MIPS_CPS, + TYPE_MIPS_CPS) struct MIPSCPSState { SysBusDevice parent_obj; diff --git a/include/hw/misc/a9scu.h b/include/hw/misc/a9scu.h index c5481f4dbb..fd1b92e923 100644 --- a/include/hw/misc/a9scu.h +++ b/include/hw/misc/a9scu.h @@ -28,6 +28,7 @@ struct A9SCUState { typedef struct A9SCUState A9SCUState; #define TYPE_A9_SCU "a9-scu" -#define A9_SCU(obj) OBJECT_CHECK(A9SCUState, (obj), TYPE_A9_SCU) +DECLARE_INSTANCE_CHECKER(A9SCUState, A9_SCU, + TYPE_A9_SCU) #endif diff --git a/include/hw/misc/allwinner-cpucfg.h b/include/hw/misc/allwinner-cpucfg.h index f5420b11d5..058514de15 100644 --- a/include/hw/misc/allwinner-cpucfg.h +++ b/include/hw/misc/allwinner-cpucfg.h @@ -30,8 +30,8 @@ #define TYPE_AW_CPUCFG "allwinner-cpucfg" typedef struct AwCpuCfgState AwCpuCfgState; -#define AW_CPUCFG(obj) \ - OBJECT_CHECK(AwCpuCfgState, (obj), TYPE_AW_CPUCFG) +DECLARE_INSTANCE_CHECKER(AwCpuCfgState, AW_CPUCFG, + TYPE_AW_CPUCFG) /** @} */ diff --git a/include/hw/misc/allwinner-h3-ccu.h b/include/hw/misc/allwinner-h3-ccu.h index 60f0c56cd9..05f5c7bd8e 100644 --- a/include/hw/misc/allwinner-h3-ccu.h +++ b/include/hw/misc/allwinner-h3-ccu.h @@ -43,8 +43,8 @@ #define TYPE_AW_H3_CCU "allwinner-h3-ccu" typedef struct AwH3ClockCtlState AwH3ClockCtlState; -#define AW_H3_CCU(obj) \ - OBJECT_CHECK(AwH3ClockCtlState, (obj), TYPE_AW_H3_CCU) +DECLARE_INSTANCE_CHECKER(AwH3ClockCtlState, AW_H3_CCU, + TYPE_AW_H3_CCU) /** @} */ diff --git a/include/hw/misc/allwinner-h3-dramc.h b/include/hw/misc/allwinner-h3-dramc.h index 0538e598b0..60a13a6958 100644 --- a/include/hw/misc/allwinner-h3-dramc.h +++ b/include/hw/misc/allwinner-h3-dramc.h @@ -59,8 +59,8 @@ #define TYPE_AW_H3_DRAMC "allwinner-h3-dramc" typedef struct AwH3DramCtlState AwH3DramCtlState; -#define AW_H3_DRAMC(obj) \ - OBJECT_CHECK(AwH3DramCtlState, (obj), TYPE_AW_H3_DRAMC) +DECLARE_INSTANCE_CHECKER(AwH3DramCtlState, AW_H3_DRAMC, + TYPE_AW_H3_DRAMC) /** @} */ diff --git a/include/hw/misc/allwinner-h3-sysctrl.h b/include/hw/misc/allwinner-h3-sysctrl.h index 7360698f8f..50baa8eb07 100644 --- a/include/hw/misc/allwinner-h3-sysctrl.h +++ b/include/hw/misc/allwinner-h3-sysctrl.h @@ -44,8 +44,8 @@ #define TYPE_AW_H3_SYSCTRL "allwinner-h3-sysctrl" typedef struct AwH3SysCtrlState AwH3SysCtrlState; -#define AW_H3_SYSCTRL(obj) \ - OBJECT_CHECK(AwH3SysCtrlState, (obj), TYPE_AW_H3_SYSCTRL) +DECLARE_INSTANCE_CHECKER(AwH3SysCtrlState, AW_H3_SYSCTRL, + TYPE_AW_H3_SYSCTRL) /** @} */ diff --git a/include/hw/misc/allwinner-sid.h b/include/hw/misc/allwinner-sid.h index 70cd7cc7c0..b8e83bb7ce 100644 --- a/include/hw/misc/allwinner-sid.h +++ b/include/hw/misc/allwinner-sid.h @@ -31,8 +31,8 @@ #define TYPE_AW_SID "allwinner-sid" typedef struct AwSidState AwSidState; -#define AW_SID(obj) \ - OBJECT_CHECK(AwSidState, (obj), TYPE_AW_SID) +DECLARE_INSTANCE_CHECKER(AwSidState, AW_SID, + TYPE_AW_SID) /** @} */ diff --git a/include/hw/misc/arm11scu.h b/include/hw/misc/arm11scu.h index 7e2e6d2b44..71b4bc9a22 100644 --- a/include/hw/misc/arm11scu.h +++ b/include/hw/misc/arm11scu.h @@ -16,7 +16,8 @@ #define TYPE_ARM11_SCU "arm11-scu" typedef struct ARM11SCUState ARM11SCUState; -#define ARM11_SCU(obj) OBJECT_CHECK(ARM11SCUState, (obj), TYPE_ARM11_SCU) +DECLARE_INSTANCE_CHECKER(ARM11SCUState, ARM11_SCU, + TYPE_ARM11_SCU) struct ARM11SCUState { /*< private >*/ diff --git a/include/hw/misc/armsse-cpuid.h b/include/hw/misc/armsse-cpuid.h index 290a52cf10..80691c7180 100644 --- a/include/hw/misc/armsse-cpuid.h +++ b/include/hw/misc/armsse-cpuid.h @@ -27,7 +27,8 @@ #define TYPE_ARMSSE_CPUID "armsse-cpuid" typedef struct ARMSSECPUID ARMSSECPUID; -#define ARMSSE_CPUID(obj) OBJECT_CHECK(ARMSSECPUID, (obj), TYPE_ARMSSE_CPUID) +DECLARE_INSTANCE_CHECKER(ARMSSECPUID, ARMSSE_CPUID, + TYPE_ARMSSE_CPUID) struct ARMSSECPUID { /*< private >*/ diff --git a/include/hw/misc/armsse-mhu.h b/include/hw/misc/armsse-mhu.h index d1ae4a463a..310643a022 100644 --- a/include/hw/misc/armsse-mhu.h +++ b/include/hw/misc/armsse-mhu.h @@ -28,7 +28,8 @@ #define TYPE_ARMSSE_MHU "armsse-mhu" typedef struct ARMSSEMHU ARMSSEMHU; -#define ARMSSE_MHU(obj) OBJECT_CHECK(ARMSSEMHU, (obj), TYPE_ARMSSE_MHU) +DECLARE_INSTANCE_CHECKER(ARMSSEMHU, ARMSSE_MHU, + TYPE_ARMSSE_MHU) struct ARMSSEMHU { /*< private >*/ diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h index 5e03f6db3a..229a1a9539 100644 --- a/include/hw/misc/aspeed_scu.h +++ b/include/hw/misc/aspeed_scu.h @@ -17,7 +17,8 @@ #define TYPE_ASPEED_SCU "aspeed.scu" typedef struct AspeedSCUClass AspeedSCUClass; typedef struct AspeedSCUState AspeedSCUState; -#define ASPEED_SCU(obj) OBJECT_CHECK(AspeedSCUState, (obj), TYPE_ASPEED_SCU) +DECLARE_OBJ_CHECKERS(AspeedSCUState, AspeedSCUClass, + ASPEED_SCU, TYPE_ASPEED_SCU) #define TYPE_ASPEED_2400_SCU TYPE_ASPEED_SCU "-ast2400" #define TYPE_ASPEED_2500_SCU TYPE_ASPEED_SCU "-ast2500" #define TYPE_ASPEED_2600_SCU TYPE_ASPEED_SCU "-ast2600" @@ -50,10 +51,6 @@ struct AspeedSCUState { extern bool is_supported_silicon_rev(uint32_t silicon_rev); -#define ASPEED_SCU_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedSCUClass, (klass), TYPE_ASPEED_SCU) -#define ASPEED_SCU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedSCUClass, (obj), TYPE_ASPEED_SCU) struct AspeedSCUClass { SysBusDeviceClass parent_class; diff --git a/include/hw/misc/aspeed_sdmc.h b/include/hw/misc/aspeed_sdmc.h index 8ee5e8e483..4b76c72e87 100644 --- a/include/hw/misc/aspeed_sdmc.h +++ b/include/hw/misc/aspeed_sdmc.h @@ -15,7 +15,8 @@ #define TYPE_ASPEED_SDMC "aspeed.sdmc" typedef struct AspeedSDMCClass AspeedSDMCClass; typedef struct AspeedSDMCState AspeedSDMCState; -#define ASPEED_SDMC(obj) OBJECT_CHECK(AspeedSDMCState, (obj), TYPE_ASPEED_SDMC) +DECLARE_OBJ_CHECKERS(AspeedSDMCState, AspeedSDMCClass, + ASPEED_SDMC, TYPE_ASPEED_SDMC) #define TYPE_ASPEED_2400_SDMC TYPE_ASPEED_SDMC "-ast2400" #define TYPE_ASPEED_2500_SDMC TYPE_ASPEED_SDMC "-ast2500" #define TYPE_ASPEED_2600_SDMC TYPE_ASPEED_SDMC "-ast2600" @@ -34,10 +35,6 @@ struct AspeedSDMCState { uint64_t max_ram_size; }; -#define ASPEED_SDMC_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedSDMCClass, (klass), TYPE_ASPEED_SDMC) -#define ASPEED_SDMC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedSDMCClass, (obj), TYPE_ASPEED_SDMC) struct AspeedSDMCClass { SysBusDeviceClass parent_class; diff --git a/include/hw/misc/aspeed_xdma.h b/include/hw/misc/aspeed_xdma.h index e5177e2c02..0e62c04520 100644 --- a/include/hw/misc/aspeed_xdma.h +++ b/include/hw/misc/aspeed_xdma.h @@ -14,7 +14,8 @@ #define TYPE_ASPEED_XDMA "aspeed.xdma" typedef struct AspeedXDMAState AspeedXDMAState; -#define ASPEED_XDMA(obj) OBJECT_CHECK(AspeedXDMAState, (obj), TYPE_ASPEED_XDMA) +DECLARE_INSTANCE_CHECKER(AspeedXDMAState, ASPEED_XDMA, + TYPE_ASPEED_XDMA) #define ASPEED_XDMA_NUM_REGS (ASPEED_XDMA_REG_SIZE / sizeof(uint32_t)) #define ASPEED_XDMA_REG_SIZE 0x7C diff --git a/include/hw/misc/auxbus.h b/include/hw/misc/auxbus.h index 182e31c3cf..b5fbde1265 100644 --- a/include/hw/misc/auxbus.h +++ b/include/hw/misc/auxbus.h @@ -54,7 +54,8 @@ enum AUXReply { }; #define TYPE_AUX_BUS "aux-bus" -#define AUX_BUS(obj) OBJECT_CHECK(AUXBus, (obj), TYPE_AUX_BUS) +DECLARE_INSTANCE_CHECKER(AUXBus, AUX_BUS, + TYPE_AUX_BUS) struct AUXBus { /* < private > */ @@ -73,8 +74,8 @@ struct AUXBus { }; #define TYPE_AUX_SLAVE "aux-slave" -#define AUX_SLAVE(obj) \ - OBJECT_CHECK(AUXSlave, (obj), TYPE_AUX_SLAVE) +DECLARE_INSTANCE_CHECKER(AUXSlave, AUX_SLAVE, + TYPE_AUX_SLAVE) struct AUXSlave { /* < private > */ diff --git a/include/hw/misc/avr_power.h b/include/hw/misc/avr_power.h index c230a2655c..938ab3e21b 100644 --- a/include/hw/misc/avr_power.h +++ b/include/hw/misc/avr_power.h @@ -32,7 +32,8 @@ #define TYPE_AVR_MASK "avr-power" typedef struct AVRMaskState AVRMaskState; -#define AVR_MASK(obj) OBJECT_CHECK(AVRMaskState, (obj), TYPE_AVR_MASK) +DECLARE_INSTANCE_CHECKER(AVRMaskState, AVR_MASK, + TYPE_AVR_MASK) struct AVRMaskState { /* */ diff --git a/include/hw/misc/bcm2835_mbox.h b/include/hw/misc/bcm2835_mbox.h index 3ec6a2f0e8..d8c8017f4e 100644 --- a/include/hw/misc/bcm2835_mbox.h +++ b/include/hw/misc/bcm2835_mbox.h @@ -14,8 +14,8 @@ #define TYPE_BCM2835_MBOX "bcm2835-mbox" typedef struct BCM2835MboxState BCM2835MboxState; -#define BCM2835_MBOX(obj) \ - OBJECT_CHECK(BCM2835MboxState, (obj), TYPE_BCM2835_MBOX) +DECLARE_INSTANCE_CHECKER(BCM2835MboxState, BCM2835_MBOX, + TYPE_BCM2835_MBOX) typedef struct { uint32_t reg[MBOX_SIZE]; diff --git a/include/hw/misc/bcm2835_mphi.h b/include/hw/misc/bcm2835_mphi.h index ce1c273cfb..249511182e 100644 --- a/include/hw/misc/bcm2835_mphi.h +++ b/include/hw/misc/bcm2835_mphi.h @@ -39,7 +39,7 @@ struct BCM2835MphiState { #define TYPE_BCM2835_MPHI "bcm2835-mphi" -#define BCM2835_MPHI(obj) \ - OBJECT_CHECK(BCM2835MphiState, (obj), TYPE_BCM2835_MPHI) +DECLARE_INSTANCE_CHECKER(BCM2835MphiState, BCM2835_MPHI, + TYPE_BCM2835_MPHI) #endif diff --git a/include/hw/misc/bcm2835_property.h b/include/hw/misc/bcm2835_property.h index 28bf2b49b6..5c827a1900 100644 --- a/include/hw/misc/bcm2835_property.h +++ b/include/hw/misc/bcm2835_property.h @@ -15,8 +15,8 @@ #define TYPE_BCM2835_PROPERTY "bcm2835-property" typedef struct BCM2835PropertyState BCM2835PropertyState; -#define BCM2835_PROPERTY(obj) \ - OBJECT_CHECK(BCM2835PropertyState, (obj), TYPE_BCM2835_PROPERTY) +DECLARE_INSTANCE_CHECKER(BCM2835PropertyState, BCM2835_PROPERTY, + TYPE_BCM2835_PROPERTY) struct BCM2835PropertyState { /*< private >*/ diff --git a/include/hw/misc/bcm2835_rng.h b/include/hw/misc/bcm2835_rng.h index 0921d9b3f1..fec76eef8e 100644 --- a/include/hw/misc/bcm2835_rng.h +++ b/include/hw/misc/bcm2835_rng.h @@ -15,8 +15,8 @@ #define TYPE_BCM2835_RNG "bcm2835-rng" typedef struct BCM2835RngState BCM2835RngState; -#define BCM2835_RNG(obj) \ - OBJECT_CHECK(BCM2835RngState, (obj), TYPE_BCM2835_RNG) +DECLARE_INSTANCE_CHECKER(BCM2835RngState, BCM2835_RNG, + TYPE_BCM2835_RNG) struct BCM2835RngState { SysBusDevice busdev; diff --git a/include/hw/misc/bcm2835_thermal.h b/include/hw/misc/bcm2835_thermal.h index 2b937527eb..5b827c970e 100644 --- a/include/hw/misc/bcm2835_thermal.h +++ b/include/hw/misc/bcm2835_thermal.h @@ -15,8 +15,8 @@ #define TYPE_BCM2835_THERMAL "bcm2835-thermal" typedef struct Bcm2835ThermalState Bcm2835ThermalState; -#define BCM2835_THERMAL(obj) \ - OBJECT_CHECK(Bcm2835ThermalState, (obj), TYPE_BCM2835_THERMAL) +DECLARE_INSTANCE_CHECKER(Bcm2835ThermalState, BCM2835_THERMAL, + TYPE_BCM2835_THERMAL) struct Bcm2835ThermalState { /*< private >*/ diff --git a/include/hw/misc/grlib_ahb_apb_pnp.h b/include/hw/misc/grlib_ahb_apb_pnp.h index 427606fd6b..34b18e3193 100644 --- a/include/hw/misc/grlib_ahb_apb_pnp.h +++ b/include/hw/misc/grlib_ahb_apb_pnp.h @@ -27,13 +27,13 @@ #define TYPE_GRLIB_AHB_PNP "grlib,ahbpnp" typedef struct AHBPnp AHBPnp; -#define GRLIB_AHB_PNP(obj) \ - OBJECT_CHECK(AHBPnp, (obj), TYPE_GRLIB_AHB_PNP) +DECLARE_INSTANCE_CHECKER(AHBPnp, GRLIB_AHB_PNP, + TYPE_GRLIB_AHB_PNP) #define TYPE_GRLIB_APB_PNP "grlib,apbpnp" typedef struct APBPnp APBPnp; -#define GRLIB_APB_PNP(obj) \ - OBJECT_CHECK(APBPnp, (obj), TYPE_GRLIB_APB_PNP) +DECLARE_INSTANCE_CHECKER(APBPnp, GRLIB_APB_PNP, + TYPE_GRLIB_APB_PNP) void grlib_ahb_pnp_add_entry(AHBPnp *dev, uint32_t address, uint32_t mask, uint8_t vendor, uint16_t device, int slave, diff --git a/include/hw/misc/imx25_ccm.h b/include/hw/misc/imx25_ccm.h index 8a7a9b675f..55c5db8815 100644 --- a/include/hw/misc/imx25_ccm.h +++ b/include/hw/misc/imx25_ccm.h @@ -65,7 +65,8 @@ #define TYPE_IMX25_CCM "imx25.ccm" typedef struct IMX25CCMState IMX25CCMState; -#define IMX25_CCM(obj) OBJECT_CHECK(IMX25CCMState, (obj), TYPE_IMX25_CCM) +DECLARE_INSTANCE_CHECKER(IMX25CCMState, IMX25_CCM, + TYPE_IMX25_CCM) struct IMX25CCMState { /* */ diff --git a/include/hw/misc/imx31_ccm.h b/include/hw/misc/imx31_ccm.h index a56ee992af..25e280e976 100644 --- a/include/hw/misc/imx31_ccm.h +++ b/include/hw/misc/imx31_ccm.h @@ -74,7 +74,8 @@ #define TYPE_IMX31_CCM "imx31.ccm" typedef struct IMX31CCMState IMX31CCMState; -#define IMX31_CCM(obj) OBJECT_CHECK(IMX31CCMState, (obj), TYPE_IMX31_CCM) +DECLARE_INSTANCE_CHECKER(IMX31CCMState, IMX31_CCM, + TYPE_IMX31_CCM) struct IMX31CCMState { /* */ diff --git a/include/hw/misc/imx6_ccm.h b/include/hw/misc/imx6_ccm.h index affa13087e..85f32417d6 100644 --- a/include/hw/misc/imx6_ccm.h +++ b/include/hw/misc/imx6_ccm.h @@ -180,7 +180,8 @@ #define TYPE_IMX6_CCM "imx6.ccm" typedef struct IMX6CCMState IMX6CCMState; -#define IMX6_CCM(obj) OBJECT_CHECK(IMX6CCMState, (obj), TYPE_IMX6_CCM) +DECLARE_INSTANCE_CHECKER(IMX6CCMState, IMX6_CCM, + TYPE_IMX6_CCM) struct IMX6CCMState { /* */ diff --git a/include/hw/misc/imx6_src.h b/include/hw/misc/imx6_src.h index f1d70ec177..15b51757ba 100644 --- a/include/hw/misc/imx6_src.h +++ b/include/hw/misc/imx6_src.h @@ -59,7 +59,8 @@ #define TYPE_IMX6_SRC "imx6.src" typedef struct IMX6SRCState IMX6SRCState; -#define IMX6_SRC(obj) OBJECT_CHECK(IMX6SRCState, (obj), TYPE_IMX6_SRC) +DECLARE_INSTANCE_CHECKER(IMX6SRCState, IMX6_SRC, + TYPE_IMX6_SRC) struct IMX6SRCState { /* */ diff --git a/include/hw/misc/imx6ul_ccm.h b/include/hw/misc/imx6ul_ccm.h index 2304c6e738..d614de0edd 100644 --- a/include/hw/misc/imx6ul_ccm.h +++ b/include/hw/misc/imx6ul_ccm.h @@ -209,7 +209,8 @@ #define TYPE_IMX6UL_CCM "imx6ul.ccm" typedef struct IMX6ULCCMState IMX6ULCCMState; -#define IMX6UL_CCM(obj) OBJECT_CHECK(IMX6ULCCMState, (obj), TYPE_IMX6UL_CCM) +DECLARE_INSTANCE_CHECKER(IMX6ULCCMState, IMX6UL_CCM, + TYPE_IMX6UL_CCM) struct IMX6ULCCMState { /* */ diff --git a/include/hw/misc/imx7_ccm.h b/include/hw/misc/imx7_ccm.h index 9e9e58a5c2..e2757622d0 100644 --- a/include/hw/misc/imx7_ccm.h +++ b/include/hw/misc/imx7_ccm.h @@ -106,7 +106,8 @@ enum IMX7PMURegisters { #define TYPE_IMX7_CCM "imx7.ccm" typedef struct IMX7CCMState IMX7CCMState; -#define IMX7_CCM(obj) OBJECT_CHECK(IMX7CCMState, (obj), TYPE_IMX7_CCM) +DECLARE_INSTANCE_CHECKER(IMX7CCMState, IMX7_CCM, + TYPE_IMX7_CCM) struct IMX7CCMState { /* */ @@ -121,7 +122,8 @@ struct IMX7CCMState { #define TYPE_IMX7_ANALOG "imx7.analog" typedef struct IMX7AnalogState IMX7AnalogState; -#define IMX7_ANALOG(obj) OBJECT_CHECK(IMX7AnalogState, (obj), TYPE_IMX7_ANALOG) +DECLARE_INSTANCE_CHECKER(IMX7AnalogState, IMX7_ANALOG, + TYPE_IMX7_ANALOG) struct IMX7AnalogState { /* */ diff --git a/include/hw/misc/imx7_gpr.h b/include/hw/misc/imx7_gpr.h index 83384ec0cc..f80b3ed28c 100644 --- a/include/hw/misc/imx7_gpr.h +++ b/include/hw/misc/imx7_gpr.h @@ -18,7 +18,8 @@ #define TYPE_IMX7_GPR "imx7.gpr" typedef struct IMX7GPRState IMX7GPRState; -#define IMX7_GPR(obj) OBJECT_CHECK(IMX7GPRState, (obj), TYPE_IMX7_GPR) +DECLARE_INSTANCE_CHECKER(IMX7GPRState, IMX7_GPR, + TYPE_IMX7_GPR) struct IMX7GPRState { /* */ diff --git a/include/hw/misc/imx7_snvs.h b/include/hw/misc/imx7_snvs.h index f8659acb7d..ea5395c107 100644 --- a/include/hw/misc/imx7_snvs.h +++ b/include/hw/misc/imx7_snvs.h @@ -25,7 +25,8 @@ enum IMX7SNVSRegisters { #define TYPE_IMX7_SNVS "imx7.snvs" typedef struct IMX7SNVSState IMX7SNVSState; -#define IMX7_SNVS(obj) OBJECT_CHECK(IMX7SNVSState, (obj), TYPE_IMX7_SNVS) +DECLARE_INSTANCE_CHECKER(IMX7SNVSState, IMX7_SNVS, + TYPE_IMX7_SNVS) struct IMX7SNVSState { /* */ diff --git a/include/hw/misc/imx_rngc.h b/include/hw/misc/imx_rngc.h index cd7ba8f91e..f7b569cac5 100644 --- a/include/hw/misc/imx_rngc.h +++ b/include/hw/misc/imx_rngc.h @@ -15,7 +15,8 @@ #define TYPE_IMX_RNGC "imx.rngc" typedef struct IMXRNGCState IMXRNGCState; -#define IMX_RNGC(obj) OBJECT_CHECK(IMXRNGCState, (obj), TYPE_IMX_RNGC) +DECLARE_INSTANCE_CHECKER(IMXRNGCState, IMX_RNGC, + TYPE_IMX_RNGC) struct IMXRNGCState { /*< private >*/ diff --git a/include/hw/misc/iotkit-secctl.h b/include/hw/misc/iotkit-secctl.h index 3d54d8f3de..d062ed43e7 100644 --- a/include/hw/misc/iotkit-secctl.h +++ b/include/hw/misc/iotkit-secctl.h @@ -60,7 +60,8 @@ #define TYPE_IOTKIT_SECCTL "iotkit-secctl" typedef struct IoTKitSecCtl IoTKitSecCtl; -#define IOTKIT_SECCTL(obj) OBJECT_CHECK(IoTKitSecCtl, (obj), TYPE_IOTKIT_SECCTL) +DECLARE_INSTANCE_CHECKER(IoTKitSecCtl, IOTKIT_SECCTL, + TYPE_IOTKIT_SECCTL) #define IOTS_APB_PPC0_NUM_PORTS 3 #define IOTS_APB_PPC1_NUM_PORTS 1 diff --git a/include/hw/misc/iotkit-sysctl.h b/include/hw/misc/iotkit-sysctl.h index 27fe6346e6..22ceb5d76d 100644 --- a/include/hw/misc/iotkit-sysctl.h +++ b/include/hw/misc/iotkit-sysctl.h @@ -32,8 +32,8 @@ #define TYPE_IOTKIT_SYSCTL "iotkit-sysctl" typedef struct IoTKitSysCtl IoTKitSysCtl; -#define IOTKIT_SYSCTL(obj) OBJECT_CHECK(IoTKitSysCtl, (obj), \ - TYPE_IOTKIT_SYSCTL) +DECLARE_INSTANCE_CHECKER(IoTKitSysCtl, IOTKIT_SYSCTL, + TYPE_IOTKIT_SYSCTL) struct IoTKitSysCtl { /*< private >*/ diff --git a/include/hw/misc/iotkit-sysinfo.h b/include/hw/misc/iotkit-sysinfo.h index e0e610c75c..23ae43e549 100644 --- a/include/hw/misc/iotkit-sysinfo.h +++ b/include/hw/misc/iotkit-sysinfo.h @@ -27,8 +27,8 @@ #define TYPE_IOTKIT_SYSINFO "iotkit-sysinfo" typedef struct IoTKitSysInfo IoTKitSysInfo; -#define IOTKIT_SYSINFO(obj) OBJECT_CHECK(IoTKitSysInfo, (obj), \ - TYPE_IOTKIT_SYSINFO) +DECLARE_INSTANCE_CHECKER(IoTKitSysInfo, IOTKIT_SYSINFO, + TYPE_IOTKIT_SYSINFO) struct IoTKitSysInfo { /*< private >*/ diff --git a/include/hw/misc/mac_via.h b/include/hw/misc/mac_via.h index a59750634f..862cbba3ab 100644 --- a/include/hw/misc/mac_via.h +++ b/include/hw/misc/mac_via.h @@ -33,8 +33,8 @@ #define TYPE_MOS6522_Q800_VIA1 "mos6522-q800-via1" typedef struct MOS6522Q800VIA1State MOS6522Q800VIA1State; -#define MOS6522_Q800_VIA1(obj) OBJECT_CHECK(MOS6522Q800VIA1State, (obj), \ - TYPE_MOS6522_Q800_VIA1) +DECLARE_INSTANCE_CHECKER(MOS6522Q800VIA1State, MOS6522_Q800_VIA1, + TYPE_MOS6522_Q800_VIA1) struct MOS6522Q800VIA1State { /*< private >*/ @@ -69,8 +69,8 @@ struct MOS6522Q800VIA1State { #define TYPE_MOS6522_Q800_VIA2 "mos6522-q800-via2" typedef struct MOS6522Q800VIA2State MOS6522Q800VIA2State; -#define MOS6522_Q800_VIA2(obj) OBJECT_CHECK(MOS6522Q800VIA2State, (obj), \ - TYPE_MOS6522_Q800_VIA2) +DECLARE_INSTANCE_CHECKER(MOS6522Q800VIA2State, MOS6522_Q800_VIA2, + TYPE_MOS6522_Q800_VIA2) struct MOS6522Q800VIA2State { /*< private >*/ @@ -80,7 +80,8 @@ struct MOS6522Q800VIA2State { #define TYPE_MAC_VIA "mac_via" typedef struct MacVIAState MacVIAState; -#define MAC_VIA(obj) OBJECT_CHECK(MacVIAState, (obj), TYPE_MAC_VIA) +DECLARE_INSTANCE_CHECKER(MacVIAState, MAC_VIA, + TYPE_MAC_VIA) struct MacVIAState { SysBusDevice busdev; diff --git a/include/hw/misc/macio/cuda.h b/include/hw/misc/macio/cuda.h index f2b0069262..e738b6376f 100644 --- a/include/hw/misc/macio/cuda.h +++ b/include/hw/misc/macio/cuda.h @@ -66,13 +66,14 @@ struct MOS6522CUDAState { typedef struct MOS6522CUDAState MOS6522CUDAState; #define TYPE_MOS6522_CUDA "mos6522-cuda" -#define MOS6522_CUDA(obj) OBJECT_CHECK(MOS6522CUDAState, (obj), \ - TYPE_MOS6522_CUDA) +DECLARE_INSTANCE_CHECKER(MOS6522CUDAState, MOS6522_CUDA, + TYPE_MOS6522_CUDA) /* Cuda */ #define TYPE_CUDA "cuda" typedef struct CUDAState CUDAState; -#define CUDA(obj) OBJECT_CHECK(CUDAState, (obj), TYPE_CUDA) +DECLARE_INSTANCE_CHECKER(CUDAState, CUDA, + TYPE_CUDA) struct CUDAState { /*< private >*/ diff --git a/include/hw/misc/macio/gpio.h b/include/hw/misc/macio/gpio.h index 2234873250..1d0c8434ae 100644 --- a/include/hw/misc/macio/gpio.h +++ b/include/hw/misc/macio/gpio.h @@ -32,7 +32,8 @@ #define TYPE_MACIO_GPIO "macio-gpio" typedef struct MacIOGPIOState MacIOGPIOState; -#define MACIO_GPIO(obj) OBJECT_CHECK(MacIOGPIOState, (obj), TYPE_MACIO_GPIO) +DECLARE_INSTANCE_CHECKER(MacIOGPIOState, MACIO_GPIO, + TYPE_MACIO_GPIO) struct MacIOGPIOState { /*< private >*/ diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 81c28eeef7..02dbf37630 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -41,7 +41,8 @@ /* MacIO virtual bus */ #define TYPE_MACIO_BUS "macio-bus" typedef struct MacIOBusState MacIOBusState; -#define MACIO_BUS(obj) OBJECT_CHECK(MacIOBusState, (obj), TYPE_MACIO_BUS) +DECLARE_INSTANCE_CHECKER(MacIOBusState, MACIO_BUS, + TYPE_MACIO_BUS) struct MacIOBusState { /*< private >*/ @@ -51,7 +52,8 @@ struct MacIOBusState { /* MacIO IDE */ #define TYPE_MACIO_IDE "macio-ide" typedef struct MACIOIDEState MACIOIDEState; -#define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE) +DECLARE_INSTANCE_CHECKER(MACIOIDEState, MACIO_IDE, + TYPE_MACIO_IDE) struct MACIOIDEState { /*< private >*/ @@ -78,7 +80,8 @@ void macio_ide_register_dma(MACIOIDEState *ide); #define TYPE_MACIO "macio" typedef struct MacIOState MacIOState; -#define MACIO(obj) OBJECT_CHECK(MacIOState, (obj), TYPE_MACIO) +DECLARE_INSTANCE_CHECKER(MacIOState, MACIO, + TYPE_MACIO) struct MacIOState { /*< private >*/ @@ -96,8 +99,8 @@ struct MacIOState { #define TYPE_OLDWORLD_MACIO "macio-oldworld" typedef struct OldWorldMacIOState OldWorldMacIOState; -#define OLDWORLD_MACIO(obj) \ - OBJECT_CHECK(OldWorldMacIOState, (obj), TYPE_OLDWORLD_MACIO) +DECLARE_INSTANCE_CHECKER(OldWorldMacIOState, OLDWORLD_MACIO, + TYPE_OLDWORLD_MACIO) struct OldWorldMacIOState { /*< private >*/ @@ -112,8 +115,8 @@ struct OldWorldMacIOState { #define TYPE_NEWWORLD_MACIO "macio-newworld" typedef struct NewWorldMacIOState NewWorldMacIOState; -#define NEWWORLD_MACIO(obj) \ - OBJECT_CHECK(NewWorldMacIOState, (obj), TYPE_NEWWORLD_MACIO) +DECLARE_INSTANCE_CHECKER(NewWorldMacIOState, NEWWORLD_MACIO, + TYPE_NEWWORLD_MACIO) struct NewWorldMacIOState { /*< private >*/ diff --git a/include/hw/misc/macio/pmu.h b/include/hw/misc/macio/pmu.h index b3982f6f32..0d1a5c1406 100644 --- a/include/hw/misc/macio/pmu.h +++ b/include/hw/misc/macio/pmu.h @@ -181,8 +181,8 @@ struct MOS6522PMUState { typedef struct MOS6522PMUState MOS6522PMUState; #define TYPE_MOS6522_PMU "mos6522-pmu" -#define MOS6522_PMU(obj) OBJECT_CHECK(MOS6522PMUState, (obj), \ - TYPE_MOS6522_PMU) +DECLARE_INSTANCE_CHECKER(MOS6522PMUState, MOS6522_PMU, + TYPE_MOS6522_PMU) /** * PMUState: * @last_b: last value of B register @@ -234,6 +234,7 @@ struct PMUState { typedef struct PMUState PMUState; #define TYPE_VIA_PMU "via-pmu" -#define VIA_PMU(obj) OBJECT_CHECK(PMUState, (obj), TYPE_VIA_PMU) +DECLARE_INSTANCE_CHECKER(PMUState, VIA_PMU, + TYPE_VIA_PMU) #endif /* PMU_H */ diff --git a/include/hw/misc/max111x.h b/include/hw/misc/max111x.h index e903a1af9c..6350a3f7c0 100644 --- a/include/hw/misc/max111x.h +++ b/include/hw/misc/max111x.h @@ -49,8 +49,8 @@ typedef struct MAX111xState MAX111xState; #define TYPE_MAX_111X "max111x" -#define MAX_111X(obj) \ - OBJECT_CHECK(MAX111xState, (obj), TYPE_MAX_111X) +DECLARE_INSTANCE_CHECKER(MAX111xState, MAX_111X, + TYPE_MAX_111X) #define TYPE_MAX_1110 "max1110" #define TYPE_MAX_1111 "max1111" diff --git a/include/hw/misc/mips_cmgcr.h b/include/hw/misc/mips_cmgcr.h index a334be8edd..923df4f112 100644 --- a/include/hw/misc/mips_cmgcr.h +++ b/include/hw/misc/mips_cmgcr.h @@ -15,7 +15,8 @@ #define TYPE_MIPS_GCR "mips-gcr" typedef struct MIPSGCRState MIPSGCRState; -#define MIPS_GCR(obj) OBJECT_CHECK(MIPSGCRState, (obj), TYPE_MIPS_GCR) +DECLARE_INSTANCE_CHECKER(MIPSGCRState, MIPS_GCR, + TYPE_MIPS_GCR) #define GCR_BASE_ADDR 0x1fbf8000ULL #define GCR_ADDRSPACE_SZ 0x8000 diff --git a/include/hw/misc/mips_cpc.h b/include/hw/misc/mips_cpc.h index b0131e4a54..7dc188e8a2 100644 --- a/include/hw/misc/mips_cpc.h +++ b/include/hw/misc/mips_cpc.h @@ -36,7 +36,8 @@ #define TYPE_MIPS_CPC "mips-cpc" typedef struct MIPSCPCState MIPSCPCState; -#define MIPS_CPC(obj) OBJECT_CHECK(MIPSCPCState, (obj), TYPE_MIPS_CPC) +DECLARE_INSTANCE_CHECKER(MIPSCPCState, MIPS_CPC, + TYPE_MIPS_CPC) struct MIPSCPCState { SysBusDevice parent_obj; diff --git a/include/hw/misc/mips_itu.h b/include/hw/misc/mips_itu.h index 9ddb04708a..7c19f61fbb 100644 --- a/include/hw/misc/mips_itu.h +++ b/include/hw/misc/mips_itu.h @@ -25,7 +25,8 @@ #define TYPE_MIPS_ITU "mips-itu" typedef struct MIPSITUState MIPSITUState; -#define MIPS_ITU(obj) OBJECT_CHECK(MIPSITUState, (obj), TYPE_MIPS_ITU) +DECLARE_INSTANCE_CHECKER(MIPSITUState, MIPS_ITU, + TYPE_MIPS_ITU) #define ITC_CELL_DEPTH_SHIFT 2 #define ITC_CELL_DEPTH (1u << ITC_CELL_DEPTH_SHIFT) diff --git a/include/hw/misc/mps2-fpgaio.h b/include/hw/misc/mps2-fpgaio.h index e844041bb0..991f5b731e 100644 --- a/include/hw/misc/mps2-fpgaio.h +++ b/include/hw/misc/mps2-fpgaio.h @@ -26,7 +26,8 @@ #define TYPE_MPS2_FPGAIO "mps2-fpgaio" typedef struct MPS2FPGAIO MPS2FPGAIO; -#define MPS2_FPGAIO(obj) OBJECT_CHECK(MPS2FPGAIO, (obj), TYPE_MPS2_FPGAIO) +DECLARE_INSTANCE_CHECKER(MPS2FPGAIO, MPS2_FPGAIO, + TYPE_MPS2_FPGAIO) struct MPS2FPGAIO { /*< private >*/ diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h index 10393c4e3a..445e268b1f 100644 --- a/include/hw/misc/mps2-scc.h +++ b/include/hw/misc/mps2-scc.h @@ -17,7 +17,8 @@ #define TYPE_MPS2_SCC "mps2-scc" typedef struct MPS2SCC MPS2SCC; -#define MPS2_SCC(obj) OBJECT_CHECK(MPS2SCC, (obj), TYPE_MPS2_SCC) +DECLARE_INSTANCE_CHECKER(MPS2SCC, MPS2_SCC, + TYPE_MPS2_SCC) #define NUM_OSCCLK 3 diff --git a/include/hw/misc/msf2-sysreg.h b/include/hw/misc/msf2-sysreg.h index 6b5d03608a..625932354a 100644 --- a/include/hw/misc/msf2-sysreg.h +++ b/include/hw/misc/msf2-sysreg.h @@ -63,7 +63,8 @@ enum { #define TYPE_MSF2_SYSREG "msf2-sysreg" typedef struct MSF2SysregState MSF2SysregState; -#define MSF2_SYSREG(obj) OBJECT_CHECK(MSF2SysregState, (obj), TYPE_MSF2_SYSREG) +DECLARE_INSTANCE_CHECKER(MSF2SysregState, MSF2_SYSREG, + TYPE_MSF2_SYSREG) struct MSF2SysregState { SysBusDevice parent_obj; diff --git a/include/hw/misc/nrf51_rng.h b/include/hw/misc/nrf51_rng.h index 247f167100..7f2263a906 100644 --- a/include/hw/misc/nrf51_rng.h +++ b/include/hw/misc/nrf51_rng.h @@ -39,7 +39,8 @@ #include "qom/object.h" #define TYPE_NRF51_RNG "nrf51_soc.rng" typedef struct NRF51RNGState NRF51RNGState; -#define NRF51_RNG(obj) OBJECT_CHECK(NRF51RNGState, (obj), TYPE_NRF51_RNG) +DECLARE_INSTANCE_CHECKER(NRF51RNGState, NRF51_RNG, + TYPE_NRF51_RNG) #define NRF51_RNG_SIZE 0x1000 diff --git a/include/hw/misc/pca9552.h b/include/hw/misc/pca9552.h index ebf8425903..b6f4e264fe 100644 --- a/include/hw/misc/pca9552.h +++ b/include/hw/misc/pca9552.h @@ -15,7 +15,8 @@ #define TYPE_PCA9552 "pca9552" #define TYPE_PCA955X "pca955x" typedef struct PCA955xState PCA955xState; -#define PCA955X(obj) OBJECT_CHECK(PCA955xState, (obj), TYPE_PCA955X) +DECLARE_INSTANCE_CHECKER(PCA955xState, PCA955X, + TYPE_PCA955X) #define PCA955X_NR_REGS 10 #define PCA955X_PIN_COUNT_MAX 16 diff --git a/include/hw/misc/stm32f2xx_syscfg.h b/include/hw/misc/stm32f2xx_syscfg.h index ff7c976d66..82ccd7cc24 100644 --- a/include/hw/misc/stm32f2xx_syscfg.h +++ b/include/hw/misc/stm32f2xx_syscfg.h @@ -38,8 +38,8 @@ #define TYPE_STM32F2XX_SYSCFG "stm32f2xx-syscfg" typedef struct STM32F2XXSyscfgState STM32F2XXSyscfgState; -#define STM32F2XX_SYSCFG(obj) \ - OBJECT_CHECK(STM32F2XXSyscfgState, (obj), TYPE_STM32F2XX_SYSCFG) +DECLARE_INSTANCE_CHECKER(STM32F2XXSyscfgState, STM32F2XX_SYSCFG, + TYPE_STM32F2XX_SYSCFG) struct STM32F2XXSyscfgState { /* */ diff --git a/include/hw/misc/stm32f4xx_exti.h b/include/hw/misc/stm32f4xx_exti.h index 7132615785..4987c286ed 100644 --- a/include/hw/misc/stm32f4xx_exti.h +++ b/include/hw/misc/stm32f4xx_exti.h @@ -38,8 +38,8 @@ #define TYPE_STM32F4XX_EXTI "stm32f4xx-exti" typedef struct STM32F4xxExtiState STM32F4xxExtiState; -#define STM32F4XX_EXTI(obj) \ - OBJECT_CHECK(STM32F4xxExtiState, (obj), TYPE_STM32F4XX_EXTI) +DECLARE_INSTANCE_CHECKER(STM32F4xxExtiState, STM32F4XX_EXTI, + TYPE_STM32F4XX_EXTI) #define NUM_GPIO_EVENT_IN_LINES 16 #define NUM_INTERRUPT_OUT_LINES 16 diff --git a/include/hw/misc/stm32f4xx_syscfg.h b/include/hw/misc/stm32f4xx_syscfg.h index 78130cb9c3..c3d89d4536 100644 --- a/include/hw/misc/stm32f4xx_syscfg.h +++ b/include/hw/misc/stm32f4xx_syscfg.h @@ -39,8 +39,8 @@ #define TYPE_STM32F4XX_SYSCFG "stm32f4xx-syscfg" typedef struct STM32F4xxSyscfgState STM32F4xxSyscfgState; -#define STM32F4XX_SYSCFG(obj) \ - OBJECT_CHECK(STM32F4xxSyscfgState, (obj), TYPE_STM32F4XX_SYSCFG) +DECLARE_INSTANCE_CHECKER(STM32F4xxSyscfgState, STM32F4XX_SYSCFG, + TYPE_STM32F4XX_SYSCFG) #define SYSCFG_NUM_EXTICR 4 diff --git a/include/hw/misc/tz-mpc.h b/include/hw/misc/tz-mpc.h index 2d3eae0834..34e45fdb97 100644 --- a/include/hw/misc/tz-mpc.h +++ b/include/hw/misc/tz-mpc.h @@ -36,7 +36,8 @@ #define TYPE_TZ_MPC "tz-mpc" typedef struct TZMPC TZMPC; -#define TZ_MPC(obj) OBJECT_CHECK(TZMPC, (obj), TYPE_TZ_MPC) +DECLARE_INSTANCE_CHECKER(TZMPC, TZ_MPC, + TYPE_TZ_MPC) #define TZ_NUM_PORTS 16 diff --git a/include/hw/misc/tz-msc.h b/include/hw/misc/tz-msc.h index 3f719833a9..7169f330ff 100644 --- a/include/hw/misc/tz-msc.h +++ b/include/hw/misc/tz-msc.h @@ -56,7 +56,8 @@ #define TYPE_TZ_MSC "tz-msc" typedef struct TZMSC TZMSC; -#define TZ_MSC(obj) OBJECT_CHECK(TZMSC, (obj), TYPE_TZ_MSC) +DECLARE_INSTANCE_CHECKER(TZMSC, TZ_MSC, + TYPE_TZ_MSC) struct TZMSC { /*< private >*/ diff --git a/include/hw/misc/tz-ppc.h b/include/hw/misc/tz-ppc.h index 4646005fa5..b5251b715e 100644 --- a/include/hw/misc/tz-ppc.h +++ b/include/hw/misc/tz-ppc.h @@ -70,7 +70,8 @@ #define TYPE_TZ_PPC "tz-ppc" typedef struct TZPPC TZPPC; -#define TZ_PPC(obj) OBJECT_CHECK(TZPPC, (obj), TYPE_TZ_PPC) +DECLARE_INSTANCE_CHECKER(TZPPC, TZ_PPC, + TYPE_TZ_PPC) #define TZ_NUM_PORTS 16 diff --git a/include/hw/misc/unimp.h b/include/hw/misc/unimp.h index 8d537df3f9..276e739868 100644 --- a/include/hw/misc/unimp.h +++ b/include/hw/misc/unimp.h @@ -16,8 +16,8 @@ #define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device" typedef struct UnimplementedDeviceState UnimplementedDeviceState; -#define UNIMPLEMENTED_DEVICE(obj) \ - OBJECT_CHECK(UnimplementedDeviceState, (obj), TYPE_UNIMPLEMENTED_DEVICE) +DECLARE_INSTANCE_CHECKER(UnimplementedDeviceState, UNIMPLEMENTED_DEVICE, + TYPE_UNIMPLEMENTED_DEVICE) struct UnimplementedDeviceState { SysBusDevice parent_obj; diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h index cf0e51f863..ebada6617a 100644 --- a/include/hw/misc/vmcoreinfo.h +++ b/include/hw/misc/vmcoreinfo.h @@ -18,7 +18,8 @@ #define VMCOREINFO_DEVICE "vmcoreinfo" typedef struct VMCoreInfoState VMCoreInfoState; -#define VMCOREINFO(obj) OBJECT_CHECK(VMCoreInfoState, (obj), VMCOREINFO_DEVICE) +DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO, + VMCOREINFO_DEVICE) typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo; diff --git a/include/hw/misc/zynq-xadc.h b/include/hw/misc/zynq-xadc.h index 7e9767c74f..052f47954f 100644 --- a/include/hw/misc/zynq-xadc.h +++ b/include/hw/misc/zynq-xadc.h @@ -25,8 +25,8 @@ #define TYPE_ZYNQ_XADC "xlnx,zynq-xadc" typedef struct ZynqXADCState ZynqXADCState; -#define ZYNQ_XADC(obj) \ - OBJECT_CHECK(ZynqXADCState, (obj), TYPE_ZYNQ_XADC) +DECLARE_INSTANCE_CHECKER(ZynqXADCState, ZYNQ_XADC, + TYPE_ZYNQ_XADC) struct ZynqXADCState { /*< private >*/ diff --git a/include/hw/net/allwinner-sun8i-emac.h b/include/hw/net/allwinner-sun8i-emac.h index d39a8f0bf3..11c0911ad9 100644 --- a/include/hw/net/allwinner-sun8i-emac.h +++ b/include/hw/net/allwinner-sun8i-emac.h @@ -31,8 +31,8 @@ #define TYPE_AW_SUN8I_EMAC "allwinner-sun8i-emac" typedef struct AwSun8iEmacState AwSun8iEmacState; -#define AW_SUN8I_EMAC(obj) \ - OBJECT_CHECK(AwSun8iEmacState, (obj), TYPE_AW_SUN8I_EMAC) +DECLARE_INSTANCE_CHECKER(AwSun8iEmacState, AW_SUN8I_EMAC, + TYPE_AW_SUN8I_EMAC) /** @} */ diff --git a/include/hw/net/allwinner_emac.h b/include/hw/net/allwinner_emac.h index e927082580..f5f5b67939 100644 --- a/include/hw/net/allwinner_emac.h +++ b/include/hw/net/allwinner_emac.h @@ -32,7 +32,8 @@ #define TYPE_AW_EMAC "allwinner-emac" typedef struct AwEmacState AwEmacState; -#define AW_EMAC(obj) OBJECT_CHECK(AwEmacState, (obj), TYPE_AW_EMAC) +DECLARE_INSTANCE_CHECKER(AwEmacState, AW_EMAC, + TYPE_AW_EMAC) /* * Allwinner EMAC register list diff --git a/include/hw/net/cadence_gem.h b/include/hw/net/cadence_gem.h index 04fd59a525..dff1083738 100644 --- a/include/hw/net/cadence_gem.h +++ b/include/hw/net/cadence_gem.h @@ -28,7 +28,8 @@ #define TYPE_CADENCE_GEM "cadence_gem" typedef struct CadenceGEMState CadenceGEMState; -#define CADENCE_GEM(obj) OBJECT_CHECK(CadenceGEMState, (obj), TYPE_CADENCE_GEM) +DECLARE_INSTANCE_CHECKER(CadenceGEMState, CADENCE_GEM, + TYPE_CADENCE_GEM) #include "net/net.h" #include "hw/sysbus.h" diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h index 6371bf60ab..c6b1c11fca 100644 --- a/include/hw/net/ftgmac100.h +++ b/include/hw/net/ftgmac100.h @@ -13,7 +13,8 @@ #define TYPE_FTGMAC100 "ftgmac100" typedef struct FTGMAC100State FTGMAC100State; -#define FTGMAC100(obj) OBJECT_CHECK(FTGMAC100State, (obj), TYPE_FTGMAC100) +DECLARE_INSTANCE_CHECKER(FTGMAC100State, FTGMAC100, + TYPE_FTGMAC100) #include "hw/sysbus.h" #include "net/net.h" @@ -70,7 +71,8 @@ struct FTGMAC100State { #define TYPE_ASPEED_MII "aspeed-mmi" typedef struct AspeedMiiState AspeedMiiState; -#define ASPEED_MII(obj) OBJECT_CHECK(AspeedMiiState, (obj), TYPE_ASPEED_MII) +DECLARE_INSTANCE_CHECKER(AspeedMiiState, ASPEED_MII, + TYPE_ASPEED_MII) /* * AST2600 MII controller diff --git a/include/hw/net/imx_fec.h b/include/hw/net/imx_fec.h index 4d6ac5e408..ffdbc304b6 100644 --- a/include/hw/net/imx_fec.h +++ b/include/hw/net/imx_fec.h @@ -27,7 +27,8 @@ #define TYPE_IMX_FEC "imx.fec" typedef struct IMXFECState IMXFECState; -#define IMX_FEC(obj) OBJECT_CHECK(IMXFECState, (obj), TYPE_IMX_FEC) +DECLARE_INSTANCE_CHECKER(IMXFECState, IMX_FEC, + TYPE_IMX_FEC) #define TYPE_IMX_ENET "imx.enet" diff --git a/include/hw/net/lance.h b/include/hw/net/lance.h index fe459ffea7..f645d6af67 100644 --- a/include/hw/net/lance.h +++ b/include/hw/net/lance.h @@ -36,8 +36,8 @@ #define TYPE_LANCE "lance" typedef struct SysBusPCNetState SysBusPCNetState; -#define SYSBUS_PCNET(obj) \ - OBJECT_CHECK(SysBusPCNetState, (obj), TYPE_LANCE) +DECLARE_INSTANCE_CHECKER(SysBusPCNetState, SYSBUS_PCNET, + TYPE_LANCE) struct SysBusPCNetState { SysBusDevice parent_obj; diff --git a/include/hw/net/lasi_82596.h b/include/hw/net/lasi_82596.h index 141e0cc17a..7b62b04833 100644 --- a/include/hw/net/lasi_82596.h +++ b/include/hw/net/lasi_82596.h @@ -14,8 +14,8 @@ #define TYPE_LASI_82596 "lasi_82596" typedef struct SysBusI82596State SysBusI82596State; -#define SYSBUS_I82596(obj) \ - OBJECT_CHECK(SysBusI82596State, (obj), TYPE_LASI_82596) +DECLARE_INSTANCE_CHECKER(SysBusI82596State, SYSBUS_I82596, + TYPE_LASI_82596) struct SysBusI82596State { SysBusDevice parent_obj; diff --git a/include/hw/net/msf2-emac.h b/include/hw/net/msf2-emac.h index 6aef711007..68194d798c 100644 --- a/include/hw/net/msf2-emac.h +++ b/include/hw/net/msf2-emac.h @@ -30,8 +30,8 @@ #define TYPE_MSS_EMAC "msf2-emac" typedef struct MSF2EmacState MSF2EmacState; -#define MSS_EMAC(obj) \ - OBJECT_CHECK(MSF2EmacState, (obj), TYPE_MSS_EMAC) +DECLARE_INSTANCE_CHECKER(MSF2EmacState, MSS_EMAC, + TYPE_MSS_EMAC) #define R_MAX (0x1a0 / 4) #define PHY_MAX_REGS 32 diff --git a/include/hw/nmi.h b/include/hw/nmi.h index 47fc036e74..fff41bebc6 100644 --- a/include/hw/nmi.h +++ b/include/hw/nmi.h @@ -27,10 +27,8 @@ #define TYPE_NMI "nmi" typedef struct NMIClass NMIClass; -#define NMI_CLASS(klass) \ - OBJECT_CLASS_CHECK(NMIClass, (klass), TYPE_NMI) -#define NMI_GET_CLASS(obj) \ - OBJECT_GET_CLASS(NMIClass, (obj), TYPE_NMI) +DECLARE_CLASS_CHECKERS(NMIClass, NMI, + TYPE_NMI) #define NMI(obj) \ INTERFACE_CHECK(NMIState, (obj), TYPE_NMI) diff --git a/include/hw/nubus/mac-nubus-bridge.h b/include/hw/nubus/mac-nubus-bridge.h index 8407ad21f6..6856d7e095 100644 --- a/include/hw/nubus/mac-nubus-bridge.h +++ b/include/hw/nubus/mac-nubus-bridge.h @@ -14,8 +14,8 @@ #define TYPE_MAC_NUBUS_BRIDGE "mac-nubus-bridge" typedef struct MacNubusState MacNubusState; -#define MAC_NUBUS_BRIDGE(obj) OBJECT_CHECK(MacNubusState, (obj), \ - TYPE_MAC_NUBUS_BRIDGE) +DECLARE_INSTANCE_CHECKER(MacNubusState, MAC_NUBUS_BRIDGE, + TYPE_MAC_NUBUS_BRIDGE) struct MacNubusState { SysBusDevice sysbus_dev; diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 226efb2ff7..9370f0d8f0 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -24,12 +24,13 @@ #define TYPE_NUBUS_DEVICE "nubus-device" typedef struct NubusDevice NubusDevice; -#define NUBUS_DEVICE(obj) \ - OBJECT_CHECK(NubusDevice, (obj), TYPE_NUBUS_DEVICE) +DECLARE_INSTANCE_CHECKER(NubusDevice, NUBUS_DEVICE, + TYPE_NUBUS_DEVICE) #define TYPE_NUBUS_BUS "nubus-bus" typedef struct NubusBus NubusBus; -#define NUBUS_BUS(obj) OBJECT_CHECK(NubusBus, (obj), TYPE_NUBUS_BUS) +DECLARE_INSTANCE_CHECKER(NubusBus, NUBUS_BUS, + TYPE_NUBUS_BUS) #define TYPE_NUBUS_BRIDGE "nubus-bridge" diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 5e00fdc21e..f101ff7bab 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -17,12 +17,8 @@ #define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM) typedef struct FWCfgDataGeneratorClass FWCfgDataGeneratorClass; -#define FW_CFG_DATA_GENERATOR_CLASS(class) \ - OBJECT_CLASS_CHECK(FWCfgDataGeneratorClass, (class), \ +DECLARE_CLASS_CHECKERS(FWCfgDataGeneratorClass, FW_CFG_DATA_GENERATOR, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE) -#define FW_CFG_DATA_GENERATOR_GET_CLASS(obj) \ - OBJECT_GET_CLASS(FWCfgDataGeneratorClass, (obj), \ - TYPE_FW_CFG_DATA_GENERATOR_INTERFACE) struct FWCfgDataGeneratorClass { /*< private >*/ diff --git a/include/hw/nvram/nrf51_nvm.h b/include/hw/nvram/nrf51_nvm.h index 48871667f1..ab99b09206 100644 --- a/include/hw/nvram/nrf51_nvm.h +++ b/include/hw/nvram/nrf51_nvm.h @@ -26,7 +26,8 @@ #include "qom/object.h" #define TYPE_NRF51_NVM "nrf51_soc.nvm" typedef struct NRF51NVMState NRF51NVMState; -#define NRF51_NVM(obj) OBJECT_CHECK(NRF51NVMState, (obj), TYPE_NRF51_NVM) +DECLARE_INSTANCE_CHECKER(NRF51NVMState, NRF51_NVM, + TYPE_NRF51_NVM) #define NRF51_UICR_FIXTURE_SIZE 64 diff --git a/include/hw/or-irq.h b/include/hw/or-irq.h index 0038bfbe3d..f2f0a27381 100644 --- a/include/hw/or-irq.h +++ b/include/hw/or-irq.h @@ -37,7 +37,8 @@ typedef struct OrIRQState qemu_or_irq; -#define OR_IRQ(obj) OBJECT_CHECK(qemu_or_irq, (obj), TYPE_OR_IRQ) +DECLARE_INSTANCE_CHECKER(qemu_or_irq, OR_IRQ, + TYPE_OR_IRQ) struct OrIRQState { DeviceState parent_obj; diff --git a/include/hw/pci-bridge/simba.h b/include/hw/pci-bridge/simba.h index 300379b94d..675aa5a990 100644 --- a/include/hw/pci-bridge/simba.h +++ b/include/hw/pci-bridge/simba.h @@ -38,7 +38,7 @@ struct SimbaPCIBridge { typedef struct SimbaPCIBridge SimbaPCIBridge; #define TYPE_SIMBA_PCI_BRIDGE "pbm-bridge" -#define SIMBA_PCI_BRIDGE(obj) \ - OBJECT_CHECK(SimbaPCIBridge, (obj), TYPE_SIMBA_PCI_BRIDGE) +DECLARE_INSTANCE_CHECKER(SimbaPCIBridge, SIMBA_PCI_BRIDGE, + TYPE_SIMBA_PCI_BRIDGE) #endif diff --git a/include/hw/pci-host/designware.h b/include/hw/pci-host/designware.h index 43ee5b3a12..551eec3107 100644 --- a/include/hw/pci-host/designware.h +++ b/include/hw/pci-host/designware.h @@ -30,13 +30,13 @@ #define TYPE_DESIGNWARE_PCIE_HOST "designware-pcie-host" typedef struct DesignwarePCIEHost DesignwarePCIEHost; -#define DESIGNWARE_PCIE_HOST(obj) \ - OBJECT_CHECK(DesignwarePCIEHost, (obj), TYPE_DESIGNWARE_PCIE_HOST) +DECLARE_INSTANCE_CHECKER(DesignwarePCIEHost, DESIGNWARE_PCIE_HOST, + TYPE_DESIGNWARE_PCIE_HOST) #define TYPE_DESIGNWARE_PCIE_ROOT "designware-pcie-root" typedef struct DesignwarePCIERoot DesignwarePCIERoot; -#define DESIGNWARE_PCIE_ROOT(obj) \ - OBJECT_CHECK(DesignwarePCIERoot, (obj), TYPE_DESIGNWARE_PCIE_ROOT) +DECLARE_INSTANCE_CHECKER(DesignwarePCIERoot, DESIGNWARE_PCIE_ROOT, + TYPE_DESIGNWARE_PCIE_ROOT) struct DesignwarePCIERoot; diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h index d70e1c69dc..e8432eced8 100644 --- a/include/hw/pci-host/gpex.h +++ b/include/hw/pci-host/gpex.h @@ -27,13 +27,13 @@ #define TYPE_GPEX_HOST "gpex-pcihost" typedef struct GPEXHost GPEXHost; -#define GPEX_HOST(obj) \ - OBJECT_CHECK(GPEXHost, (obj), TYPE_GPEX_HOST) +DECLARE_INSTANCE_CHECKER(GPEXHost, GPEX_HOST, + TYPE_GPEX_HOST) #define TYPE_GPEX_ROOT_DEVICE "gpex-root" typedef struct GPEXRootState GPEXRootState; -#define MCH_PCI_DEVICE(obj) \ - OBJECT_CHECK(GPEXRootState, (obj), TYPE_GPEX_ROOT_DEVICE) +DECLARE_INSTANCE_CHECKER(GPEXRootState, MCH_PCI_DEVICE, + TYPE_GPEX_ROOT_DEVICE) #define GPEX_NUM_IRQS 4 diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index 74fe300bff..046c64576d 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -20,8 +20,8 @@ #define TYPE_I440FX_PCI_DEVICE "i440FX" typedef struct PCII440FXState PCII440FXState; -#define I440FX_PCI_DEVICE(obj) \ - OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE) +DECLARE_INSTANCE_CHECKER(PCII440FXState, I440FX_PCI_DEVICE, + TYPE_I440FX_PCI_DEVICE) struct PCII440FXState { /*< private >*/ diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index 43f9e873ae..182f29d681 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -22,7 +22,8 @@ typedef struct PnvPHB3 PnvPHB3; */ #define TYPE_PHB3_MSI "phb3-msi" typedef struct Phb3MsiState Phb3MsiState; -#define PHB3_MSI(obj) OBJECT_CHECK(Phb3MsiState, (obj), TYPE_PHB3_MSI) +DECLARE_INSTANCE_CHECKER(Phb3MsiState, PHB3_MSI, + TYPE_PHB3_MSI) #define PHB3_MAX_MSI 2048 @@ -72,7 +73,8 @@ typedef struct PnvPhb3DMASpace { */ #define TYPE_PNV_PBCQ "pnv-pbcq" typedef struct PnvPBCQState PnvPBCQState; -#define PNV_PBCQ(obj) OBJECT_CHECK(PnvPBCQState, (obj), TYPE_PNV_PBCQ) +DECLARE_INSTANCE_CHECKER(PnvPBCQState, PNV_PBCQ, + TYPE_PNV_PBCQ) struct PnvPBCQState { DeviceState parent; @@ -116,7 +118,8 @@ typedef struct PnvPHB3RootPort { * PHB3 PCIe Host Bridge for PowerNV machines (POWER8) */ #define TYPE_PNV_PHB3 "pnv-phb3" -#define PNV_PHB3(obj) OBJECT_CHECK(PnvPHB3, (obj), TYPE_PNV_PHB3) +DECLARE_INSTANCE_CHECKER(PnvPHB3, PNV_PHB3, + TYPE_PNV_PHB3) #define PNV_PHB3_NUM_M64 16 #define PNV_PHB3_NUM_REGS (0x1000 >> 3) diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 450602cb72..15a4633178 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -58,7 +58,8 @@ typedef struct PnvPHB4RootPort { * PHB4 PCIe Host Bridge for PowerNV machines (POWER9) */ #define TYPE_PNV_PHB4 "pnv-phb4" -#define PNV_PHB4(obj) OBJECT_CHECK(PnvPHB4, (obj), TYPE_PNV_PHB4) +DECLARE_INSTANCE_CHECKER(PnvPHB4, PNV_PHB4, + TYPE_PNV_PHB4) #define PNV_PHB4_MAX_LSIs 8 #define PNV_PHB4_MAX_INTs 4096 @@ -142,12 +143,12 @@ extern const MemoryRegionOps pnv_phb4_xscom_ops; */ #define TYPE_PNV_PHB4_PEC "pnv-phb4-pec" typedef struct PnvPhb4PecClass PnvPhb4PecClass; -#define PNV_PHB4_PEC(obj) \ - OBJECT_CHECK(PnvPhb4PecState, (obj), TYPE_PNV_PHB4_PEC) +DECLARE_OBJ_CHECKERS(PnvPhb4PecState, PnvPhb4PecClass, + PNV_PHB4_PEC, TYPE_PNV_PHB4_PEC) #define TYPE_PNV_PHB4_PEC_STACK "pnv-phb4-pec-stack" -#define PNV_PHB4_PEC_STACK(obj) \ - OBJECT_CHECK(PnvPhb4PecStack, (obj), TYPE_PNV_PHB4_PEC_STACK) +DECLARE_INSTANCE_CHECKER(PnvPhb4PecStack, PNV_PHB4_PEC_STACK, + TYPE_PNV_PHB4_PEC_STACK) /* Per-stack data */ struct PnvPhb4PecStack { @@ -211,10 +212,6 @@ struct PnvPhb4PecState { PnvPhb4PecStack stacks[PHB4_PEC_MAX_STACKS]; }; -#define PNV_PHB4_PEC_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvPhb4PecClass, (klass), TYPE_PNV_PHB4_PEC) -#define PNV_PHB4_PEC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvPhb4PecClass, (obj), TYPE_PNV_PHB4_PEC) struct PnvPhb4PecClass { DeviceClass parent_class; diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index 5db5a763d4..0f5a534f77 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -31,13 +31,13 @@ #define TYPE_Q35_HOST_DEVICE "q35-pcihost" typedef struct Q35PCIHost Q35PCIHost; -#define Q35_HOST_DEVICE(obj) \ - OBJECT_CHECK(Q35PCIHost, (obj), TYPE_Q35_HOST_DEVICE) +DECLARE_INSTANCE_CHECKER(Q35PCIHost, Q35_HOST_DEVICE, + TYPE_Q35_HOST_DEVICE) #define TYPE_MCH_PCI_DEVICE "mch" typedef struct MCHPCIState MCHPCIState; -#define MCH_PCI_DEVICE(obj) \ - OBJECT_CHECK(MCHPCIState, (obj), TYPE_MCH_PCI_DEVICE) +DECLARE_INSTANCE_CHECKER(MCHPCIState, MCH_PCI_DEVICE, + TYPE_MCH_PCI_DEVICE) struct MCHPCIState { /*< private >*/ diff --git a/include/hw/pci-host/sabre.h b/include/hw/pci-host/sabre.h index 5fb508e9ce..597bf70d69 100644 --- a/include/hw/pci-host/sabre.h +++ b/include/hw/pci-host/sabre.h @@ -23,8 +23,8 @@ struct SabrePCIState { typedef struct SabrePCIState SabrePCIState; #define TYPE_SABRE_PCI_DEVICE "sabre-pci" -#define SABRE_PCI_DEVICE(obj) \ - OBJECT_CHECK(SabrePCIState, (obj), TYPE_SABRE_PCI_DEVICE) +DECLARE_INSTANCE_CHECKER(SabrePCIState, SABRE_PCI_DEVICE, + TYPE_SABRE_PCI_DEVICE) struct SabreState { PCIHostState parent_obj; @@ -51,7 +51,7 @@ struct SabreState { typedef struct SabreState SabreState; #define TYPE_SABRE "sabre" -#define SABRE_DEVICE(obj) \ - OBJECT_CHECK(SabreState, (obj), TYPE_SABRE) +DECLARE_INSTANCE_CHECKER(SabreState, SABRE_DEVICE, + TYPE_SABRE) #endif diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index 783e8905df..0431ce1048 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -29,8 +29,8 @@ #define TYPE_SPAPR_PCI_HOST_BRIDGE "spapr-pci-host-bridge" typedef struct SpaprPhbState SpaprPhbState; -#define SPAPR_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(SpaprPhbState, (obj), TYPE_SPAPR_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(SpaprPhbState, SPAPR_PCI_HOST_BRIDGE, + TYPE_SPAPR_PCI_HOST_BRIDGE) #define SPAPR_PCI_DMA_MAX_WINDOWS 2 diff --git a/include/hw/pci-host/uninorth.h b/include/hw/pci-host/uninorth.h index a1f3aaaecd..d10c598298 100644 --- a/include/hw/pci-host/uninorth.h +++ b/include/hw/pci-host/uninorth.h @@ -38,14 +38,14 @@ #define TYPE_U3_AGP_HOST_BRIDGE "u3-agp-pcihost" typedef struct UNINHostState UNINHostState; -#define UNI_NORTH_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(UNINHostState, (obj), TYPE_UNI_NORTH_PCI_HOST_BRIDGE) -#define UNI_NORTH_AGP_HOST_BRIDGE(obj) \ - OBJECT_CHECK(UNINHostState, (obj), TYPE_UNI_NORTH_AGP_HOST_BRIDGE) -#define UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(UNINHostState, (obj), TYPE_UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE) -#define U3_AGP_HOST_BRIDGE(obj) \ - OBJECT_CHECK(UNINHostState, (obj), TYPE_U3_AGP_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(UNINHostState, UNI_NORTH_PCI_HOST_BRIDGE, + TYPE_UNI_NORTH_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(UNINHostState, UNI_NORTH_AGP_HOST_BRIDGE, + TYPE_UNI_NORTH_AGP_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(UNINHostState, UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE, + TYPE_UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(UNINHostState, U3_AGP_HOST_BRIDGE, + TYPE_U3_AGP_HOST_BRIDGE) struct UNINHostState { PCIHostState parent_obj; @@ -66,7 +66,7 @@ struct UNINState { typedef struct UNINState UNINState; #define TYPE_UNI_NORTH "uni-north" -#define UNI_NORTH(obj) \ - OBJECT_CHECK(UNINState, (obj), TYPE_UNI_NORTH) +DECLARE_INSTANCE_CHECKER(UNINState, UNI_NORTH, + TYPE_UNI_NORTH) #endif /* UNINORTH_H */ diff --git a/include/hw/pci-host/xilinx-pcie.h b/include/hw/pci-host/xilinx-pcie.h index 1cbd6d2f79..6058c8c9e2 100644 --- a/include/hw/pci-host/xilinx-pcie.h +++ b/include/hw/pci-host/xilinx-pcie.h @@ -28,13 +28,13 @@ #define TYPE_XILINX_PCIE_HOST "xilinx-pcie-host" typedef struct XilinxPCIEHost XilinxPCIEHost; -#define XILINX_PCIE_HOST(obj) \ - OBJECT_CHECK(XilinxPCIEHost, (obj), TYPE_XILINX_PCIE_HOST) +DECLARE_INSTANCE_CHECKER(XilinxPCIEHost, XILINX_PCIE_HOST, + TYPE_XILINX_PCIE_HOST) #define TYPE_XILINX_PCIE_ROOT "xilinx-pcie-root" typedef struct XilinxPCIERoot XilinxPCIERoot; -#define XILINX_PCIE_ROOT(obj) \ - OBJECT_CHECK(XilinxPCIERoot, (obj), TYPE_XILINX_PCIE_ROOT) +DECLARE_INSTANCE_CHECKER(XilinxPCIERoot, XILINX_PCIE_ROOT, + TYPE_XILINX_PCIE_ROOT) struct XilinxPCIERoot { PCIBridge parent_obj; diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h index 765399159f..00ab398cb9 100644 --- a/include/hw/pci/pcie_port.h +++ b/include/hw/pci/pcie_port.h @@ -69,10 +69,8 @@ void pcie_chassis_del_slot(PCIESlot *s); #define TYPE_PCIE_ROOT_PORT "pcie-root-port-base" typedef struct PCIERootPortClass PCIERootPortClass; -#define PCIE_ROOT_PORT_CLASS(klass) \ - OBJECT_CLASS_CHECK(PCIERootPortClass, (klass), TYPE_PCIE_ROOT_PORT) -#define PCIE_ROOT_PORT_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PCIERootPortClass, (obj), TYPE_PCIE_ROOT_PORT) +DECLARE_CLASS_CHECKERS(PCIERootPortClass, PCIE_ROOT_PORT, + TYPE_PCIE_ROOT_PORT) struct PCIERootPortClass { PCIDeviceClass parent_class; diff --git a/include/hw/pcmcia.h b/include/hw/pcmcia.h index 0f9e41db02..fb40ae7e09 100644 --- a/include/hw/pcmcia.h +++ b/include/hw/pcmcia.h @@ -14,12 +14,8 @@ typedef struct PCMCIASocket { #define TYPE_PCMCIA_CARD "pcmcia-card" typedef struct PCMCIACardClass PCMCIACardClass; typedef struct PCMCIACardState PCMCIACardState; -#define PCMCIA_CARD(obj) \ - OBJECT_CHECK(PCMCIACardState, (obj), TYPE_PCMCIA_CARD) -#define PCMCIA_CARD_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PCMCIACardClass, obj, TYPE_PCMCIA_CARD) -#define PCMCIA_CARD_CLASS(cls) \ - OBJECT_CLASS_CHECK(PCMCIACardClass, cls, TYPE_PCMCIA_CARD) +DECLARE_OBJ_CHECKERS(PCMCIACardState, PCMCIACardClass, + PCMCIA_CARD, TYPE_PCMCIA_CARD) struct PCMCIACardState { /*< private >*/ diff --git a/include/hw/platform-bus.h b/include/hw/platform-bus.h index cda1346a4f..0d035e1b71 100644 --- a/include/hw/platform-bus.h +++ b/include/hw/platform-bus.h @@ -28,8 +28,8 @@ typedef struct PlatformBusDevice PlatformBusDevice; #define TYPE_PLATFORM_BUS_DEVICE "platform-bus-device" -#define PLATFORM_BUS_DEVICE(obj) \ - OBJECT_CHECK(PlatformBusDevice, (obj), TYPE_PLATFORM_BUS_DEVICE) +DECLARE_INSTANCE_CHECKER(PlatformBusDevice, PLATFORM_BUS_DEVICE, + TYPE_PLATFORM_BUS_DEVICE) struct PlatformBusDevice { /*< private >*/ diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index e1f42cdbd3..9166d5f758 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -178,6 +178,7 @@ void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq, void DBDMA_kick(DBDMAState *dbdma); #define TYPE_MAC_DBDMA "mac-dbdma" -#define MAC_DBDMA(obj) OBJECT_CHECK(DBDMAState, (obj), TYPE_MAC_DBDMA) +DECLARE_INSTANCE_CHECKER(DBDMAState, MAC_DBDMA, + TYPE_MAC_DBDMA) #endif diff --git a/include/hw/ppc/openpic.h b/include/hw/ppc/openpic.h index 81a0b3b1ee..61908c7858 100644 --- a/include/hw/ppc/openpic.h +++ b/include/hw/ppc/openpic.h @@ -138,7 +138,8 @@ typedef struct IRQDest { #define TYPE_OPENPIC "openpic" typedef struct OpenPICState OpenPICState; -#define OPENPIC(obj) OBJECT_CHECK(OpenPICState, (obj), TYPE_OPENPIC) +DECLARE_INSTANCE_CHECKER(OpenPICState, OPENPIC, + TYPE_OPENPIC) struct OpenPICState { /*< private >*/ diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 64f9ee8867..f3bacb6a5c 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -37,11 +37,8 @@ #define TYPE_PNV_CHIP "pnv-chip" typedef struct PnvChip PnvChip; typedef struct PnvChipClass PnvChipClass; -#define PNV_CHIP(obj) OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP) -#define PNV_CHIP_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvChipClass, (klass), TYPE_PNV_CHIP) -#define PNV_CHIP_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvChipClass, (obj), TYPE_PNV_CHIP) +DECLARE_OBJ_CHECKERS(PnvChip, PnvChipClass, + PNV_CHIP, TYPE_PNV_CHIP) struct PnvChip { /*< private >*/ @@ -68,7 +65,8 @@ struct PnvChip { #define TYPE_PNV8_CHIP "pnv8-chip" typedef struct Pnv8Chip Pnv8Chip; -#define PNV8_CHIP(obj) OBJECT_CHECK(Pnv8Chip, (obj), TYPE_PNV8_CHIP) +DECLARE_INSTANCE_CHECKER(Pnv8Chip, PNV8_CHIP, + TYPE_PNV8_CHIP) struct Pnv8Chip { /*< private >*/ @@ -90,7 +88,8 @@ struct Pnv8Chip { #define TYPE_PNV9_CHIP "pnv9-chip" typedef struct Pnv9Chip Pnv9Chip; -#define PNV9_CHIP(obj) OBJECT_CHECK(Pnv9Chip, (obj), TYPE_PNV9_CHIP) +DECLARE_INSTANCE_CHECKER(Pnv9Chip, PNV9_CHIP, + TYPE_PNV9_CHIP) struct Pnv9Chip { /*< private >*/ @@ -118,7 +117,8 @@ struct Pnv9Chip { #define TYPE_PNV10_CHIP "pnv10-chip" typedef struct Pnv10Chip Pnv10Chip; -#define PNV10_CHIP(obj) OBJECT_CHECK(Pnv10Chip, (obj), TYPE_PNV10_CHIP) +DECLARE_INSTANCE_CHECKER(Pnv10Chip, PNV10_CHIP, + TYPE_PNV10_CHIP) struct Pnv10Chip { /*< private >*/ @@ -156,24 +156,24 @@ struct PnvChipClass { #define PNV_CHIP_TYPE_NAME(cpu_model) cpu_model PNV_CHIP_TYPE_SUFFIX #define TYPE_PNV_CHIP_POWER8E PNV_CHIP_TYPE_NAME("power8e_v2.1") -#define PNV_CHIP_POWER8E(obj) \ - OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8E) +DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER8E, + TYPE_PNV_CHIP_POWER8E) #define TYPE_PNV_CHIP_POWER8 PNV_CHIP_TYPE_NAME("power8_v2.0") -#define PNV_CHIP_POWER8(obj) \ - OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8) +DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER8, + TYPE_PNV_CHIP_POWER8) #define TYPE_PNV_CHIP_POWER8NVL PNV_CHIP_TYPE_NAME("power8nvl_v1.0") -#define PNV_CHIP_POWER8NVL(obj) \ - OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8NVL) +DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER8NVL, + TYPE_PNV_CHIP_POWER8NVL) #define TYPE_PNV_CHIP_POWER9 PNV_CHIP_TYPE_NAME("power9_v2.0") -#define PNV_CHIP_POWER9(obj) \ - OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER9) +DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER9, + TYPE_PNV_CHIP_POWER9) #define TYPE_PNV_CHIP_POWER10 PNV_CHIP_TYPE_NAME("power10_v1.0") -#define PNV_CHIP_POWER10(obj) \ - OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER10) +DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10, + TYPE_PNV_CHIP_POWER10) /* * This generates a HW chip id depending on an index, as found on a @@ -199,12 +199,8 @@ PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32_t pir); #define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv") typedef struct PnvMachineClass PnvMachineClass; typedef struct PnvMachineState PnvMachineState; -#define PNV_MACHINE(obj) \ - OBJECT_CHECK(PnvMachineState, (obj), TYPE_PNV_MACHINE) -#define PNV_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvMachineClass, obj, TYPE_PNV_MACHINE) -#define PNV_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvMachineClass, klass, TYPE_PNV_MACHINE) +DECLARE_OBJ_CHECKERS(PnvMachineState, PnvMachineClass, + PNV_MACHINE, TYPE_PNV_MACHINE) struct PnvMachineClass { diff --git a/include/hw/ppc/pnv_core.h b/include/hw/ppc/pnv_core.h index 2d91a7d519..fd17a236e3 100644 --- a/include/hw/ppc/pnv_core.h +++ b/include/hw/ppc/pnv_core.h @@ -27,12 +27,8 @@ #define TYPE_PNV_CORE "powernv-cpu-core" typedef struct PnvCore PnvCore; typedef struct PnvCoreClass PnvCoreClass; -#define PNV_CORE(obj) \ - OBJECT_CHECK(PnvCore, (obj), TYPE_PNV_CORE) -#define PNV_CORE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvCoreClass, (klass), TYPE_PNV_CORE) -#define PNV_CORE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvCoreClass, (obj), TYPE_PNV_CORE) +DECLARE_OBJ_CHECKERS(PnvCore, PnvCoreClass, + PNV_CORE, TYPE_PNV_CORE) typedef struct PnvChip PnvChip; @@ -69,8 +65,8 @@ static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu) #define TYPE_PNV_QUAD "powernv-cpu-quad" typedef struct PnvQuad PnvQuad; -#define PNV_QUAD(obj) \ - OBJECT_CHECK(PnvQuad, (obj), TYPE_PNV_QUAD) +DECLARE_INSTANCE_CHECKER(PnvQuad, PNV_QUAD, + TYPE_PNV_QUAD) struct PnvQuad { DeviceState parent_obj; diff --git a/include/hw/ppc/pnv_homer.h b/include/hw/ppc/pnv_homer.h index bedba94e18..7aadcab03c 100644 --- a/include/hw/ppc/pnv_homer.h +++ b/include/hw/ppc/pnv_homer.h @@ -26,11 +26,14 @@ #define TYPE_PNV_HOMER "pnv-homer" typedef struct PnvHomer PnvHomer; typedef struct PnvHomerClass PnvHomerClass; -#define PNV_HOMER(obj) OBJECT_CHECK(PnvHomer, (obj), TYPE_PNV_HOMER) +DECLARE_OBJ_CHECKERS(PnvHomer, PnvHomerClass, + PNV_HOMER, TYPE_PNV_HOMER) #define TYPE_PNV8_HOMER TYPE_PNV_HOMER "-POWER8" -#define PNV8_HOMER(obj) OBJECT_CHECK(PnvHomer, (obj), TYPE_PNV8_HOMER) +DECLARE_INSTANCE_CHECKER(PnvHomer, PNV8_HOMER, + TYPE_PNV8_HOMER) #define TYPE_PNV9_HOMER TYPE_PNV_HOMER "-POWER9" -#define PNV9_HOMER(obj) OBJECT_CHECK(PnvHomer, (obj), TYPE_PNV9_HOMER) +DECLARE_INSTANCE_CHECKER(PnvHomer, PNV9_HOMER, + TYPE_PNV9_HOMER) struct PnvHomer { DeviceState parent; @@ -40,10 +43,6 @@ struct PnvHomer { MemoryRegion regs; }; -#define PNV_HOMER_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvHomerClass, (klass), TYPE_PNV_HOMER) -#define PNV_HOMER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvHomerClass, (obj), TYPE_PNV_HOMER) struct PnvHomerClass { DeviceClass parent_class; diff --git a/include/hw/ppc/pnv_lpc.h b/include/hw/ppc/pnv_lpc.h index 50d92517f2..cd3c13c2a8 100644 --- a/include/hw/ppc/pnv_lpc.h +++ b/include/hw/ppc/pnv_lpc.h @@ -26,16 +26,19 @@ #define TYPE_PNV_LPC "pnv-lpc" typedef struct PnvLpcClass PnvLpcClass; typedef struct PnvLpcController PnvLpcController; -#define PNV_LPC(obj) \ - OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV_LPC) +DECLARE_OBJ_CHECKERS(PnvLpcController, PnvLpcClass, + PNV_LPC, TYPE_PNV_LPC) #define TYPE_PNV8_LPC TYPE_PNV_LPC "-POWER8" -#define PNV8_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV8_LPC) +DECLARE_INSTANCE_CHECKER(PnvLpcController, PNV8_LPC, + TYPE_PNV8_LPC) #define TYPE_PNV9_LPC TYPE_PNV_LPC "-POWER9" -#define PNV9_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV9_LPC) +DECLARE_INSTANCE_CHECKER(PnvLpcController, PNV9_LPC, + TYPE_PNV9_LPC) #define TYPE_PNV10_LPC TYPE_PNV_LPC "-POWER10" -#define PNV10_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV10_LPC) +DECLARE_INSTANCE_CHECKER(PnvLpcController, PNV10_LPC, + TYPE_PNV10_LPC) struct PnvLpcController { DeviceState parent; @@ -84,10 +87,6 @@ struct PnvLpcController { PnvPsi *psi; }; -#define PNV_LPC_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvLpcClass, (klass), TYPE_PNV_LPC) -#define PNV_LPC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvLpcClass, (obj), TYPE_PNV_LPC) struct PnvLpcClass { DeviceClass parent_class; diff --git a/include/hw/ppc/pnv_occ.h b/include/hw/ppc/pnv_occ.h index 30a9faea78..4fcfb32417 100644 --- a/include/hw/ppc/pnv_occ.h +++ b/include/hw/ppc/pnv_occ.h @@ -26,11 +26,14 @@ #define TYPE_PNV_OCC "pnv-occ" typedef struct PnvOCC PnvOCC; typedef struct PnvOCCClass PnvOCCClass; -#define PNV_OCC(obj) OBJECT_CHECK(PnvOCC, (obj), TYPE_PNV_OCC) +DECLARE_OBJ_CHECKERS(PnvOCC, PnvOCCClass, + PNV_OCC, TYPE_PNV_OCC) #define TYPE_PNV8_OCC TYPE_PNV_OCC "-POWER8" -#define PNV8_OCC(obj) OBJECT_CHECK(PnvOCC, (obj), TYPE_PNV8_OCC) +DECLARE_INSTANCE_CHECKER(PnvOCC, PNV8_OCC, + TYPE_PNV8_OCC) #define TYPE_PNV9_OCC TYPE_PNV_OCC "-POWER9" -#define PNV9_OCC(obj) OBJECT_CHECK(PnvOCC, (obj), TYPE_PNV9_OCC) +DECLARE_INSTANCE_CHECKER(PnvOCC, PNV9_OCC, + TYPE_PNV9_OCC) #define PNV_OCC_SENSOR_DATA_BLOCK_OFFSET 0x00580000 #define PNV_OCC_SENSOR_DATA_BLOCK_SIZE 0x00025800 @@ -47,10 +50,6 @@ struct PnvOCC { MemoryRegion sram_regs; }; -#define PNV_OCC_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvOCCClass, (klass), TYPE_PNV_OCC) -#define PNV_OCC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvOCCClass, (obj), TYPE_PNV_OCC) struct PnvOCCClass { DeviceClass parent_class; diff --git a/include/hw/ppc/pnv_pnor.h b/include/hw/ppc/pnv_pnor.h index 8b27bf111c..1ec4098bb9 100644 --- a/include/hw/ppc/pnv_pnor.h +++ b/include/hw/ppc/pnv_pnor.h @@ -17,7 +17,8 @@ #define TYPE_PNV_PNOR "pnv-pnor" typedef struct PnvPnor PnvPnor; -#define PNV_PNOR(obj) OBJECT_CHECK(PnvPnor, (obj), TYPE_PNV_PNOR) +DECLARE_INSTANCE_CHECKER(PnvPnor, PNV_PNOR, + TYPE_PNV_PNOR) struct PnvPnor { SysBusDevice parent_obj; diff --git a/include/hw/ppc/pnv_psi.h b/include/hw/ppc/pnv_psi.h index 060a7a110c..a33195df17 100644 --- a/include/hw/ppc/pnv_psi.h +++ b/include/hw/ppc/pnv_psi.h @@ -28,8 +28,8 @@ #define TYPE_PNV_PSI "pnv-psi" typedef struct PnvPsi PnvPsi; typedef struct PnvPsiClass PnvPsiClass; -#define PNV_PSI(obj) \ - OBJECT_CHECK(PnvPsi, (obj), TYPE_PNV_PSI) +DECLARE_OBJ_CHECKERS(PnvPsi, PnvPsiClass, + PNV_PSI, TYPE_PNV_PSI) #define PSIHB_XSCOM_MAX 0x20 @@ -54,8 +54,8 @@ struct PnvPsi { #define TYPE_PNV8_PSI TYPE_PNV_PSI "-POWER8" typedef struct Pnv8Psi Pnv8Psi; -#define PNV8_PSI(obj) \ - OBJECT_CHECK(Pnv8Psi, (obj), TYPE_PNV8_PSI) +DECLARE_INSTANCE_CHECKER(Pnv8Psi, PNV8_PSI, + TYPE_PNV8_PSI) struct Pnv8Psi { PnvPsi parent; @@ -65,8 +65,8 @@ struct Pnv8Psi { #define TYPE_PNV9_PSI TYPE_PNV_PSI "-POWER9" typedef struct Pnv9Psi Pnv9Psi; -#define PNV9_PSI(obj) \ - OBJECT_CHECK(Pnv9Psi, (obj), TYPE_PNV9_PSI) +DECLARE_INSTANCE_CHECKER(Pnv9Psi, PNV9_PSI, + TYPE_PNV9_PSI) struct Pnv9Psi { PnvPsi parent; @@ -76,10 +76,6 @@ struct Pnv9Psi { #define TYPE_PNV10_PSI TYPE_PNV_PSI "-POWER10" -#define PNV_PSI_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvPsiClass, (klass), TYPE_PNV_PSI) -#define PNV_PSI_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvPsiClass, (obj), TYPE_PNV_PSI) struct PnvPsiClass { SysBusDeviceClass parent_class; diff --git a/include/hw/ppc/pnv_xive.h b/include/hw/ppc/pnv_xive.h index 24c37de184..a014e2a726 100644 --- a/include/hw/ppc/pnv_xive.h +++ b/include/hw/ppc/pnv_xive.h @@ -18,11 +18,8 @@ struct PnvChip; #define TYPE_PNV_XIVE "pnv-xive" typedef struct PnvXive PnvXive; typedef struct PnvXiveClass PnvXiveClass; -#define PNV_XIVE(obj) OBJECT_CHECK(PnvXive, (obj), TYPE_PNV_XIVE) -#define PNV_XIVE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvXiveClass, (klass), TYPE_PNV_XIVE) -#define PNV_XIVE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvXiveClass, (obj), TYPE_PNV_XIVE) +DECLARE_OBJ_CHECKERS(PnvXive, PnvXiveClass, + PNV_XIVE, TYPE_PNV_XIVE) #define XIVE_BLOCK_MAX 16 diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h index fb9b97f5be..7e3b189c07 100644 --- a/include/hw/ppc/pnv_xscom.h +++ b/include/hw/ppc/pnv_xscom.h @@ -28,11 +28,8 @@ typedef struct PnvXScomInterface PnvXScomInterface; #define PNV_XSCOM_INTERFACE(obj) \ INTERFACE_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE) typedef struct PnvXScomInterfaceClass PnvXScomInterfaceClass; -#define PNV_XSCOM_INTERFACE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PnvXScomInterfaceClass, (klass), \ +DECLARE_CLASS_CHECKERS(PnvXScomInterfaceClass, PNV_XSCOM_INTERFACE, TYPE_PNV_XSCOM_INTERFACE) -#define PNV_XSCOM_INTERFACE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PnvXScomInterfaceClass, (obj), TYPE_PNV_XSCOM_INTERFACE) struct PnvXScomInterfaceClass { InterfaceClass parent; diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index cbd73e9b71..3b20755999 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -29,8 +29,8 @@ typedef struct SpaprPendingHpt SpaprPendingHpt; #define TYPE_SPAPR_RTC "spapr-rtc" typedef struct SpaprRtcState SpaprRtcState; -#define SPAPR_RTC(obj) \ - OBJECT_CHECK(SpaprRtcState, (obj), TYPE_SPAPR_RTC) +DECLARE_INSTANCE_CHECKER(SpaprRtcState, SPAPR_RTC, + TYPE_SPAPR_RTC) struct SpaprRtcState { /*< private >*/ @@ -773,8 +773,8 @@ static inline void spapr_dt_irq(uint32_t *intspec, int irq, bool is_lsi) typedef struct SpaprTceTable SpaprTceTable; #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table" -#define SPAPR_TCE_TABLE(obj) \ - OBJECT_CHECK(SpaprTceTable, (obj), TYPE_SPAPR_TCE_TABLE) +DECLARE_INSTANCE_CHECKER(SpaprTceTable, SPAPR_TCE_TABLE, + TYPE_SPAPR_TCE_TABLE) #define TYPE_SPAPR_IOMMU_MEMORY_REGION "spapr-iommu-memory-region" #define SPAPR_IOMMU_MEMORY_REGION(obj) \ diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_core.h index adcf74dbc3..fba6a01050 100644 --- a/include/hw/ppc/spapr_cpu_core.h +++ b/include/hw/ppc/spapr_cpu_core.h @@ -18,12 +18,8 @@ #define TYPE_SPAPR_CPU_CORE "spapr-cpu-core" typedef struct SpaprCpuCore SpaprCpuCore; typedef struct SpaprCpuCoreClass SpaprCpuCoreClass; -#define SPAPR_CPU_CORE(obj) \ - OBJECT_CHECK(SpaprCpuCore, (obj), TYPE_SPAPR_CPU_CORE) -#define SPAPR_CPU_CORE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprCpuCoreClass, (klass), TYPE_SPAPR_CPU_CORE) -#define SPAPR_CPU_CORE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprCpuCoreClass, (obj), TYPE_SPAPR_CPU_CORE) +DECLARE_OBJ_CHECKERS(SpaprCpuCore, SpaprCpuCoreClass, + SPAPR_CPU_CORE, TYPE_SPAPR_CPU_CORE) #define SPAPR_CPU_CORE_TYPE_NAME(model) model "-" TYPE_SPAPR_CPU_CORE diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h index ab799930bf..2236aea66a 100644 --- a/include/hw/ppc/spapr_drc.h +++ b/include/hw/ppc/spapr_drc.h @@ -22,72 +22,37 @@ #define TYPE_SPAPR_DR_CONNECTOR "spapr-dr-connector" typedef struct SpaprDrc SpaprDrc; typedef struct SpaprDrcClass SpaprDrcClass; -#define SPAPR_DR_CONNECTOR_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DR_CONNECTOR) -#define SPAPR_DR_CONNECTOR_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, \ - TYPE_SPAPR_DR_CONNECTOR) -#define SPAPR_DR_CONNECTOR(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DR_CONNECTOR) +DECLARE_OBJ_CHECKERS(SpaprDrc, SpaprDrcClass, + SPAPR_DR_CONNECTOR, TYPE_SPAPR_DR_CONNECTOR) #define TYPE_SPAPR_DRC_PHYSICAL "spapr-drc-physical" typedef struct SpaprDrcPhysical SpaprDrcPhysical; -#define SPAPR_DRC_PHYSICAL_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PHYSICAL) -#define SPAPR_DRC_PHYSICAL_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, \ - TYPE_SPAPR_DRC_PHYSICAL) -#define SPAPR_DRC_PHYSICAL(obj) OBJECT_CHECK(SpaprDrcPhysical, (obj), \ - TYPE_SPAPR_DRC_PHYSICAL) +DECLARE_OBJ_CHECKERS(SpaprDrcPhysical, SpaprDrcClass, + SPAPR_DRC_PHYSICAL, TYPE_SPAPR_DRC_PHYSICAL) #define TYPE_SPAPR_DRC_LOGICAL "spapr-drc-logical" -#define SPAPR_DRC_LOGICAL_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_LOGICAL) -#define SPAPR_DRC_LOGICAL_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, \ - TYPE_SPAPR_DRC_LOGICAL) -#define SPAPR_DRC_LOGICAL(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_LOGICAL) +DECLARE_OBJ_CHECKERS(SpaprDrc, SpaprDrcClass, + SPAPR_DRC_LOGICAL, TYPE_SPAPR_DRC_LOGICAL) #define TYPE_SPAPR_DRC_CPU "spapr-drc-cpu" -#define SPAPR_DRC_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_CPU) -#define SPAPR_DRC_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_CPU) -#define SPAPR_DRC_CPU(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_CPU) +DECLARE_OBJ_CHECKERS(SpaprDrc, SpaprDrcClass, + SPAPR_DRC_CPU, TYPE_SPAPR_DRC_CPU) #define TYPE_SPAPR_DRC_PCI "spapr-drc-pci" -#define SPAPR_DRC_PCI_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PCI) -#define SPAPR_DRC_PCI_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PCI) -#define SPAPR_DRC_PCI(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_PCI) +DECLARE_OBJ_CHECKERS(SpaprDrc, SpaprDrcClass, + SPAPR_DRC_PCI, TYPE_SPAPR_DRC_PCI) #define TYPE_SPAPR_DRC_LMB "spapr-drc-lmb" -#define SPAPR_DRC_LMB_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_LMB) -#define SPAPR_DRC_LMB_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_LMB) -#define SPAPR_DRC_LMB(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_LMB) +DECLARE_OBJ_CHECKERS(SpaprDrc, SpaprDrcClass, + SPAPR_DRC_LMB, TYPE_SPAPR_DRC_LMB) #define TYPE_SPAPR_DRC_PHB "spapr-drc-phb" -#define SPAPR_DRC_PHB_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PHB) -#define SPAPR_DRC_PHB_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PHB) -#define SPAPR_DRC_PHB(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_PHB) +DECLARE_OBJ_CHECKERS(SpaprDrc, SpaprDrcClass, + SPAPR_DRC_PHB, TYPE_SPAPR_DRC_PHB) #define TYPE_SPAPR_DRC_PMEM "spapr-drc-pmem" -#define SPAPR_DRC_PMEM_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprDrcClass, obj, TYPE_SPAPR_DRC_PMEM) -#define SPAPR_DRC_PMEM_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprDrcClass, klass, TYPE_SPAPR_DRC_PMEM) -#define SPAPR_DRC_PMEM(obj) OBJECT_CHECK(SpaprDrc, (obj), \ - TYPE_SPAPR_DRC_PMEM) +DECLARE_OBJ_CHECKERS(SpaprDrc, SpaprDrcClass, + SPAPR_DRC_PMEM, TYPE_SPAPR_DRC_PMEM) /* * Various hotplug types managed by SpaprDrc * diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h index 1a75f4d6d3..86a803986e 100644 --- a/include/hw/ppc/spapr_irq.h +++ b/include/hw/ppc/spapr_irq.h @@ -37,10 +37,8 @@ typedef struct SpaprInterruptController SpaprInterruptController; #define SPAPR_INTC(obj) \ INTERFACE_CHECK(SpaprInterruptController, (obj), TYPE_SPAPR_INTC) typedef struct SpaprInterruptControllerClass SpaprInterruptControllerClass; -#define SPAPR_INTC_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprInterruptControllerClass, (klass), TYPE_SPAPR_INTC) -#define SPAPR_INTC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprInterruptControllerClass, (obj), TYPE_SPAPR_INTC) +DECLARE_CLASS_CHECKERS(SpaprInterruptControllerClass, SPAPR_INTC, + TYPE_SPAPR_INTC) struct SpaprInterruptControllerClass { InterfaceClass parent; diff --git a/include/hw/ppc/spapr_tpm_proxy.h b/include/hw/ppc/spapr_tpm_proxy.h index 1e9890d978..300c81b1f0 100644 --- a/include/hw/ppc/spapr_tpm_proxy.h +++ b/include/hw/ppc/spapr_tpm_proxy.h @@ -18,8 +18,8 @@ #define TYPE_SPAPR_TPM_PROXY "spapr-tpm-proxy" typedef struct SpaprTpmProxy SpaprTpmProxy; -#define SPAPR_TPM_PROXY(obj) OBJECT_CHECK(SpaprTpmProxy, (obj), \ - TYPE_SPAPR_TPM_PROXY) +DECLARE_INSTANCE_CHECKER(SpaprTpmProxy, SPAPR_TPM_PROXY, + TYPE_SPAPR_TPM_PROXY) struct SpaprTpmProxy { /*< private >*/ diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index 9c9d14e63b..e289028634 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -30,16 +30,13 @@ #define TYPE_VIO_SPAPR_DEVICE "vio-spapr-device" typedef struct SpaprVioDevice SpaprVioDevice; typedef struct SpaprVioDeviceClass SpaprVioDeviceClass; -#define VIO_SPAPR_DEVICE(obj) \ - OBJECT_CHECK(SpaprVioDevice, (obj), TYPE_VIO_SPAPR_DEVICE) -#define VIO_SPAPR_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprVioDeviceClass, (klass), TYPE_VIO_SPAPR_DEVICE) -#define VIO_SPAPR_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprVioDeviceClass, (obj), TYPE_VIO_SPAPR_DEVICE) +DECLARE_OBJ_CHECKERS(SpaprVioDevice, SpaprVioDeviceClass, + VIO_SPAPR_DEVICE, TYPE_VIO_SPAPR_DEVICE) #define TYPE_SPAPR_VIO_BUS "spapr-vio-bus" typedef struct SpaprVioBus SpaprVioBus; -#define SPAPR_VIO_BUS(obj) OBJECT_CHECK(SpaprVioBus, (obj), TYPE_SPAPR_VIO_BUS) +DECLARE_INSTANCE_CHECKER(SpaprVioBus, SPAPR_VIO_BUS, + TYPE_SPAPR_VIO_BUS) #define TYPE_SPAPR_VIO_BRIDGE "spapr-vio-bridge" diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 58aad95e6e..6b0f31969b 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -17,11 +17,8 @@ #define TYPE_SPAPR_XIVE "spapr-xive" typedef struct SpaprXive SpaprXive; typedef struct SpaprXiveClass SpaprXiveClass; -#define SPAPR_XIVE(obj) OBJECT_CHECK(SpaprXive, (obj), TYPE_SPAPR_XIVE) -#define SPAPR_XIVE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprXiveClass, (klass), TYPE_SPAPR_XIVE) -#define SPAPR_XIVE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprXiveClass, (obj), TYPE_SPAPR_XIVE) +DECLARE_OBJ_CHECKERS(SpaprXive, SpaprXiveClass, + SPAPR_XIVE, TYPE_SPAPR_XIVE) struct SpaprXive { XiveRouter parent; diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index e5f48faba0..bcb584b90d 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -50,15 +50,13 @@ typedef struct ICSIRQState ICSIRQState; typedef struct XICSFabric XICSFabric; #define TYPE_ICP "icp" -#define ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP) +DECLARE_OBJ_CHECKERS(ICPState, ICPStateClass, + ICP, TYPE_ICP) #define TYPE_PNV_ICP "pnv-icp" -#define PNV_ICP(obj) OBJECT_CHECK(PnvICPState, (obj), TYPE_PNV_ICP) +DECLARE_INSTANCE_CHECKER(PnvICPState, PNV_ICP, + TYPE_PNV_ICP) -#define ICP_CLASS(klass) \ - OBJECT_CLASS_CHECK(ICPStateClass, (klass), TYPE_ICP) -#define ICP_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ICPStateClass, (obj), TYPE_ICP) struct ICPStateClass { DeviceClass parent_class; @@ -91,12 +89,9 @@ struct PnvICPState { }; #define TYPE_ICS "ics" -#define ICS(obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS) +DECLARE_OBJ_CHECKERS(ICSState, ICSStateClass, + ICS, TYPE_ICS) -#define ICS_CLASS(klass) \ - OBJECT_CLASS_CHECK(ICSStateClass, (klass), TYPE_ICS) -#define ICS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ICSStateClass, (obj), TYPE_ICS) struct ICSStateClass { DeviceClass parent_class; @@ -147,10 +142,8 @@ struct ICSIRQState { #define XICS_FABRIC(obj) \ INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC) typedef struct XICSFabricClass XICSFabricClass; -#define XICS_FABRIC_CLASS(klass) \ - OBJECT_CLASS_CHECK(XICSFabricClass, (klass), TYPE_XICS_FABRIC) -#define XICS_FABRIC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XICSFabricClass, (obj), TYPE_XICS_FABRIC) +DECLARE_CLASS_CHECKERS(XICSFabricClass, XICS_FABRIC, + TYPE_XICS_FABRIC) struct XICSFabricClass { InterfaceClass parent; diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index 42f3b951d5..fe894fb145 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -155,10 +155,8 @@ typedef struct XiveNotifier XiveNotifier; #define XIVE_NOTIFIER(obj) \ INTERFACE_CHECK(XiveNotifier, (obj), TYPE_XIVE_NOTIFIER) typedef struct XiveNotifierClass XiveNotifierClass; -#define XIVE_NOTIFIER_CLASS(klass) \ - OBJECT_CLASS_CHECK(XiveNotifierClass, (klass), TYPE_XIVE_NOTIFIER) -#define XIVE_NOTIFIER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XiveNotifierClass, (obj), TYPE_XIVE_NOTIFIER) +DECLARE_CLASS_CHECKERS(XiveNotifierClass, XIVE_NOTIFIER, + TYPE_XIVE_NOTIFIER) struct XiveNotifierClass { InterfaceClass parent; @@ -171,7 +169,8 @@ struct XiveNotifierClass { #define TYPE_XIVE_SOURCE "xive-source" typedef struct XiveSource XiveSource; -#define XIVE_SOURCE(obj) OBJECT_CHECK(XiveSource, (obj), TYPE_XIVE_SOURCE) +DECLARE_INSTANCE_CHECKER(XiveSource, XIVE_SOURCE, + TYPE_XIVE_SOURCE) /* * XIVE Interrupt Source characteristics, which define how the ESB are @@ -302,7 +301,8 @@ void xive_source_set_irq(void *opaque, int srcno, int val); #define TYPE_XIVE_TCTX "xive-tctx" typedef struct XiveTCTX XiveTCTX; -#define XIVE_TCTX(obj) OBJECT_CHECK(XiveTCTX, (obj), TYPE_XIVE_TCTX) +DECLARE_INSTANCE_CHECKER(XiveTCTX, XIVE_TCTX, + TYPE_XIVE_TCTX) /* * XIVE Thread interrupt Management register rings : @@ -343,12 +343,8 @@ typedef struct XiveRouter XiveRouter; #define TYPE_XIVE_ROUTER "xive-router" typedef struct XiveRouterClass XiveRouterClass; -#define XIVE_ROUTER(obj) \ - OBJECT_CHECK(XiveRouter, (obj), TYPE_XIVE_ROUTER) -#define XIVE_ROUTER_CLASS(klass) \ - OBJECT_CLASS_CHECK(XiveRouterClass, (klass), TYPE_XIVE_ROUTER) -#define XIVE_ROUTER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XiveRouterClass, (obj), TYPE_XIVE_ROUTER) +DECLARE_OBJ_CHECKERS(XiveRouter, XiveRouterClass, + XIVE_ROUTER, TYPE_XIVE_ROUTER) struct XiveRouterClass { SysBusDeviceClass parent; @@ -392,10 +388,8 @@ typedef struct XiveTCTXMatch { #define XIVE_PRESENTER(obj) \ INTERFACE_CHECK(XivePresenter, (obj), TYPE_XIVE_PRESENTER) typedef struct XivePresenterClass XivePresenterClass; -#define XIVE_PRESENTER_CLASS(klass) \ - OBJECT_CLASS_CHECK(XivePresenterClass, (klass), TYPE_XIVE_PRESENTER) -#define XIVE_PRESENTER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XivePresenterClass, (obj), TYPE_XIVE_PRESENTER) +DECLARE_CLASS_CHECKERS(XivePresenterClass, XIVE_PRESENTER, + TYPE_XIVE_PRESENTER) struct XivePresenterClass { InterfaceClass parent; @@ -418,10 +412,8 @@ int xive_presenter_tctx_match(XivePresenter *xptr, XiveTCTX *tctx, #define XIVE_FABRIC(obj) \ INTERFACE_CHECK(XiveFabric, (obj), TYPE_XIVE_FABRIC) typedef struct XiveFabricClass XiveFabricClass; -#define XIVE_FABRIC_CLASS(klass) \ - OBJECT_CLASS_CHECK(XiveFabricClass, (klass), TYPE_XIVE_FABRIC) -#define XIVE_FABRIC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XiveFabricClass, (obj), TYPE_XIVE_FABRIC) +DECLARE_CLASS_CHECKERS(XiveFabricClass, XIVE_FABRIC, + TYPE_XIVE_FABRIC) struct XiveFabricClass { InterfaceClass parent; @@ -437,8 +429,8 @@ struct XiveFabricClass { #define TYPE_XIVE_END_SOURCE "xive-end-source" typedef struct XiveENDSource XiveENDSource; -#define XIVE_END_SOURCE(obj) \ - OBJECT_CHECK(XiveENDSource, (obj), TYPE_XIVE_END_SOURCE) +DECLARE_INSTANCE_CHECKER(XiveENDSource, XIVE_END_SOURCE, + TYPE_XIVE_END_SOURCE) struct XiveENDSource { DeviceState parent; diff --git a/include/hw/register.h b/include/hw/register.h index c4325914b2..45c70394c4 100644 --- a/include/hw/register.h +++ b/include/hw/register.h @@ -88,7 +88,8 @@ struct RegisterInfo { }; #define TYPE_REGISTER "qemu,register" -#define REGISTER(obj) OBJECT_CHECK(RegisterInfo, (obj), TYPE_REGISTER) +DECLARE_INSTANCE_CHECKER(RegisterInfo, REGISTER, + TYPE_REGISTER) /** * This structure is used to group all of the individual registers which are diff --git a/include/hw/resettable.h b/include/hw/resettable.h index bcd36bce06..bdcd1276b6 100644 --- a/include/hw/resettable.h +++ b/include/hw/resettable.h @@ -18,11 +18,9 @@ #define TYPE_RESETTABLE_INTERFACE "resettable" typedef struct ResettableClass ResettableClass; -#define RESETTABLE_CLASS(class) \ - OBJECT_CLASS_CHECK(ResettableClass, (class), TYPE_RESETTABLE_INTERFACE) +DECLARE_CLASS_CHECKERS(ResettableClass, RESETTABLE, + TYPE_RESETTABLE_INTERFACE) -#define RESETTABLE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ResettableClass, (obj), TYPE_RESETTABLE_INTERFACE) typedef struct ResettableState ResettableState; diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h index b42599ff54..8c15b6325f 100644 --- a/include/hw/riscv/opentitan.h +++ b/include/hw/riscv/opentitan.h @@ -26,8 +26,8 @@ #define TYPE_RISCV_IBEX_SOC "riscv.lowrisc.ibex.soc" typedef struct LowRISCIbexSoCState LowRISCIbexSoCState; -#define RISCV_IBEX_SOC(obj) \ - OBJECT_CHECK(LowRISCIbexSoCState, (obj), TYPE_RISCV_IBEX_SOC) +DECLARE_INSTANCE_CHECKER(LowRISCIbexSoCState, RISCV_IBEX_SOC, + TYPE_RISCV_IBEX_SOC) struct LowRISCIbexSoCState { /*< private >*/ diff --git a/include/hw/riscv/riscv_hart.h b/include/hw/riscv/riscv_hart.h index 617b977214..9be1fd80ed 100644 --- a/include/hw/riscv/riscv_hart.h +++ b/include/hw/riscv/riscv_hart.h @@ -28,8 +28,8 @@ #define TYPE_RISCV_HART_ARRAY "riscv.hart_array" typedef struct RISCVHartArrayState RISCVHartArrayState; -#define RISCV_HART_ARRAY(obj) \ - OBJECT_CHECK(RISCVHartArrayState, (obj), TYPE_RISCV_HART_ARRAY) +DECLARE_INSTANCE_CHECKER(RISCVHartArrayState, RISCV_HART_ARRAY, + TYPE_RISCV_HART_ARRAY) struct RISCVHartArrayState { /*< private >*/ diff --git a/include/hw/riscv/sifive_clint.h b/include/hw/riscv/sifive_clint.h index e58f32b1e3..14298069a8 100644 --- a/include/hw/riscv/sifive_clint.h +++ b/include/hw/riscv/sifive_clint.h @@ -26,8 +26,8 @@ #define TYPE_SIFIVE_CLINT "riscv.sifive.clint" typedef struct SiFiveCLINTState SiFiveCLINTState; -#define SIFIVE_CLINT(obj) \ - OBJECT_CHECK(SiFiveCLINTState, (obj), TYPE_SIFIVE_CLINT) +DECLARE_INSTANCE_CHECKER(SiFiveCLINTState, SIFIVE_CLINT, + TYPE_SIFIVE_CLINT) struct SiFiveCLINTState { /*< private >*/ diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h index 67752dc8a0..746cdfa800 100644 --- a/include/hw/riscv/sifive_e.h +++ b/include/hw/riscv/sifive_e.h @@ -26,8 +26,8 @@ #define TYPE_RISCV_E_SOC "riscv.sifive.e.soc" typedef struct SiFiveESoCState SiFiveESoCState; -#define RISCV_E_SOC(obj) \ - OBJECT_CHECK(SiFiveESoCState, (obj), TYPE_RISCV_E_SOC) +DECLARE_INSTANCE_CHECKER(SiFiveESoCState, RISCV_E_SOC, + TYPE_RISCV_E_SOC) struct SiFiveESoCState { /*< private >*/ @@ -52,8 +52,8 @@ struct SiFiveEState { typedef struct SiFiveEState SiFiveEState; #define TYPE_RISCV_E_MACHINE MACHINE_TYPE_NAME("sifive_e") -#define RISCV_E_MACHINE(obj) \ - OBJECT_CHECK(SiFiveEState, (obj), TYPE_RISCV_E_MACHINE) +DECLARE_INSTANCE_CHECKER(SiFiveEState, RISCV_E_MACHINE, + TYPE_RISCV_E_MACHINE) enum { SIFIVE_E_DEV_DEBUG, diff --git a/include/hw/riscv/sifive_e_prci.h b/include/hw/riscv/sifive_e_prci.h index de1e502eea..262ca16181 100644 --- a/include/hw/riscv/sifive_e_prci.h +++ b/include/hw/riscv/sifive_e_prci.h @@ -53,8 +53,8 @@ enum { #define TYPE_SIFIVE_E_PRCI "riscv.sifive.e.prci" typedef struct SiFiveEPRCIState SiFiveEPRCIState; -#define SIFIVE_E_PRCI(obj) \ - OBJECT_CHECK(SiFiveEPRCIState, (obj), TYPE_SIFIVE_E_PRCI) +DECLARE_INSTANCE_CHECKER(SiFiveEPRCIState, SIFIVE_E_PRCI, + TYPE_SIFIVE_E_PRCI) struct SiFiveEPRCIState { /*< private >*/ diff --git a/include/hw/riscv/sifive_gpio.h b/include/hw/riscv/sifive_gpio.h index af991fa44e..fc53785c9d 100644 --- a/include/hw/riscv/sifive_gpio.h +++ b/include/hw/riscv/sifive_gpio.h @@ -19,7 +19,8 @@ #define TYPE_SIFIVE_GPIO "sifive_soc.gpio" typedef struct SIFIVEGPIOState SIFIVEGPIOState; -#define SIFIVE_GPIO(obj) OBJECT_CHECK(SIFIVEGPIOState, (obj), TYPE_SIFIVE_GPIO) +DECLARE_INSTANCE_CHECKER(SIFIVEGPIOState, SIFIVE_GPIO, + TYPE_SIFIVE_GPIO) #define SIFIVE_GPIO_PINS 32 diff --git a/include/hw/riscv/sifive_plic.h b/include/hw/riscv/sifive_plic.h index d80c3ae5e6..b3b3b7be40 100644 --- a/include/hw/riscv/sifive_plic.h +++ b/include/hw/riscv/sifive_plic.h @@ -27,8 +27,8 @@ #define TYPE_SIFIVE_PLIC "riscv.sifive.plic" typedef struct SiFivePLICState SiFivePLICState; -#define SIFIVE_PLIC(obj) \ - OBJECT_CHECK(SiFivePLICState, (obj), TYPE_SIFIVE_PLIC) +DECLARE_INSTANCE_CHECKER(SiFivePLICState, SIFIVE_PLIC, + TYPE_SIFIVE_PLIC) typedef enum PLICMode { PLICMode_U, diff --git a/include/hw/riscv/sifive_test.h b/include/hw/riscv/sifive_test.h index dc54b7af0c..88a38d00c5 100644 --- a/include/hw/riscv/sifive_test.h +++ b/include/hw/riscv/sifive_test.h @@ -25,8 +25,8 @@ #define TYPE_SIFIVE_TEST "riscv.sifive.test" typedef struct SiFiveTestState SiFiveTestState; -#define SIFIVE_TEST(obj) \ - OBJECT_CHECK(SiFiveTestState, (obj), TYPE_SIFIVE_TEST) +DECLARE_INSTANCE_CHECKER(SiFiveTestState, SIFIVE_TEST, + TYPE_SIFIVE_TEST) struct SiFiveTestState { /*< private >*/ diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index 9d73c27232..f5a0083ba9 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -29,8 +29,8 @@ #define TYPE_RISCV_U_SOC "riscv.sifive.u.soc" typedef struct SiFiveUSoCState SiFiveUSoCState; -#define RISCV_U_SOC(obj) \ - OBJECT_CHECK(SiFiveUSoCState, (obj), TYPE_RISCV_U_SOC) +DECLARE_INSTANCE_CHECKER(SiFiveUSoCState, RISCV_U_SOC, + TYPE_RISCV_U_SOC) struct SiFiveUSoCState { /*< private >*/ @@ -52,8 +52,8 @@ struct SiFiveUSoCState { #define TYPE_RISCV_U_MACHINE MACHINE_TYPE_NAME("sifive_u") typedef struct SiFiveUState SiFiveUState; -#define RISCV_U_MACHINE(obj) \ - OBJECT_CHECK(SiFiveUState, (obj), TYPE_RISCV_U_MACHINE) +DECLARE_INSTANCE_CHECKER(SiFiveUState, RISCV_U_MACHINE, + TYPE_RISCV_U_MACHINE) struct SiFiveUState { /*< private >*/ diff --git a/include/hw/riscv/sifive_u_otp.h b/include/hw/riscv/sifive_u_otp.h index 4572534f50..82c9176c8f 100644 --- a/include/hw/riscv/sifive_u_otp.h +++ b/include/hw/riscv/sifive_u_otp.h @@ -51,8 +51,8 @@ #define TYPE_SIFIVE_U_OTP "riscv.sifive.u.otp" typedef struct SiFiveUOTPState SiFiveUOTPState; -#define SIFIVE_U_OTP(obj) \ - OBJECT_CHECK(SiFiveUOTPState, (obj), TYPE_SIFIVE_U_OTP) +DECLARE_INSTANCE_CHECKER(SiFiveUOTPState, SIFIVE_U_OTP, + TYPE_SIFIVE_U_OTP) struct SiFiveUOTPState { /*< private >*/ diff --git a/include/hw/riscv/sifive_u_prci.h b/include/hw/riscv/sifive_u_prci.h index 83eab43686..d9ebf40b7f 100644 --- a/include/hw/riscv/sifive_u_prci.h +++ b/include/hw/riscv/sifive_u_prci.h @@ -60,8 +60,8 @@ #define TYPE_SIFIVE_U_PRCI "riscv.sifive.u.prci" typedef struct SiFiveUPRCIState SiFiveUPRCIState; -#define SIFIVE_U_PRCI(obj) \ - OBJECT_CHECK(SiFiveUPRCIState, (obj), TYPE_SIFIVE_U_PRCI) +DECLARE_INSTANCE_CHECKER(SiFiveUPRCIState, SIFIVE_U_PRCI, + TYPE_SIFIVE_U_PRCI) struct SiFiveUPRCIState { /*< private >*/ diff --git a/include/hw/riscv/sifive_uart.h b/include/hw/riscv/sifive_uart.h index 2bb72ac80b..3e962be659 100644 --- a/include/hw/riscv/sifive_uart.h +++ b/include/hw/riscv/sifive_uart.h @@ -53,8 +53,8 @@ enum { #define TYPE_SIFIVE_UART "riscv.sifive.uart" typedef struct SiFiveUARTState SiFiveUARTState; -#define SIFIVE_UART(obj) \ - OBJECT_CHECK(SiFiveUARTState, (obj), TYPE_SIFIVE_UART) +DECLARE_INSTANCE_CHECKER(SiFiveUARTState, SIFIVE_UART, + TYPE_SIFIVE_UART) struct SiFiveUARTState { /*< private >*/ diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index 325ffa5728..c364bab87b 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -26,8 +26,8 @@ #define TYPE_RISCV_VIRT_MACHINE MACHINE_TYPE_NAME("virt") typedef struct RISCVVirtState RISCVVirtState; -#define RISCV_VIRT_MACHINE(obj) \ - OBJECT_CHECK(RISCVVirtState, (obj), TYPE_RISCV_VIRT_MACHINE) +DECLARE_INSTANCE_CHECKER(RISCVVirtState, RISCV_VIRT_MACHINE, + TYPE_RISCV_VIRT_MACHINE) struct RISCVVirtState { /*< private >*/ diff --git a/include/hw/rtc/allwinner-rtc.h b/include/hw/rtc/allwinner-rtc.h index 1126e05f23..5a6e9fff32 100644 --- a/include/hw/rtc/allwinner-rtc.h +++ b/include/hw/rtc/allwinner-rtc.h @@ -62,12 +62,8 @@ typedef struct AwRtcClass AwRtcClass; typedef struct AwRtcState AwRtcState; -#define AW_RTC(obj) \ - OBJECT_CHECK(AwRtcState, (obj), TYPE_AW_RTC) -#define AW_RTC_CLASS(klass) \ - OBJECT_CLASS_CHECK(AwRtcClass, (klass), TYPE_AW_RTC) -#define AW_RTC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AwRtcClass, (obj), TYPE_AW_RTC) +DECLARE_OBJ_CHECKERS(AwRtcState, AwRtcClass, + AW_RTC, TYPE_AW_RTC) /** @} */ diff --git a/include/hw/rtc/aspeed_rtc.h b/include/hw/rtc/aspeed_rtc.h index 295f4a7d30..d7691ab88f 100644 --- a/include/hw/rtc/aspeed_rtc.h +++ b/include/hw/rtc/aspeed_rtc.h @@ -24,6 +24,7 @@ struct AspeedRtcState { typedef struct AspeedRtcState AspeedRtcState; #define TYPE_ASPEED_RTC "aspeed.rtc" -#define ASPEED_RTC(obj) OBJECT_CHECK(AspeedRtcState, (obj), TYPE_ASPEED_RTC) +DECLARE_INSTANCE_CHECKER(AspeedRtcState, ASPEED_RTC, + TYPE_ASPEED_RTC) #endif /* HW_RTC_ASPEED_RTC_H */ diff --git a/include/hw/rtc/goldfish_rtc.h b/include/hw/rtc/goldfish_rtc.h index f31b0cbb89..b710c21c94 100644 --- a/include/hw/rtc/goldfish_rtc.h +++ b/include/hw/rtc/goldfish_rtc.h @@ -27,8 +27,8 @@ #define TYPE_GOLDFISH_RTC "goldfish_rtc" typedef struct GoldfishRTCState GoldfishRTCState; -#define GOLDFISH_RTC(obj) \ - OBJECT_CHECK(GoldfishRTCState, (obj), TYPE_GOLDFISH_RTC) +DECLARE_INSTANCE_CHECKER(GoldfishRTCState, GOLDFISH_RTC, + TYPE_GOLDFISH_RTC) struct GoldfishRTCState { SysBusDevice parent_obj; diff --git a/include/hw/rtc/m48t59.h b/include/hw/rtc/m48t59.h index 78aae2c072..04abedf3b2 100644 --- a/include/hw/rtc/m48t59.h +++ b/include/hw/rtc/m48t59.h @@ -32,10 +32,8 @@ #define TYPE_NVRAM "nvram" typedef struct NvramClass NvramClass; -#define NVRAM_CLASS(klass) \ - OBJECT_CLASS_CHECK(NvramClass, (klass), TYPE_NVRAM) -#define NVRAM_GET_CLASS(obj) \ - OBJECT_GET_CLASS(NvramClass, (obj), TYPE_NVRAM) +DECLARE_CLASS_CHECKERS(NvramClass, NVRAM, + TYPE_NVRAM) #define NVRAM(obj) \ INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM) diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h index 7b42d9c534..e58e006d0d 100644 --- a/include/hw/rtc/mc146818rtc.h +++ b/include/hw/rtc/mc146818rtc.h @@ -17,7 +17,8 @@ #define TYPE_MC146818_RTC "mc146818rtc" typedef struct RTCState RTCState; -#define MC146818_RTC(obj) OBJECT_CHECK(RTCState, (obj), TYPE_MC146818_RTC) +DECLARE_INSTANCE_CHECKER(RTCState, MC146818_RTC, + TYPE_MC146818_RTC) struct RTCState { ISADevice parent_obj; diff --git a/include/hw/rtc/pl031.h b/include/hw/rtc/pl031.h index 3ddf48cc76..3897b424d4 100644 --- a/include/hw/rtc/pl031.h +++ b/include/hw/rtc/pl031.h @@ -20,7 +20,8 @@ #define TYPE_PL031 "pl031" typedef struct PL031State PL031State; -#define PL031(obj) OBJECT_CHECK(PL031State, (obj), TYPE_PL031) +DECLARE_INSTANCE_CHECKER(PL031State, PL031, + TYPE_PL031) struct PL031State { SysBusDevice parent_obj; diff --git a/include/hw/rtc/xlnx-zynqmp-rtc.h b/include/hw/rtc/xlnx-zynqmp-rtc.h index 95c85d3bf1..209de85ae6 100644 --- a/include/hw/rtc/xlnx-zynqmp-rtc.h +++ b/include/hw/rtc/xlnx-zynqmp-rtc.h @@ -34,8 +34,8 @@ #define TYPE_XLNX_ZYNQMP_RTC "xlnx-zynmp.rtc" typedef struct XlnxZynqMPRTC XlnxZynqMPRTC; -#define XLNX_ZYNQMP_RTC(obj) \ - OBJECT_CHECK(XlnxZynqMPRTC, (obj), TYPE_XLNX_ZYNQMP_RTC) +DECLARE_INSTANCE_CHECKER(XlnxZynqMPRTC, XLNX_ZYNQMP_RTC, + TYPE_XLNX_ZYNQMP_RTC) REG32(SET_TIME_WRITE, 0x0) REG32(SET_TIME_READ, 0x4) diff --git a/include/hw/rx/rx62n.h b/include/hw/rx/rx62n.h index 4451a9e006..3ed80dba0d 100644 --- a/include/hw/rx/rx62n.h +++ b/include/hw/rx/rx62n.h @@ -34,7 +34,8 @@ #define TYPE_RX62N_MCU "rx62n-mcu" typedef struct RX62NState RX62NState; -#define RX62N_MCU(obj) OBJECT_CHECK(RX62NState, (obj), TYPE_RX62N_MCU) +DECLARE_INSTANCE_CHECKER(RX62NState, RX62N_MCU, + TYPE_RX62N_MCU) #define TYPE_R5F562N7_MCU "r5f562n7-mcu" #define TYPE_R5F562N8_MCU "r5f562n8-mcu" diff --git a/include/hw/s390x/3270-ccw.h b/include/hw/s390x/3270-ccw.h index ac254f95ed..9a11093192 100644 --- a/include/hw/s390x/3270-ccw.h +++ b/include/hw/s390x/3270-ccw.h @@ -33,12 +33,8 @@ typedef struct EmulatedCcw3270Class EmulatedCcw3270Class; typedef struct EmulatedCcw3270Device EmulatedCcw3270Device; -#define EMULATED_CCW_3270(obj) \ - OBJECT_CHECK(EmulatedCcw3270Device, (obj), TYPE_EMULATED_CCW_3270) -#define EMULATED_CCW_3270_CLASS(klass) \ - OBJECT_CLASS_CHECK(EmulatedCcw3270Class, (klass), TYPE_EMULATED_CCW_3270) -#define EMULATED_CCW_3270_GET_CLASS(obj) \ - OBJECT_GET_CLASS(EmulatedCcw3270Class, (obj), TYPE_EMULATED_CCW_3270) +DECLARE_OBJ_CHECKERS(EmulatedCcw3270Device, EmulatedCcw3270Class, + EMULATED_CCW_3270, TYPE_EMULATED_CCW_3270) struct EmulatedCcw3270Device { CcwDevice parent_obj; diff --git a/include/hw/s390x/ap-device.h b/include/hw/s390x/ap-device.h index b3b3e98a67..fb250a20f3 100644 --- a/include/hw/s390x/ap-device.h +++ b/include/hw/s390x/ap-device.h @@ -21,7 +21,7 @@ struct APDevice { }; typedef struct APDevice APDevice; -#define AP_DEVICE(obj) \ - OBJECT_CHECK(APDevice, (obj), AP_DEVICE_TYPE) +DECLARE_INSTANCE_CHECKER(APDevice, AP_DEVICE, + AP_DEVICE_TYPE) #endif /* HW_S390X_AP_DEVICE_H */ diff --git a/include/hw/s390x/css-bridge.h b/include/hw/s390x/css-bridge.h index 05786b38de..9fd4484204 100644 --- a/include/hw/s390x/css-bridge.h +++ b/include/hw/s390x/css-bridge.h @@ -24,8 +24,8 @@ struct VirtualCssBridge { typedef struct VirtualCssBridge VirtualCssBridge; #define TYPE_VIRTUAL_CSS_BRIDGE "virtual-css-bridge" -#define VIRTUAL_CSS_BRIDGE(obj) \ - OBJECT_CHECK(VirtualCssBridge, (obj), TYPE_VIRTUAL_CSS_BRIDGE) +DECLARE_INSTANCE_CHECKER(VirtualCssBridge, VIRTUAL_CSS_BRIDGE, + TYPE_VIRTUAL_CSS_BRIDGE) /* virtual css bus type */ struct VirtualCssBus { @@ -34,8 +34,8 @@ struct VirtualCssBus { typedef struct VirtualCssBus VirtualCssBus; #define TYPE_VIRTUAL_CSS_BUS "virtual-css-bus" -#define VIRTUAL_CSS_BUS(obj) \ - OBJECT_CHECK(VirtualCssBus, (obj), TYPE_VIRTUAL_CSS_BUS) +DECLARE_INSTANCE_CHECKER(VirtualCssBus, VIRTUAL_CSS_BUS, + TYPE_VIRTUAL_CSS_BUS) VirtualCssBus *virtual_css_bus_init(void); #endif diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h index 14eaa1b261..8fded9e599 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -44,12 +44,8 @@ #define TYPE_SCLP_EVENT "s390-sclp-event-type" typedef struct SCLPEvent SCLPEvent; typedef struct SCLPEventClass SCLPEventClass; -#define SCLP_EVENT(obj) \ - OBJECT_CHECK(SCLPEvent, (obj), TYPE_SCLP_EVENT) -#define SCLP_EVENT_CLASS(klass) \ - OBJECT_CLASS_CHECK(SCLPEventClass, (klass), TYPE_SCLP_EVENT) -#define SCLP_EVENT_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SCLPEventClass, (obj), TYPE_SCLP_EVENT) +DECLARE_OBJ_CHECKERS(SCLPEvent, SCLPEventClass, + SCLP_EVENT, TYPE_SCLP_EVENT) #define TYPE_SCLP_CPU_HOTPLUG "sclp-cpu-hotplug" #define TYPE_SCLP_QUIESCE "sclpquiesce" diff --git a/include/hw/s390x/s390-ccw.h b/include/hw/s390x/s390-ccw.h index f0f96952f1..2c807ee3a1 100644 --- a/include/hw/s390x/s390-ccw.h +++ b/include/hw/s390x/s390-ccw.h @@ -19,12 +19,8 @@ #define TYPE_S390_CCW "s390-ccw" typedef struct S390CCWDevice S390CCWDevice; typedef struct S390CCWDeviceClass S390CCWDeviceClass; -#define S390_CCW_DEVICE(obj) \ - OBJECT_CHECK(S390CCWDevice, (obj), TYPE_S390_CCW) -#define S390_CCW_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(S390CCWDeviceClass, (klass), TYPE_S390_CCW) -#define S390_CCW_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(S390CCWDeviceClass, (obj), TYPE_S390_CCW) +DECLARE_OBJ_CHECKERS(S390CCWDevice, S390CCWDeviceClass, + S390_CCW_DEVICE, TYPE_S390_CCW) struct S390CCWDevice { CcwDevice parent_obj; diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index 2ae7cca85b..a6a123598d 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -41,8 +41,8 @@ extern const VMStateDescription vmstate_adapter_routes; #define TYPE_S390_FLIC_COMMON "s390-flic" typedef struct S390FLICState S390FLICState; typedef struct S390FLICStateClass S390FLICStateClass; -#define S390_FLIC_COMMON(obj) \ - OBJECT_CHECK(S390FLICState, (obj), TYPE_S390_FLIC_COMMON) +DECLARE_OBJ_CHECKERS(S390FLICState, S390FLICStateClass, + S390_FLIC_COMMON, TYPE_S390_FLIC_COMMON) struct S390FLICState { SysBusDevice parent_obj; @@ -51,10 +51,6 @@ struct S390FLICState { bool ais_supported; }; -#define S390_FLIC_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(S390FLICStateClass, (klass), TYPE_S390_FLIC_COMMON) -#define S390_FLIC_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(S390FLICStateClass, (obj), TYPE_S390_FLIC_COMMON) struct S390FLICStateClass { DeviceClass parent_class; @@ -79,13 +75,13 @@ struct S390FLICStateClass { #define TYPE_KVM_S390_FLIC "s390-flic-kvm" typedef struct KVMS390FLICState KVMS390FLICState; -#define KVM_S390_FLIC(obj) \ - OBJECT_CHECK(KVMS390FLICState, (obj), TYPE_KVM_S390_FLIC) +DECLARE_INSTANCE_CHECKER(KVMS390FLICState, KVM_S390_FLIC, + TYPE_KVM_S390_FLIC) #define TYPE_QEMU_S390_FLIC "s390-flic-qemu" typedef struct QEMUS390FLICState QEMUS390FLICState; -#define QEMU_S390_FLIC(obj) \ - OBJECT_CHECK(QEMUS390FLICState, (obj), TYPE_QEMU_S390_FLIC) +DECLARE_INSTANCE_CHECKER(QEMUS390FLICState, QEMU_S390_FLIC, + TYPE_QEMU_S390_FLIC) #define SIC_IRQ_MODE_ALL 0 #define SIC_IRQ_MODE_SINGLE 1 diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index e19b460274..f9250fee85 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -184,9 +184,8 @@ typedef struct SCCB { #define TYPE_SCLP "sclp" typedef struct SCLPDevice SCLPDevice; typedef struct SCLPDeviceClass SCLPDeviceClass; -#define SCLP(obj) OBJECT_CHECK(SCLPDevice, (obj), TYPE_SCLP) -#define SCLP_CLASS(oc) OBJECT_CLASS_CHECK(SCLPDeviceClass, (oc), TYPE_SCLP) -#define SCLP_GET_CLASS(obj) OBJECT_GET_CLASS(SCLPDeviceClass, (obj), TYPE_SCLP) +DECLARE_OBJ_CHECKERS(SCLPDevice, SCLPDeviceClass, + SCLP, TYPE_SCLP) typedef struct SCLPEventFacility SCLPEventFacility; diff --git a/include/hw/s390x/storage-attributes.h b/include/hw/s390x/storage-attributes.h index b5d9663f7c..efb28c48be 100644 --- a/include/hw/s390x/storage-attributes.h +++ b/include/hw/s390x/storage-attributes.h @@ -22,8 +22,8 @@ typedef struct S390StAttribClass S390StAttribClass; typedef struct S390StAttribState S390StAttribState; -#define S390_STATTRIB(obj) \ - OBJECT_CHECK(S390StAttribState, (obj), TYPE_S390_STATTRIB) +DECLARE_OBJ_CHECKERS(S390StAttribState, S390StAttribClass, + S390_STATTRIB, TYPE_S390_STATTRIB) struct S390StAttribState { DeviceState parent_obj; @@ -31,10 +31,6 @@ struct S390StAttribState { bool migration_enabled; }; -#define S390_STATTRIB_CLASS(klass) \ - OBJECT_CLASS_CHECK(S390StAttribClass, (klass), TYPE_S390_STATTRIB) -#define S390_STATTRIB_GET_CLASS(obj) \ - OBJECT_GET_CLASS(S390StAttribClass, (obj), TYPE_S390_STATTRIB) struct S390StAttribClass { DeviceClass parent_class; @@ -52,16 +48,16 @@ struct S390StAttribClass { }; typedef struct QEMUS390StAttribState QEMUS390StAttribState; -#define QEMU_S390_STATTRIB(obj) \ - OBJECT_CHECK(QEMUS390StAttribState, (obj), TYPE_QEMU_S390_STATTRIB) +DECLARE_INSTANCE_CHECKER(QEMUS390StAttribState, QEMU_S390_STATTRIB, + TYPE_QEMU_S390_STATTRIB) struct QEMUS390StAttribState { S390StAttribState parent_obj; }; typedef struct KVMS390StAttribState KVMS390StAttribState; -#define KVM_S390_STATTRIB(obj) \ - OBJECT_CHECK(KVMS390StAttribState, (obj), TYPE_KVM_S390_STATTRIB) +DECLARE_INSTANCE_CHECKER(KVMS390StAttribState, KVM_S390_STATTRIB, + TYPE_KVM_S390_STATTRIB) struct KVMS390StAttribState { S390StAttribState parent_obj; diff --git a/include/hw/s390x/storage-keys.h b/include/hw/s390x/storage-keys.h index e94a201f71..40f042f54e 100644 --- a/include/hw/s390x/storage-keys.h +++ b/include/hw/s390x/storage-keys.h @@ -19,8 +19,8 @@ #define TYPE_S390_SKEYS "s390-skeys" typedef struct S390SKeysClass S390SKeysClass; typedef struct S390SKeysState S390SKeysState; -#define S390_SKEYS(obj) \ - OBJECT_CHECK(S390SKeysState, (obj), TYPE_S390_SKEYS) +DECLARE_OBJ_CHECKERS(S390SKeysState, S390SKeysClass, + S390_SKEYS, TYPE_S390_SKEYS) struct S390SKeysState { DeviceState parent_obj; @@ -28,10 +28,6 @@ struct S390SKeysState { }; -#define S390_SKEYS_CLASS(klass) \ - OBJECT_CLASS_CHECK(S390SKeysClass, (klass), TYPE_S390_SKEYS) -#define S390_SKEYS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(S390SKeysClass, (obj), TYPE_S390_SKEYS) struct S390SKeysClass { DeviceClass parent_class; @@ -45,8 +41,8 @@ struct S390SKeysClass { #define TYPE_KVM_S390_SKEYS "s390-skeys-kvm" #define TYPE_QEMU_S390_SKEYS "s390-skeys-qemu" typedef struct QEMUS390SKeysState QEMUS390SKeysState; -#define QEMU_S390_SKEYS(obj) \ - OBJECT_CHECK(QEMUS390SKeysState, (obj), TYPE_QEMU_S390_SKEYS) +DECLARE_INSTANCE_CHECKER(QEMUS390SKeysState, QEMU_S390_SKEYS, + TYPE_QEMU_S390_SKEYS) struct QEMUS390SKeysState { S390SKeysState parent_obj; diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h index e240faf11c..c02498f65e 100644 --- a/include/hw/s390x/tod.h +++ b/include/hw/s390x/tod.h @@ -23,11 +23,8 @@ typedef struct S390TOD { #define TYPE_S390_TOD "s390-tod" typedef struct S390TODClass S390TODClass; typedef struct S390TODState S390TODState; -#define S390_TOD(obj) OBJECT_CHECK(S390TODState, (obj), TYPE_S390_TOD) -#define S390_TOD_CLASS(oc) OBJECT_CLASS_CHECK(S390TODClass, (oc), \ - TYPE_S390_TOD) -#define S390_TOD_GET_CLASS(obj) OBJECT_GET_CLASS(S390TODClass, (obj), \ - TYPE_S390_TOD) +DECLARE_OBJ_CHECKERS(S390TODState, S390TODClass, + S390_TOD, TYPE_S390_TOD) #define TYPE_KVM_S390_TOD TYPE_S390_TOD "-kvm" #define TYPE_QEMU_S390_TOD TYPE_S390_TOD "-qemu" diff --git a/include/hw/s390x/vfio-ccw.h b/include/hw/s390x/vfio-ccw.h index 7bd4640ac3..9c9c8944ad 100644 --- a/include/hw/s390x/vfio-ccw.h +++ b/include/hw/s390x/vfio-ccw.h @@ -21,8 +21,8 @@ #define TYPE_VFIO_CCW "vfio-ccw" typedef struct VFIOCCWDevice VFIOCCWDevice; -#define VFIO_CCW(obj) \ - OBJECT_CHECK(VFIOCCWDevice, (obj), TYPE_VFIO_CCW) +DECLARE_INSTANCE_CHECKER(VFIOCCWDevice, VFIO_CCW, + TYPE_VFIO_CCW) #define TYPE_VFIO_CCW "vfio-ccw" diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index d4a4e2930c..f281625dd5 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -67,7 +67,8 @@ struct ESPState { #define TYPE_ESP "esp" typedef struct SysBusESPState SysBusESPState; -#define ESP_STATE(obj) OBJECT_CHECK(SysBusESPState, (obj), TYPE_ESP) +DECLARE_INSTANCE_CHECKER(SysBusESPState, ESP_STATE, + TYPE_ESP) struct SysBusESPState { /*< private >*/ diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index bad4dfb223..3818e3fa46 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -51,12 +51,8 @@ struct SCSIRequest { #define TYPE_SCSI_DEVICE "scsi-device" typedef struct SCSIDeviceClass SCSIDeviceClass; -#define SCSI_DEVICE(obj) \ - OBJECT_CHECK(SCSIDevice, (obj), TYPE_SCSI_DEVICE) -#define SCSI_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SCSIDeviceClass, (klass), TYPE_SCSI_DEVICE) -#define SCSI_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SCSIDeviceClass, (obj), TYPE_SCSI_DEVICE) +DECLARE_OBJ_CHECKERS(SCSIDevice, SCSIDeviceClass, + SCSI_DEVICE, TYPE_SCSI_DEVICE) struct SCSIDeviceClass { DeviceClass parent_class; @@ -138,7 +134,8 @@ struct SCSIBusInfo { }; #define TYPE_SCSI_BUS "SCSI" -#define SCSI_BUS(obj) OBJECT_CHECK(SCSIBus, (obj), TYPE_SCSI_BUS) +DECLARE_INSTANCE_CHECKER(SCSIBus, SCSI_BUS, + TYPE_SCSI_BUS) struct SCSIBus { BusState qbus; diff --git a/include/hw/sd/allwinner-sdhost.h b/include/hw/sd/allwinner-sdhost.h index c5a2f93cf3..c9d54f77e7 100644 --- a/include/hw/sd/allwinner-sdhost.h +++ b/include/hw/sd/allwinner-sdhost.h @@ -47,12 +47,8 @@ typedef struct AwSdHostClass AwSdHostClass; typedef struct AwSdHostState AwSdHostState; -#define AW_SDHOST(obj) \ - OBJECT_CHECK(AwSdHostState, (obj), TYPE_AW_SDHOST) -#define AW_SDHOST_CLASS(klass) \ - OBJECT_CLASS_CHECK(AwSdHostClass, (klass), TYPE_AW_SDHOST) -#define AW_SDHOST_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AwSdHostClass, (obj), TYPE_AW_SDHOST) +DECLARE_OBJ_CHECKERS(AwSdHostState, AwSdHostClass, + AW_SDHOST, TYPE_AW_SDHOST) /** @} */ diff --git a/include/hw/sd/aspeed_sdhci.h b/include/hw/sd/aspeed_sdhci.h index 527075476b..783ccc2956 100644 --- a/include/hw/sd/aspeed_sdhci.h +++ b/include/hw/sd/aspeed_sdhci.h @@ -14,8 +14,8 @@ #define TYPE_ASPEED_SDHCI "aspeed.sdhci" typedef struct AspeedSDHCIState AspeedSDHCIState; -#define ASPEED_SDHCI(obj) OBJECT_CHECK(AspeedSDHCIState, (obj), \ - TYPE_ASPEED_SDHCI) +DECLARE_INSTANCE_CHECKER(AspeedSDHCIState, ASPEED_SDHCI, + TYPE_ASPEED_SDHCI) #define ASPEED_SDHCI_CAPABILITIES 0x01E80080 #define ASPEED_SDHCI_NUM_SLOTS 2 diff --git a/include/hw/sd/bcm2835_sdhost.h b/include/hw/sd/bcm2835_sdhost.h index 233e74b002..751ba531d6 100644 --- a/include/hw/sd/bcm2835_sdhost.h +++ b/include/hw/sd/bcm2835_sdhost.h @@ -20,8 +20,8 @@ #define TYPE_BCM2835_SDHOST "bcm2835-sdhost" typedef struct BCM2835SDHostState BCM2835SDHostState; -#define BCM2835_SDHOST(obj) \ - OBJECT_CHECK(BCM2835SDHostState, (obj), TYPE_BCM2835_SDHOST) +DECLARE_INSTANCE_CHECKER(BCM2835SDHostState, BCM2835_SDHOST, + TYPE_BCM2835_SDHOST) #define BCM2835_SDHOST_FIFO_LEN 16 diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index 0c501e2f25..b7e404b665 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -94,11 +94,8 @@ typedef struct SDBus SDBus; #define TYPE_SD_CARD "sd-card" typedef struct SDCardClass SDCardClass; -#define SD_CARD(obj) OBJECT_CHECK(SDState, (obj), TYPE_SD_CARD) -#define SD_CARD_CLASS(klass) \ - OBJECT_CLASS_CHECK(SDCardClass, (klass), TYPE_SD_CARD) -#define SD_CARD_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SDCardClass, (obj), TYPE_SD_CARD) +DECLARE_OBJ_CHECKERS(SDState, SDCardClass, + SD_CARD, TYPE_SD_CARD) struct SDCardClass { /*< private >*/ @@ -119,9 +116,8 @@ struct SDCardClass { #define TYPE_SD_BUS "sd-bus" typedef struct SDBusClass SDBusClass; -#define SD_BUS(obj) OBJECT_CHECK(SDBus, (obj), TYPE_SD_BUS) -#define SD_BUS_CLASS(klass) OBJECT_CLASS_CHECK(SDBusClass, (klass), TYPE_SD_BUS) -#define SD_BUS_GET_CLASS(obj) OBJECT_GET_CLASS(SDBusClass, (obj), TYPE_SD_BUS) +DECLARE_OBJ_CHECKERS(SDBus, SDBusClass, + SD_BUS, TYPE_SD_BUS) struct SDBus { BusState qbus; diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h index 67b01fcb28..01a64c5442 100644 --- a/include/hw/sd/sdhci.h +++ b/include/hw/sd/sdhci.h @@ -115,11 +115,12 @@ typedef struct SDHCIState SDHCIState; #define SDHCI_QUIRK_NO_BUSY_IRQ BIT(14) #define TYPE_PCI_SDHCI "sdhci-pci" -#define PCI_SDHCI(obj) OBJECT_CHECK(SDHCIState, (obj), TYPE_PCI_SDHCI) +DECLARE_INSTANCE_CHECKER(SDHCIState, PCI_SDHCI, + TYPE_PCI_SDHCI) #define TYPE_SYSBUS_SDHCI "generic-sdhci" -#define SYSBUS_SDHCI(obj) \ - OBJECT_CHECK(SDHCIState, (obj), TYPE_SYSBUS_SDHCI) +DECLARE_INSTANCE_CHECKER(SDHCIState, SYSBUS_SDHCI, + TYPE_SYSBUS_SDHCI) #define TYPE_IMX_USDHC "imx-usdhc" diff --git a/include/hw/sparc/sparc32_dma.h b/include/hw/sparc/sparc32_dma.h index 9c80ef54ff..a402665a9c 100644 --- a/include/hw/sparc/sparc32_dma.h +++ b/include/hw/sparc/sparc32_dma.h @@ -10,8 +10,8 @@ #define TYPE_SPARC32_DMA_DEVICE "sparc32-dma-device" typedef struct DMADeviceState DMADeviceState; -#define SPARC32_DMA_DEVICE(obj) OBJECT_CHECK(DMADeviceState, (obj), \ - TYPE_SPARC32_DMA_DEVICE) +DECLARE_INSTANCE_CHECKER(DMADeviceState, SPARC32_DMA_DEVICE, + TYPE_SPARC32_DMA_DEVICE) struct DMADeviceState { @@ -26,8 +26,8 @@ struct DMADeviceState { #define TYPE_SPARC32_ESPDMA_DEVICE "sparc32-espdma" typedef struct ESPDMADeviceState ESPDMADeviceState; -#define SPARC32_ESPDMA_DEVICE(obj) OBJECT_CHECK(ESPDMADeviceState, (obj), \ - TYPE_SPARC32_ESPDMA_DEVICE) +DECLARE_INSTANCE_CHECKER(ESPDMADeviceState, SPARC32_ESPDMA_DEVICE, + TYPE_SPARC32_ESPDMA_DEVICE) struct ESPDMADeviceState { DMADeviceState parent_obj; @@ -37,8 +37,8 @@ struct ESPDMADeviceState { #define TYPE_SPARC32_LEDMA_DEVICE "sparc32-ledma" typedef struct LEDMADeviceState LEDMADeviceState; -#define SPARC32_LEDMA_DEVICE(obj) OBJECT_CHECK(LEDMADeviceState, (obj), \ - TYPE_SPARC32_LEDMA_DEVICE) +DECLARE_INSTANCE_CHECKER(LEDMADeviceState, SPARC32_LEDMA_DEVICE, + TYPE_SPARC32_LEDMA_DEVICE) struct LEDMADeviceState { DMADeviceState parent_obj; @@ -48,8 +48,8 @@ struct LEDMADeviceState { #define TYPE_SPARC32_DMA "sparc32-dma" typedef struct SPARC32DMAState SPARC32DMAState; -#define SPARC32_DMA(obj) OBJECT_CHECK(SPARC32DMAState, (obj), \ - TYPE_SPARC32_DMA) +DECLARE_INSTANCE_CHECKER(SPARC32DMAState, SPARC32_DMA, + TYPE_SPARC32_DMA) struct SPARC32DMAState { SysBusDevice parent_obj; diff --git a/include/hw/sparc/sun4m_iommu.h b/include/hw/sparc/sun4m_iommu.h index 6095eed0af..4e2ab34cde 100644 --- a/include/hw/sparc/sun4m_iommu.h +++ b/include/hw/sparc/sun4m_iommu.h @@ -45,7 +45,8 @@ struct IOMMUState { typedef struct IOMMUState IOMMUState; #define TYPE_SUN4M_IOMMU "sun4m-iommu" -#define SUN4M_IOMMU(obj) OBJECT_CHECK(IOMMUState, (obj), TYPE_SUN4M_IOMMU) +DECLARE_INSTANCE_CHECKER(IOMMUState, SUN4M_IOMMU, + TYPE_SUN4M_IOMMU) #define TYPE_SUN4M_IOMMU_MEMORY_REGION "sun4m-iommu-memory-region" diff --git a/include/hw/sparc/sun4u_iommu.h b/include/hw/sparc/sun4u_iommu.h index dfe10459e5..f94566a72c 100644 --- a/include/hw/sparc/sun4u_iommu.h +++ b/include/hw/sparc/sun4u_iommu.h @@ -44,7 +44,8 @@ struct IOMMUState { typedef struct IOMMUState IOMMUState; #define TYPE_SUN4U_IOMMU "sun4u-iommu" -#define SUN4U_IOMMU(obj) OBJECT_CHECK(IOMMUState, (obj), TYPE_SUN4U_IOMMU) +DECLARE_INSTANCE_CHECKER(IOMMUState, SUN4U_IOMMU, + TYPE_SUN4U_IOMMU) #define TYPE_SUN4U_IOMMU_MEMORY_REGION "sun4u-iommu-memory-region" diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h index a2072ffeea..8e023d8ff6 100644 --- a/include/hw/ssi/aspeed_smc.h +++ b/include/hw/ssi/aspeed_smc.h @@ -70,11 +70,8 @@ typedef struct AspeedSMCFlash { #define TYPE_ASPEED_SMC "aspeed.smc" typedef struct AspeedSMCClass AspeedSMCClass; typedef struct AspeedSMCState AspeedSMCState; -#define ASPEED_SMC(obj) OBJECT_CHECK(AspeedSMCState, (obj), TYPE_ASPEED_SMC) -#define ASPEED_SMC_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedSMCClass, (klass), TYPE_ASPEED_SMC) -#define ASPEED_SMC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedSMCClass, (obj), TYPE_ASPEED_SMC) +DECLARE_OBJ_CHECKERS(AspeedSMCState, AspeedSMCClass, + ASPEED_SMC, TYPE_ASPEED_SMC) struct AspeedSMCClass { SysBusDevice parent_obj; diff --git a/include/hw/ssi/imx_spi.h b/include/hw/ssi/imx_spi.h index 3a966af0ec..874fea492d 100644 --- a/include/hw/ssi/imx_spi.h +++ b/include/hw/ssi/imx_spi.h @@ -79,7 +79,8 @@ #define TYPE_IMX_SPI "imx.spi" typedef struct IMXSPIState IMXSPIState; -#define IMX_SPI(obj) OBJECT_CHECK(IMXSPIState, (obj), TYPE_IMX_SPI) +DECLARE_INSTANCE_CHECKER(IMXSPIState, IMX_SPI, + TYPE_IMX_SPI) struct IMXSPIState { /* */ diff --git a/include/hw/ssi/mss-spi.h b/include/hw/ssi/mss-spi.h index 40e1a5ac90..7c16cf6b49 100644 --- a/include/hw/ssi/mss-spi.h +++ b/include/hw/ssi/mss-spi.h @@ -32,7 +32,8 @@ #define TYPE_MSS_SPI "mss-spi" typedef struct MSSSpiState MSSSpiState; -#define MSS_SPI(obj) OBJECT_CHECK(MSSSpiState, (obj), TYPE_MSS_SPI) +DECLARE_INSTANCE_CHECKER(MSSSpiState, MSS_SPI, + TYPE_MSS_SPI) #define R_SPI_MAX 16 diff --git a/include/hw/ssi/pl022.h b/include/hw/ssi/pl022.h index 64aeb61eef..1f5da7cc44 100644 --- a/include/hw/ssi/pl022.h +++ b/include/hw/ssi/pl022.h @@ -26,7 +26,8 @@ #define TYPE_PL022 "pl022" typedef struct PL022State PL022State; -#define PL022(obj) OBJECT_CHECK(PL022State, (obj), TYPE_PL022) +DECLARE_INSTANCE_CHECKER(PL022State, PL022, + TYPE_PL022) struct PL022State { SysBusDevice parent_obj; diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h index b42765f415..b9286989fc 100644 --- a/include/hw/ssi/ssi.h +++ b/include/hw/ssi/ssi.h @@ -19,12 +19,8 @@ typedef struct SSISlaveClass SSISlaveClass; typedef enum SSICSMode SSICSMode; #define TYPE_SSI_SLAVE "ssi-slave" -#define SSI_SLAVE(obj) \ - OBJECT_CHECK(SSISlave, (obj), TYPE_SSI_SLAVE) -#define SSI_SLAVE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SSISlaveClass, (klass), TYPE_SSI_SLAVE) -#define SSI_SLAVE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SSISlaveClass, (obj), TYPE_SSI_SLAVE) +DECLARE_OBJ_CHECKERS(SSISlave, SSISlaveClass, + SSI_SLAVE, TYPE_SSI_SLAVE) #define SSI_GPIO_CS "ssi-gpio-cs" diff --git a/include/hw/ssi/stm32f2xx_spi.h b/include/hw/ssi/stm32f2xx_spi.h index 1c8ff7d724..4bb36d04ed 100644 --- a/include/hw/ssi/stm32f2xx_spi.h +++ b/include/hw/ssi/stm32f2xx_spi.h @@ -46,8 +46,8 @@ #define TYPE_STM32F2XX_SPI "stm32f2xx-spi" typedef struct STM32F2XXSPIState STM32F2XXSPIState; -#define STM32F2XX_SPI(obj) \ - OBJECT_CHECK(STM32F2XXSPIState, (obj), TYPE_STM32F2XX_SPI) +DECLARE_INSTANCE_CHECKER(STM32F2XXSPIState, STM32F2XX_SPI, + TYPE_STM32F2XX_SPI) struct STM32F2XXSPIState { /* */ diff --git a/include/hw/ssi/xilinx_spips.h b/include/hw/ssi/xilinx_spips.h index 2171018601..b1ab347617 100644 --- a/include/hw/ssi/xilinx_spips.h +++ b/include/hw/ssi/xilinx_spips.h @@ -136,17 +136,13 @@ typedef struct XilinxSPIPSClass XilinxSPIPSClass; #define TYPE_XILINX_QSPIPS "xlnx.ps7-qspi" #define TYPE_XLNX_ZYNQMP_QSPIPS "xlnx.usmp-gqspi" -#define XILINX_SPIPS(obj) \ - OBJECT_CHECK(XilinxSPIPS, (obj), TYPE_XILINX_SPIPS) -#define XILINX_SPIPS_CLASS(klass) \ - OBJECT_CLASS_CHECK(XilinxSPIPSClass, (klass), TYPE_XILINX_SPIPS) -#define XILINX_SPIPS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XilinxSPIPSClass, (obj), TYPE_XILINX_SPIPS) - -#define XILINX_QSPIPS(obj) \ - OBJECT_CHECK(XilinxQSPIPS, (obj), TYPE_XILINX_QSPIPS) - -#define XLNX_ZYNQMP_QSPIPS(obj) \ - OBJECT_CHECK(XlnxZynqMPQSPIPS, (obj), TYPE_XLNX_ZYNQMP_QSPIPS) +DECLARE_OBJ_CHECKERS(XilinxSPIPS, XilinxSPIPSClass, + XILINX_SPIPS, TYPE_XILINX_SPIPS) + +DECLARE_INSTANCE_CHECKER(XilinxQSPIPS, XILINX_QSPIPS, + TYPE_XILINX_QSPIPS) + +DECLARE_INSTANCE_CHECKER(XlnxZynqMPQSPIPS, XLNX_ZYNQMP_QSPIPS, + TYPE_XLNX_ZYNQMP_QSPIPS) #endif /* XILINX_SPIPS_H */ diff --git a/include/hw/stream.h b/include/hw/stream.h index bd41750e94..e39d5a5b55 100644 --- a/include/hw/stream.h +++ b/include/hw/stream.h @@ -7,10 +7,8 @@ #define TYPE_STREAM_SLAVE "stream-slave" typedef struct StreamSlaveClass StreamSlaveClass; -#define STREAM_SLAVE_CLASS(klass) \ - OBJECT_CLASS_CHECK(StreamSlaveClass, (klass), TYPE_STREAM_SLAVE) -#define STREAM_SLAVE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(StreamSlaveClass, (obj), TYPE_STREAM_SLAVE) +DECLARE_CLASS_CHECKERS(StreamSlaveClass, STREAM_SLAVE, + TYPE_STREAM_SLAVE) #define STREAM_SLAVE(obj) \ INTERFACE_CHECK(StreamSlave, (obj), TYPE_STREAM_SLAVE) diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 3537e43f23..459d5df041 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -17,12 +17,8 @@ typedef struct SysBusDevice SysBusDevice; #define TYPE_SYS_BUS_DEVICE "sys-bus-device" typedef struct SysBusDeviceClass SysBusDeviceClass; -#define SYS_BUS_DEVICE(obj) \ - OBJECT_CHECK(SysBusDevice, (obj), TYPE_SYS_BUS_DEVICE) -#define SYS_BUS_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SysBusDeviceClass, (klass), TYPE_SYS_BUS_DEVICE) -#define SYS_BUS_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SysBusDeviceClass, (obj), TYPE_SYS_BUS_DEVICE) +DECLARE_OBJ_CHECKERS(SysBusDevice, SysBusDeviceClass, + SYS_BUS_DEVICE, TYPE_SYS_BUS_DEVICE) /** * SysBusDeviceClass: diff --git a/include/hw/timer/a9gtimer.h b/include/hw/timer/a9gtimer.h index 88811c6c8f..f6fcc4bfc6 100644 --- a/include/hw/timer/a9gtimer.h +++ b/include/hw/timer/a9gtimer.h @@ -30,7 +30,8 @@ #define TYPE_A9_GTIMER "arm.cortex-a9-global-timer" typedef struct A9GTimerState A9GTimerState; -#define A9_GTIMER(obj) OBJECT_CHECK(A9GTimerState, (obj), TYPE_A9_GTIMER) +DECLARE_INSTANCE_CHECKER(A9GTimerState, A9_GTIMER, + TYPE_A9_GTIMER) #define R_COUNTER_LO 0x00 #define R_COUNTER_HI 0x04 diff --git a/include/hw/timer/allwinner-a10-pit.h b/include/hw/timer/allwinner-a10-pit.h index fa060c684d..9638e3c84c 100644 --- a/include/hw/timer/allwinner-a10-pit.h +++ b/include/hw/timer/allwinner-a10-pit.h @@ -7,7 +7,8 @@ #define TYPE_AW_A10_PIT "allwinner-A10-timer" typedef struct AwA10PITState AwA10PITState; -#define AW_A10_PIT(obj) OBJECT_CHECK(AwA10PITState, (obj), TYPE_AW_A10_PIT) +DECLARE_INSTANCE_CHECKER(AwA10PITState, AW_A10_PIT, + TYPE_AW_A10_PIT) #define AW_A10_PIT_TIMER_NR 6 #define AW_A10_PIT_TIMER_IRQ 0x1 diff --git a/include/hw/timer/arm_mptimer.h b/include/hw/timer/arm_mptimer.h index 643a256ecf..47d5e51686 100644 --- a/include/hw/timer/arm_mptimer.h +++ b/include/hw/timer/arm_mptimer.h @@ -37,8 +37,8 @@ typedef struct { #define TYPE_ARM_MPTIMER "arm_mptimer" typedef struct ARMMPTimerState ARMMPTimerState; -#define ARM_MPTIMER(obj) \ - OBJECT_CHECK(ARMMPTimerState, (obj), TYPE_ARM_MPTIMER) +DECLARE_INSTANCE_CHECKER(ARMMPTimerState, ARM_MPTIMER, + TYPE_ARM_MPTIMER) struct ARMMPTimerState { /*< private >*/ diff --git a/include/hw/timer/armv7m_systick.h b/include/hw/timer/armv7m_systick.h index 33df057958..b605688fee 100644 --- a/include/hw/timer/armv7m_systick.h +++ b/include/hw/timer/armv7m_systick.h @@ -18,7 +18,8 @@ #define TYPE_SYSTICK "armv7m_systick" typedef struct SysTickState SysTickState; -#define SYSTICK(obj) OBJECT_CHECK(SysTickState, (obj), TYPE_SYSTICK) +DECLARE_INSTANCE_CHECKER(SysTickState, SYSTICK, + TYPE_SYSTICK) struct SysTickState { /*< private >*/ diff --git a/include/hw/timer/aspeed_timer.h b/include/hw/timer/aspeed_timer.h index c890aaa949..4c76f955c9 100644 --- a/include/hw/timer/aspeed_timer.h +++ b/include/hw/timer/aspeed_timer.h @@ -29,8 +29,8 @@ #define TYPE_ASPEED_TIMER "aspeed.timer" typedef struct AspeedTimerClass AspeedTimerClass; typedef struct AspeedTimerCtrlState AspeedTimerCtrlState; -#define ASPEED_TIMER(obj) \ - OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER) +DECLARE_OBJ_CHECKERS(AspeedTimerCtrlState, AspeedTimerClass, + ASPEED_TIMER, TYPE_ASPEED_TIMER) #define TYPE_ASPEED_2400_TIMER TYPE_ASPEED_TIMER "-ast2400" #define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500" #define TYPE_ASPEED_2600_TIMER TYPE_ASPEED_TIMER "-ast2600" @@ -69,10 +69,6 @@ struct AspeedTimerCtrlState { AspeedSCUState *scu; }; -#define ASPEED_TIMER_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedTimerClass, (klass), TYPE_ASPEED_TIMER) -#define ASPEED_TIMER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedTimerClass, (obj), TYPE_ASPEED_TIMER) struct AspeedTimerClass { SysBusDeviceClass parent_class; diff --git a/include/hw/timer/avr_timer16.h b/include/hw/timer/avr_timer16.h index 9efe75ce5e..d454bb31cb 100644 --- a/include/hw/timer/avr_timer16.h +++ b/include/hw/timer/avr_timer16.h @@ -43,8 +43,8 @@ enum NextInterrupt { #define TYPE_AVR_TIMER16 "avr-timer16" typedef struct AVRTimer16State AVRTimer16State; -#define AVR_TIMER16(obj) \ - OBJECT_CHECK(AVRTimer16State, (obj), TYPE_AVR_TIMER16) +DECLARE_INSTANCE_CHECKER(AVRTimer16State, AVR_TIMER16, + TYPE_AVR_TIMER16) struct AVRTimer16State { /* */ diff --git a/include/hw/timer/bcm2835_systmr.h b/include/hw/timer/bcm2835_systmr.h index 796f62cf88..64166bd712 100644 --- a/include/hw/timer/bcm2835_systmr.h +++ b/include/hw/timer/bcm2835_systmr.h @@ -15,8 +15,8 @@ #define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer" typedef struct BCM2835SystemTimerState BCM2835SystemTimerState; -#define BCM2835_SYSTIMER(obj) \ - OBJECT_CHECK(BCM2835SystemTimerState, (obj), TYPE_BCM2835_SYSTIMER) +DECLARE_INSTANCE_CHECKER(BCM2835SystemTimerState, BCM2835_SYSTIMER, + TYPE_BCM2835_SYSTIMER) struct BCM2835SystemTimerState { /*< private >*/ diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsdk-apb-dualtimer.h index 8a1137aec7..7a5b9df5e5 100644 --- a/include/hw/timer/cmsdk-apb-dualtimer.h +++ b/include/hw/timer/cmsdk-apb-dualtimer.h @@ -32,8 +32,8 @@ #define TYPE_CMSDK_APB_DUALTIMER "cmsdk-apb-dualtimer" typedef struct CMSDKAPBDualTimer CMSDKAPBDualTimer; -#define CMSDK_APB_DUALTIMER(obj) OBJECT_CHECK(CMSDKAPBDualTimer, (obj), \ - TYPE_CMSDK_APB_DUALTIMER) +DECLARE_INSTANCE_CHECKER(CMSDKAPBDualTimer, CMSDK_APB_DUALTIMER, + TYPE_CMSDK_APB_DUALTIMER) /* One of the two identical timer modules in the dual-timer module */ diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h index a7ca523529..0912bc0f3c 100644 --- a/include/hw/timer/cmsdk-apb-timer.h +++ b/include/hw/timer/cmsdk-apb-timer.h @@ -19,8 +19,8 @@ #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer" typedef struct CMSDKAPBTIMER CMSDKAPBTIMER; -#define CMSDK_APB_TIMER(obj) OBJECT_CHECK(CMSDKAPBTIMER, (obj), \ - TYPE_CMSDK_APB_TIMER) +DECLARE_INSTANCE_CHECKER(CMSDKAPBTIMER, CMSDK_APB_TIMER, + TYPE_CMSDK_APB_TIMER) struct CMSDKAPBTIMER { /*< private >*/ diff --git a/include/hw/timer/digic-timer.h b/include/hw/timer/digic-timer.h index 543bf8c6be..84a0ef473a 100644 --- a/include/hw/timer/digic-timer.h +++ b/include/hw/timer/digic-timer.h @@ -24,7 +24,8 @@ #define TYPE_DIGIC_TIMER "digic-timer" typedef struct DigicTimerState DigicTimerState; -#define DIGIC_TIMER(obj) OBJECT_CHECK(DigicTimerState, (obj), TYPE_DIGIC_TIMER) +DECLARE_INSTANCE_CHECKER(DigicTimerState, DIGIC_TIMER, + TYPE_DIGIC_TIMER) #define DIGIC_TIMER_CONTROL 0x00 #define DIGIC_TIMER_CONTROL_RST 0x80000000 diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h index 6adbc31e7e..1a522a2457 100644 --- a/include/hw/timer/i8254.h +++ b/include/hw/timer/i8254.h @@ -42,12 +42,8 @@ typedef struct PITChannelInfo { #define TYPE_PIT_COMMON "pit-common" typedef struct PITCommonState PITCommonState; typedef struct PITCommonClass PITCommonClass; -#define PIT_COMMON(obj) \ - OBJECT_CHECK(PITCommonState, (obj), TYPE_PIT_COMMON) -#define PIT_COMMON_CLASS(klass) \ - OBJECT_CLASS_CHECK(PITCommonClass, (klass), TYPE_PIT_COMMON) -#define PIT_COMMON_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PITCommonClass, (obj), TYPE_PIT_COMMON) +DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass, + PIT_COMMON, TYPE_PIT_COMMON) #define TYPE_I8254 "isa-pit" #define TYPE_KVM_I8254 "kvm-pit" diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h index 1ca110caf5..39bcf81331 100644 --- a/include/hw/timer/imx_epit.h +++ b/include/hw/timer/imx_epit.h @@ -57,7 +57,8 @@ #define TYPE_IMX_EPIT "imx.epit" typedef struct IMXEPITState IMXEPITState; -#define IMX_EPIT(obj) OBJECT_CHECK(IMXEPITState, (obj), TYPE_IMX_EPIT) +DECLARE_INSTANCE_CHECKER(IMXEPITState, IMX_EPIT, + TYPE_IMX_EPIT) struct IMXEPITState { /*< private >*/ diff --git a/include/hw/timer/imx_gpt.h b/include/hw/timer/imx_gpt.h index b96633d8b2..ff5c8a351a 100644 --- a/include/hw/timer/imx_gpt.h +++ b/include/hw/timer/imx_gpt.h @@ -83,7 +83,8 @@ #define TYPE_IMX_GPT TYPE_IMX25_GPT typedef struct IMXGPTState IMXGPTState; -#define IMX_GPT(obj) OBJECT_CHECK(IMXGPTState, (obj), TYPE_IMX_GPT) +DECLARE_INSTANCE_CHECKER(IMXGPTState, IMX_GPT, + TYPE_IMX_GPT) struct IMXGPTState { /*< private >*/ diff --git a/include/hw/timer/mss-timer.h b/include/hw/timer/mss-timer.h index 011c5f1ba9..d207bae2c0 100644 --- a/include/hw/timer/mss-timer.h +++ b/include/hw/timer/mss-timer.h @@ -31,8 +31,8 @@ #define TYPE_MSS_TIMER "mss-timer" typedef struct MSSTimerState MSSTimerState; -#define MSS_TIMER(obj) OBJECT_CHECK(MSSTimerState, \ - (obj), TYPE_MSS_TIMER) +DECLARE_INSTANCE_CHECKER(MSSTimerState, MSS_TIMER, + TYPE_MSS_TIMER) /* * There are two 32-bit down counting timers. diff --git a/include/hw/timer/nrf51_timer.h b/include/hw/timer/nrf51_timer.h index b4eb29bd76..4261a03b95 100644 --- a/include/hw/timer/nrf51_timer.h +++ b/include/hw/timer/nrf51_timer.h @@ -18,7 +18,8 @@ #include "qom/object.h" #define TYPE_NRF51_TIMER "nrf51_soc.timer" typedef struct NRF51TimerState NRF51TimerState; -#define NRF51_TIMER(obj) OBJECT_CHECK(NRF51TimerState, (obj), TYPE_NRF51_TIMER) +DECLARE_INSTANCE_CHECKER(NRF51TimerState, NRF51_TIMER, + TYPE_NRF51_TIMER) #define NRF51_TIMER_REG_COUNT 4 diff --git a/include/hw/timer/renesas_cmt.h b/include/hw/timer/renesas_cmt.h index 313f9e1965..1c0b65c1d5 100644 --- a/include/hw/timer/renesas_cmt.h +++ b/include/hw/timer/renesas_cmt.h @@ -15,7 +15,8 @@ #define TYPE_RENESAS_CMT "renesas-cmt" typedef struct RCMTState RCMTState; -#define RCMT(obj) OBJECT_CHECK(RCMTState, (obj), TYPE_RENESAS_CMT) +DECLARE_INSTANCE_CHECKER(RCMTState, RCMT, + TYPE_RENESAS_CMT) enum { CMT_CH = 2, diff --git a/include/hw/timer/renesas_tmr.h b/include/hw/timer/renesas_tmr.h index e2abcb13ad..caf7eec0dc 100644 --- a/include/hw/timer/renesas_tmr.h +++ b/include/hw/timer/renesas_tmr.h @@ -15,7 +15,8 @@ #define TYPE_RENESAS_TMR "renesas-tmr" typedef struct RTMRState RTMRState; -#define RTMR(obj) OBJECT_CHECK(RTMRState, (obj), TYPE_RENESAS_TMR) +DECLARE_INSTANCE_CHECKER(RTMRState, RTMR, + TYPE_RENESAS_TMR) enum timer_event { cmia = 0, diff --git a/include/hw/timer/stm32f2xx_timer.h b/include/hw/timer/stm32f2xx_timer.h index 9eb9201085..90f40f1746 100644 --- a/include/hw/timer/stm32f2xx_timer.h +++ b/include/hw/timer/stm32f2xx_timer.h @@ -63,8 +63,8 @@ #define TYPE_STM32F2XX_TIMER "stm32f2xx-timer" typedef struct STM32F2XXTimerState STM32F2XXTimerState; -#define STM32F2XXTIMER(obj) OBJECT_CHECK(STM32F2XXTimerState, \ - (obj), TYPE_STM32F2XX_TIMER) +DECLARE_INSTANCE_CHECKER(STM32F2XXTimerState, STM32F2XXTIMER, + TYPE_STM32F2XX_TIMER) struct STM32F2XXTimerState { /* */ diff --git a/include/hw/usb.h b/include/hw/usb.h index e6ec0c891c..5783635491 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -266,12 +266,8 @@ struct USBDevice { #define TYPE_USB_DEVICE "usb-device" typedef struct USBDeviceClass USBDeviceClass; -#define USB_DEVICE(obj) \ - OBJECT_CHECK(USBDevice, (obj), TYPE_USB_DEVICE) -#define USB_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(USBDeviceClass, (klass), TYPE_USB_DEVICE) -#define USB_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(USBDeviceClass, (obj), TYPE_USB_DEVICE) +DECLARE_OBJ_CHECKERS(USBDevice, USBDeviceClass, + USB_DEVICE, TYPE_USB_DEVICE) typedef void (*USBDeviceRealize)(USBDevice *dev, Error **errp); typedef void (*USBDeviceUnrealize)(USBDevice *dev); @@ -479,7 +475,8 @@ bool usb_host_dev_is_scsi_storage(USBDevice *usbdev); /* usb-bus.c */ #define TYPE_USB_BUS "usb-bus" -#define USB_BUS(obj) OBJECT_CHECK(USBBus, (obj), TYPE_USB_BUS) +DECLARE_INSTANCE_CHECKER(USBBus, USB_BUS, + TYPE_USB_BUS) struct USBBus { BusState qbus; diff --git a/include/hw/usb/chipidea.h b/include/hw/usb/chipidea.h index 1db449e1c4..f0303b8721 100644 --- a/include/hw/usb/chipidea.h +++ b/include/hw/usb/chipidea.h @@ -13,6 +13,7 @@ struct ChipideaState { typedef struct ChipideaState ChipideaState; #define TYPE_CHIPIDEA "usb-chipidea" -#define CHIPIDEA(obj) OBJECT_CHECK(ChipideaState, (obj), TYPE_CHIPIDEA) +DECLARE_INSTANCE_CHECKER(ChipideaState, CHIPIDEA, + TYPE_CHIPIDEA) #endif /* CHIPIDEA_H */ diff --git a/include/hw/usb/imx-usb-phy.h b/include/hw/usb/imx-usb-phy.h index 9861acb5ac..f7f92fc462 100644 --- a/include/hw/usb/imx-usb-phy.h +++ b/include/hw/usb/imx-usb-phy.h @@ -40,7 +40,8 @@ enum IMXUsbPhyRegisters { #define TYPE_IMX_USBPHY "imx.usbphy" typedef struct IMXUSBPHYState IMXUSBPHYState; -#define IMX_USBPHY(obj) OBJECT_CHECK(IMXUSBPHYState, (obj), TYPE_IMX_USBPHY) +DECLARE_INSTANCE_CHECKER(IMXUSBPHYState, IMX_USBPHY, + TYPE_IMX_USBPHY) struct IMXUSBPHYState { /* */ diff --git a/include/hw/vfio/vfio-amd-xgbe.h b/include/hw/vfio/vfio-amd-xgbe.h index b860ac0446..a894546c02 100644 --- a/include/hw/vfio/vfio-amd-xgbe.h +++ b/include/hw/vfio/vfio-amd-xgbe.h @@ -40,13 +40,7 @@ struct VFIOAmdXgbeDeviceClass { typedef struct VFIOAmdXgbeDeviceClass VFIOAmdXgbeDeviceClass; -#define VFIO_AMD_XGBE_DEVICE(obj) \ - OBJECT_CHECK(VFIOAmdXgbeDevice, (obj), TYPE_VFIO_AMD_XGBE) -#define VFIO_AMD_XGBE_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VFIOAmdXgbeDeviceClass, (klass), \ - TYPE_VFIO_AMD_XGBE) -#define VFIO_AMD_XGBE_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VFIOAmdXgbeDeviceClass, (obj), \ - TYPE_VFIO_AMD_XGBE) +DECLARE_OBJ_CHECKERS(VFIOAmdXgbeDevice, VFIOAmdXgbeDeviceClass, + VFIO_AMD_XGBE_DEVICE, TYPE_VFIO_AMD_XGBE) #endif diff --git a/include/hw/vfio/vfio-calxeda-xgmac.h b/include/hw/vfio/vfio-calxeda-xgmac.h index b19dc2160b..8482f151dd 100644 --- a/include/hw/vfio/vfio-calxeda-xgmac.h +++ b/include/hw/vfio/vfio-calxeda-xgmac.h @@ -37,13 +37,7 @@ struct VFIOCalxedaXgmacDeviceClass { }; typedef struct VFIOCalxedaXgmacDeviceClass VFIOCalxedaXgmacDeviceClass; -#define VFIO_CALXEDA_XGMAC_DEVICE(obj) \ - OBJECT_CHECK(VFIOCalxedaXgmacDevice, (obj), TYPE_VFIO_CALXEDA_XGMAC) -#define VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VFIOCalxedaXgmacDeviceClass, (klass), \ - TYPE_VFIO_CALXEDA_XGMAC) -#define VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VFIOCalxedaXgmacDeviceClass, (obj), \ - TYPE_VFIO_CALXEDA_XGMAC) +DECLARE_OBJ_CHECKERS(VFIOCalxedaXgmacDevice, VFIOCalxedaXgmacDeviceClass, + VFIO_CALXEDA_XGMAC_DEVICE, TYPE_VFIO_CALXEDA_XGMAC) #endif diff --git a/include/hw/vfio/vfio-platform.h b/include/hw/vfio/vfio-platform.h index 248c23dba7..c414c3dffc 100644 --- a/include/hw/vfio/vfio-platform.h +++ b/include/hw/vfio/vfio-platform.h @@ -70,11 +70,7 @@ struct VFIOPlatformDeviceClass { }; typedef struct VFIOPlatformDeviceClass VFIOPlatformDeviceClass; -#define VFIO_PLATFORM_DEVICE(obj) \ - OBJECT_CHECK(VFIOPlatformDevice, (obj), TYPE_VFIO_PLATFORM) -#define VFIO_PLATFORM_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VFIOPlatformDeviceClass, (klass), TYPE_VFIO_PLATFORM) -#define VFIO_PLATFORM_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VFIOPlatformDeviceClass, (obj), TYPE_VFIO_PLATFORM) +DECLARE_OBJ_CHECKERS(VFIOPlatformDevice, VFIOPlatformDeviceClass, + VFIO_PLATFORM_DEVICE, TYPE_VFIO_PLATFORM) #endif /* HW_VFIO_VFIO_PLATFORM_H */ diff --git a/include/hw/virtio/vhost-scsi-common.h b/include/hw/virtio/vhost-scsi-common.h index f198f25119..5f0bf73d9d 100644 --- a/include/hw/virtio/vhost-scsi-common.h +++ b/include/hw/virtio/vhost-scsi-common.h @@ -21,8 +21,8 @@ #define TYPE_VHOST_SCSI_COMMON "vhost-scsi-common" typedef struct VHostSCSICommon VHostSCSICommon; -#define VHOST_SCSI_COMMON(obj) \ - OBJECT_CHECK(VHostSCSICommon, (obj), TYPE_VHOST_SCSI_COMMON) +DECLARE_INSTANCE_CHECKER(VHostSCSICommon, VHOST_SCSI_COMMON, + TYPE_VHOST_SCSI_COMMON) struct VHostSCSICommon { VirtIOSCSICommon parent_obj; diff --git a/include/hw/virtio/vhost-scsi.h b/include/hw/virtio/vhost-scsi.h index 72ae842646..7a77644150 100644 --- a/include/hw/virtio/vhost-scsi.h +++ b/include/hw/virtio/vhost-scsi.h @@ -27,8 +27,8 @@ enum vhost_scsi_vq_list { #define TYPE_VHOST_SCSI "vhost-scsi" typedef struct VHostSCSI VHostSCSI; -#define VHOST_SCSI(obj) \ - OBJECT_CHECK(VHostSCSI, (obj), TYPE_VHOST_SCSI) +DECLARE_INSTANCE_CHECKER(VHostSCSI, VHOST_SCSI, + TYPE_VHOST_SCSI) struct VHostSCSI { VHostSCSICommon parent_obj; diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-user-blk.h index 78b08f41da..49adec191a 100644 --- a/include/hw/virtio/vhost-user-blk.h +++ b/include/hw/virtio/vhost-user-blk.h @@ -24,8 +24,8 @@ #define TYPE_VHOST_USER_BLK "vhost-user-blk" typedef struct VHostUserBlk VHostUserBlk; -#define VHOST_USER_BLK(obj) \ - OBJECT_CHECK(VHostUserBlk, (obj), TYPE_VHOST_USER_BLK) +DECLARE_INSTANCE_CHECKER(VHostUserBlk, VHOST_USER_BLK, + TYPE_VHOST_USER_BLK) struct VHostUserBlk { VirtIODevice parent_obj; diff --git a/include/hw/virtio/vhost-user-fs.h b/include/hw/virtio/vhost-user-fs.h index fa82be0e8a..9033e6f902 100644 --- a/include/hw/virtio/vhost-user-fs.h +++ b/include/hw/virtio/vhost-user-fs.h @@ -22,8 +22,8 @@ #define TYPE_VHOST_USER_FS "vhost-user-fs-device" typedef struct VHostUserFS VHostUserFS; -#define VHOST_USER_FS(obj) \ - OBJECT_CHECK(VHostUserFS, (obj), TYPE_VHOST_USER_FS) +DECLARE_INSTANCE_CHECKER(VHostUserFS, VHOST_USER_FS, + TYPE_VHOST_USER_FS) typedef struct { CharBackend chardev; diff --git a/include/hw/virtio/vhost-user-scsi.h b/include/hw/virtio/vhost-user-scsi.h index c4c4c29bf9..342d67ee9e 100644 --- a/include/hw/virtio/vhost-user-scsi.h +++ b/include/hw/virtio/vhost-user-scsi.h @@ -25,8 +25,8 @@ #define TYPE_VHOST_USER_SCSI "vhost-user-scsi" typedef struct VHostUserSCSI VHostUserSCSI; -#define VHOST_USER_SCSI(obj) \ - OBJECT_CHECK(VHostUserSCSI, (obj), TYPE_VHOST_USER_SCSI) +DECLARE_INSTANCE_CHECKER(VHostUserSCSI, VHOST_USER_SCSI, + TYPE_VHOST_USER_SCSI) struct VHostUserSCSI { VHostSCSICommon parent_obj; diff --git a/include/hw/virtio/vhost-user-vsock.h b/include/hw/virtio/vhost-user-vsock.h index d7eda986b6..b3c40c16a3 100644 --- a/include/hw/virtio/vhost-user-vsock.h +++ b/include/hw/virtio/vhost-user-vsock.h @@ -18,8 +18,8 @@ #define TYPE_VHOST_USER_VSOCK "vhost-user-vsock-device" typedef struct VHostUserVSock VHostUserVSock; -#define VHOST_USER_VSOCK(obj) \ - OBJECT_CHECK(VHostUserVSock, (obj), TYPE_VHOST_USER_VSOCK) +DECLARE_INSTANCE_CHECKER(VHostUserVSock, VHOST_USER_VSOCK, + TYPE_VHOST_USER_VSOCK) typedef struct { CharBackend chardev; diff --git a/include/hw/virtio/vhost-vsock-common.h b/include/hw/virtio/vhost-vsock-common.h index a181396215..60bfb68db1 100644 --- a/include/hw/virtio/vhost-vsock-common.h +++ b/include/hw/virtio/vhost-vsock-common.h @@ -17,8 +17,8 @@ #define TYPE_VHOST_VSOCK_COMMON "vhost-vsock-common" typedef struct VHostVSockCommon VHostVSockCommon; -#define VHOST_VSOCK_COMMON(obj) \ - OBJECT_CHECK(VHostVSockCommon, (obj), TYPE_VHOST_VSOCK_COMMON) +DECLARE_INSTANCE_CHECKER(VHostVSockCommon, VHOST_VSOCK_COMMON, + TYPE_VHOST_VSOCK_COMMON) enum { VHOST_VSOCK_SAVEVM_VERSION = 0, diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsock.h index e13ff85d12..c561cc427a 100644 --- a/include/hw/virtio/vhost-vsock.h +++ b/include/hw/virtio/vhost-vsock.h @@ -19,8 +19,8 @@ #define TYPE_VHOST_VSOCK "vhost-vsock-device" typedef struct VHostVSock VHostVSock; -#define VHOST_VSOCK(obj) \ - OBJECT_CHECK(VHostVSock, (obj), TYPE_VHOST_VSOCK) +DECLARE_INSTANCE_CHECKER(VHostVSock, VHOST_VSOCK, + TYPE_VHOST_VSOCK) typedef struct { uint64_t guest_cid; diff --git a/include/hw/virtio/virtio-balloon.h b/include/hw/virtio/virtio-balloon.h index a5b869a4d4..0d08f496d9 100644 --- a/include/hw/virtio/virtio-balloon.h +++ b/include/hw/virtio/virtio-balloon.h @@ -22,8 +22,8 @@ #define TYPE_VIRTIO_BALLOON "virtio-balloon-device" typedef struct VirtIOBalloon VirtIOBalloon; -#define VIRTIO_BALLOON(obj) \ - OBJECT_CHECK(VirtIOBalloon, (obj), TYPE_VIRTIO_BALLOON) +DECLARE_INSTANCE_CHECKER(VirtIOBalloon, VIRTIO_BALLOON, + TYPE_VIRTIO_BALLOON) #define VIRTIO_BALLOON_FREE_PAGE_HINT_CMD_ID_MIN 0x80000000 diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index b9fb689b92..92f04180c4 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -23,8 +23,8 @@ #define TYPE_VIRTIO_BLK "virtio-blk-device" typedef struct VirtIOBlock VirtIOBlock; -#define VIRTIO_BLK(obj) \ - OBJECT_CHECK(VirtIOBlock, (obj), TYPE_VIRTIO_BLK) +DECLARE_INSTANCE_CHECKER(VirtIOBlock, VIRTIO_BLK, + TYPE_VIRTIO_BLK) /* This is the last element of the write scatter-gather list */ struct virtio_blk_inhdr diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h index f3e9096370..ef8abe49c5 100644 --- a/include/hw/virtio/virtio-bus.h +++ b/include/hw/virtio/virtio-bus.h @@ -32,11 +32,8 @@ #define TYPE_VIRTIO_BUS "virtio-bus" typedef struct VirtioBusClass VirtioBusClass; typedef struct VirtioBusState VirtioBusState; -#define VIRTIO_BUS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtioBusClass, obj, TYPE_VIRTIO_BUS) -#define VIRTIO_BUS_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtioBusClass, klass, TYPE_VIRTIO_BUS) -#define VIRTIO_BUS(obj) OBJECT_CHECK(VirtioBusState, (obj), TYPE_VIRTIO_BUS) +DECLARE_OBJ_CHECKERS(VirtioBusState, VirtioBusClass, + VIRTIO_BUS, TYPE_VIRTIO_BUS) struct VirtioBusClass { diff --git a/include/hw/virtio/virtio-crypto.h b/include/hw/virtio/virtio-crypto.h index 4134e1b7ca..7969695983 100644 --- a/include/hw/virtio/virtio-crypto.h +++ b/include/hw/virtio/virtio-crypto.h @@ -33,8 +33,8 @@ do { \ #define TYPE_VIRTIO_CRYPTO "virtio-crypto-device" typedef struct VirtIOCrypto VirtIOCrypto; -#define VIRTIO_CRYPTO(obj) \ - OBJECT_CHECK(VirtIOCrypto, (obj), TYPE_VIRTIO_CRYPTO) +DECLARE_INSTANCE_CHECKER(VirtIOCrypto, VIRTIO_CRYPTO, + TYPE_VIRTIO_CRYPTO) #define VIRTIO_CRYPTO_GET_PARENT_CLASS(obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_CRYPTO) diff --git a/include/hw/virtio/virtio-gpu-pci.h b/include/hw/virtio/virtio-gpu-pci.h index d727c8cada..5201792ede 100644 --- a/include/hw/virtio/virtio-gpu-pci.h +++ b/include/hw/virtio/virtio-gpu-pci.h @@ -24,8 +24,8 @@ typedef struct VirtIOGPUPCIBase VirtIOGPUPCIBase; * virtio-gpu-pci-base: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_GPU_PCI_BASE "virtio-gpu-pci-base" -#define VIRTIO_GPU_PCI_BASE(obj) \ - OBJECT_CHECK(VirtIOGPUPCIBase, (obj), TYPE_VIRTIO_GPU_PCI_BASE) +DECLARE_INSTANCE_CHECKER(VirtIOGPUPCIBase, VIRTIO_GPU_PCI_BASE, + TYPE_VIRTIO_GPU_PCI_BASE) struct VirtIOGPUPCIBase { VirtIOPCIProxy parent_obj; diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index d6cf7917b4..7d4f50a59d 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -27,17 +27,13 @@ #define TYPE_VIRTIO_GPU_BASE "virtio-gpu-base" typedef struct VirtIOGPUBase VirtIOGPUBase; typedef struct VirtIOGPUBaseClass VirtIOGPUBaseClass; -#define VIRTIO_GPU_BASE(obj) \ - OBJECT_CHECK(VirtIOGPUBase, (obj), TYPE_VIRTIO_GPU_BASE) -#define VIRTIO_GPU_BASE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtIOGPUBaseClass, obj, TYPE_VIRTIO_GPU_BASE) -#define VIRTIO_GPU_BASE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtIOGPUBaseClass, klass, TYPE_VIRTIO_GPU_BASE) +DECLARE_OBJ_CHECKERS(VirtIOGPUBase, VirtIOGPUBaseClass, + VIRTIO_GPU_BASE, TYPE_VIRTIO_GPU_BASE) #define TYPE_VIRTIO_GPU "virtio-gpu-device" typedef struct VirtIOGPU VirtIOGPU; -#define VIRTIO_GPU(obj) \ - OBJECT_CHECK(VirtIOGPU, (obj), TYPE_VIRTIO_GPU) +DECLARE_INSTANCE_CHECKER(VirtIOGPU, VIRTIO_GPU, + TYPE_VIRTIO_GPU) #define TYPE_VHOST_USER_GPU "vhost-user-gpu" diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h index c15e983d36..c54aa6aa72 100644 --- a/include/hw/virtio/virtio-input.h +++ b/include/hw/virtio/virtio-input.h @@ -21,14 +21,10 @@ typedef struct virtio_input_event virtio_input_event; #define TYPE_VIRTIO_INPUT "virtio-input-device" typedef struct VirtIOInput VirtIOInput; typedef struct VirtIOInputClass VirtIOInputClass; -#define VIRTIO_INPUT(obj) \ - OBJECT_CHECK(VirtIOInput, (obj), TYPE_VIRTIO_INPUT) +DECLARE_OBJ_CHECKERS(VirtIOInput, VirtIOInputClass, + VIRTIO_INPUT, TYPE_VIRTIO_INPUT) #define VIRTIO_INPUT_GET_PARENT_CLASS(obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT) -#define VIRTIO_INPUT_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtIOInputClass, obj, TYPE_VIRTIO_INPUT) -#define VIRTIO_INPUT_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtIOInputClass, klass, TYPE_VIRTIO_INPUT) #define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device" #define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device" @@ -36,22 +32,22 @@ typedef struct VirtIOInputClass VirtIOInputClass; #define TYPE_VIRTIO_TABLET "virtio-tablet-device" typedef struct VirtIOInputHID VirtIOInputHID; -#define VIRTIO_INPUT_HID(obj) \ - OBJECT_CHECK(VirtIOInputHID, (obj), TYPE_VIRTIO_INPUT_HID) +DECLARE_INSTANCE_CHECKER(VirtIOInputHID, VIRTIO_INPUT_HID, + TYPE_VIRTIO_INPUT_HID) #define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID) #define TYPE_VIRTIO_INPUT_HOST "virtio-input-host-device" typedef struct VirtIOInputHost VirtIOInputHost; -#define VIRTIO_INPUT_HOST(obj) \ - OBJECT_CHECK(VirtIOInputHost, (obj), TYPE_VIRTIO_INPUT_HOST) +DECLARE_INSTANCE_CHECKER(VirtIOInputHost, VIRTIO_INPUT_HOST, + TYPE_VIRTIO_INPUT_HOST) #define VIRTIO_INPUT_HOST_GET_PARENT_CLASS(obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST) #define TYPE_VHOST_USER_INPUT "vhost-user-input" typedef struct VHostUserInput VHostUserInput; -#define VHOST_USER_INPUT(obj) \ - OBJECT_CHECK(VHostUserInput, (obj), TYPE_VHOST_USER_INPUT) +DECLARE_INSTANCE_CHECKER(VHostUserInput, VHOST_USER_INPUT, + TYPE_VHOST_USER_INPUT) #define VHOST_USER_INPUT_GET_PARENT_CLASS(obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT) diff --git a/include/hw/virtio/virtio-iommu.h b/include/hw/virtio/virtio-iommu.h index d852980b30..ae9dc566c7 100644 --- a/include/hw/virtio/virtio-iommu.h +++ b/include/hw/virtio/virtio-iommu.h @@ -28,8 +28,8 @@ #define TYPE_VIRTIO_IOMMU "virtio-iommu-device" #define TYPE_VIRTIO_IOMMU_PCI "virtio-iommu-device-base" typedef struct VirtIOIOMMU VirtIOIOMMU; -#define VIRTIO_IOMMU(obj) \ - OBJECT_CHECK(VirtIOIOMMU, (obj), TYPE_VIRTIO_IOMMU) +DECLARE_INSTANCE_CHECKER(VirtIOIOMMU, VIRTIO_IOMMU, + TYPE_VIRTIO_IOMMU) #define TYPE_VIRTIO_IOMMU_MEMORY_REGION "virtio-iommu-memory-region" diff --git a/include/hw/virtio/virtio-mem.h b/include/hw/virtio/virtio-mem.h index 08e37d8e84..5f0b81a967 100644 --- a/include/hw/virtio/virtio-mem.h +++ b/include/hw/virtio/virtio-mem.h @@ -23,12 +23,8 @@ typedef struct VirtIOMEM VirtIOMEM; typedef struct VirtIOMEMClass VirtIOMEMClass; -#define VIRTIO_MEM(obj) \ - OBJECT_CHECK(VirtIOMEM, (obj), TYPE_VIRTIO_MEM) -#define VIRTIO_MEM_CLASS(oc) \ - OBJECT_CLASS_CHECK(VirtIOMEMClass, (oc), TYPE_VIRTIO_MEM) -#define VIRTIO_MEM_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtIOMEMClass, (obj), TYPE_VIRTIO_MEM) +DECLARE_OBJ_CHECKERS(VirtIOMEM, VirtIOMEMClass, + VIRTIO_MEM, TYPE_VIRTIO_MEM) #define VIRTIO_MEM_MEMDEV_PROP "memdev" #define VIRTIO_MEM_NODE_PROP "node" diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h index 947fb02d3e..dca651fd14 100644 --- a/include/hw/virtio/virtio-mmio.h +++ b/include/hw/virtio/virtio-mmio.h @@ -38,8 +38,8 @@ /* virtio-mmio */ #define TYPE_VIRTIO_MMIO "virtio-mmio" typedef struct VirtIOMMIOProxy VirtIOMMIOProxy; -#define VIRTIO_MMIO(obj) \ - OBJECT_CHECK(VirtIOMMIOProxy, (obj), TYPE_VIRTIO_MMIO) +DECLARE_INSTANCE_CHECKER(VirtIOMMIOProxy, VIRTIO_MMIO, + TYPE_VIRTIO_MMIO) #define VIRT_MAGIC 0x74726976 /* 'virt' */ #define VIRT_VERSION 2 diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 2e81b5bfcb..929ed232dd 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -23,8 +23,8 @@ #define TYPE_VIRTIO_NET "virtio-net-device" typedef struct VirtIONet VirtIONet; -#define VIRTIO_NET(obj) \ - OBJECT_CHECK(VirtIONet, (obj), TYPE_VIRTIO_NET) +DECLARE_INSTANCE_CHECKER(VirtIONet, VIRTIO_NET, + TYPE_VIRTIO_NET) #define TX_TIMER_INTERVAL 150000 /* 150 us */ diff --git a/include/hw/virtio/virtio-pmem.h b/include/hw/virtio/virtio-pmem.h index 56bce2be7a..6c15abad70 100644 --- a/include/hw/virtio/virtio-pmem.h +++ b/include/hw/virtio/virtio-pmem.h @@ -22,12 +22,8 @@ typedef struct VirtIOPMEM VirtIOPMEM; typedef struct VirtIOPMEMClass VirtIOPMEMClass; -#define VIRTIO_PMEM(obj) \ - OBJECT_CHECK(VirtIOPMEM, (obj), TYPE_VIRTIO_PMEM) -#define VIRTIO_PMEM_CLASS(oc) \ - OBJECT_CLASS_CHECK(VirtIOPMEMClass, (oc), TYPE_VIRTIO_PMEM) -#define VIRTIO_PMEM_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtIOPMEMClass, (obj), TYPE_VIRTIO_PMEM) +DECLARE_OBJ_CHECKERS(VirtIOPMEM, VirtIOPMEMClass, + VIRTIO_PMEM, TYPE_VIRTIO_PMEM) #define VIRTIO_PMEM_ADDR_PROP "memaddr" #define VIRTIO_PMEM_MEMDEV_PROP "memdev" diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h index 34fb5f695f..3671c9ba19 100644 --- a/include/hw/virtio/virtio-rng.h +++ b/include/hw/virtio/virtio-rng.h @@ -19,8 +19,8 @@ #define TYPE_VIRTIO_RNG "virtio-rng-device" typedef struct VirtIORNG VirtIORNG; -#define VIRTIO_RNG(obj) \ - OBJECT_CHECK(VirtIORNG, (obj), TYPE_VIRTIO_RNG) +DECLARE_INSTANCE_CHECKER(VirtIORNG, VIRTIO_RNG, + TYPE_VIRTIO_RNG) #define VIRTIO_RNG_GET_PARENT_CLASS(obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_RNG) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h index 911ccabb23..358f57379a 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -27,13 +27,13 @@ #define TYPE_VIRTIO_SCSI_COMMON "virtio-scsi-common" typedef struct VirtIOSCSICommon VirtIOSCSICommon; -#define VIRTIO_SCSI_COMMON(obj) \ - OBJECT_CHECK(VirtIOSCSICommon, (obj), TYPE_VIRTIO_SCSI_COMMON) +DECLARE_INSTANCE_CHECKER(VirtIOSCSICommon, VIRTIO_SCSI_COMMON, + TYPE_VIRTIO_SCSI_COMMON) #define TYPE_VIRTIO_SCSI "virtio-scsi-device" typedef struct VirtIOSCSI VirtIOSCSI; -#define VIRTIO_SCSI(obj) \ - OBJECT_CHECK(VirtIOSCSI, (obj), TYPE_VIRTIO_SCSI) +DECLARE_INSTANCE_CHECKER(VirtIOSCSI, VIRTIO_SCSI, + TYPE_VIRTIO_SCSI) #define VIRTIO_SCSI_MAX_CHANNEL 0 #define VIRTIO_SCSI_MAX_TARGET 255 diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio-serial.h index 7d1b44e891..f6dd30ea66 100644 --- a/include/hw/virtio/virtio-serial.h +++ b/include/hw/virtio/virtio-serial.h @@ -28,12 +28,8 @@ struct virtio_serial_conf { #define TYPE_VIRTIO_SERIAL_PORT "virtio-serial-port" typedef struct VirtIOSerialPort VirtIOSerialPort; typedef struct VirtIOSerialPortClass VirtIOSerialPortClass; -#define VIRTIO_SERIAL_PORT(obj) \ - OBJECT_CHECK(VirtIOSerialPort, (obj), TYPE_VIRTIO_SERIAL_PORT) -#define VIRTIO_SERIAL_PORT_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtIOSerialPortClass, (klass), TYPE_VIRTIO_SERIAL_PORT) -#define VIRTIO_SERIAL_PORT_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtIOSerialPortClass, (obj), TYPE_VIRTIO_SERIAL_PORT) +DECLARE_OBJ_CHECKERS(VirtIOSerialPort, VirtIOSerialPortClass, + VIRTIO_SERIAL_PORT, TYPE_VIRTIO_SERIAL_PORT) typedef struct VirtIOSerial VirtIOSerial; typedef struct VirtIOSerialBus VirtIOSerialBus; @@ -225,7 +221,7 @@ size_t virtio_serial_guest_ready(VirtIOSerialPort *port); void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle); #define TYPE_VIRTIO_SERIAL "virtio-serial-device" -#define VIRTIO_SERIAL(obj) \ - OBJECT_CHECK(VirtIOSerial, (obj), TYPE_VIRTIO_SERIAL) +DECLARE_INSTANCE_CHECKER(VirtIOSerial, VIRTIO_SERIAL, + TYPE_VIRTIO_SERIAL) #endif diff --git a/include/hw/vmstate-if.h b/include/hw/vmstate-if.h index eabf5b05ad..52df571d17 100644 --- a/include/hw/vmstate-if.h +++ b/include/hw/vmstate-if.h @@ -14,10 +14,8 @@ #define TYPE_VMSTATE_IF "vmstate-if" typedef struct VMStateIfClass VMStateIfClass; -#define VMSTATE_IF_CLASS(klass) \ - OBJECT_CLASS_CHECK(VMStateIfClass, (klass), TYPE_VMSTATE_IF) -#define VMSTATE_IF_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VMStateIfClass, (obj), TYPE_VMSTATE_IF) +DECLARE_CLASS_CHECKERS(VMStateIfClass, VMSTATE_IF, + TYPE_VMSTATE_IF) #define VMSTATE_IF(obj) \ INTERFACE_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF) diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h index be2983eefa..63f4becf86 100644 --- a/include/hw/watchdog/cmsdk-apb-watchdog.h +++ b/include/hw/watchdog/cmsdk-apb-watchdog.h @@ -37,8 +37,8 @@ #define TYPE_CMSDK_APB_WATCHDOG "cmsdk-apb-watchdog" typedef struct CMSDKAPBWatchdog CMSDKAPBWatchdog; -#define CMSDK_APB_WATCHDOG(obj) OBJECT_CHECK(CMSDKAPBWatchdog, (obj), \ - TYPE_CMSDK_APB_WATCHDOG) +DECLARE_INSTANCE_CHECKER(CMSDKAPBWatchdog, CMSDK_APB_WATCHDOG, + TYPE_CMSDK_APB_WATCHDOG) /* * This shares the same struct (and cast macro) as the base diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h index ba9a0a1fd8..2ca1eb5432 100644 --- a/include/hw/watchdog/wdt_aspeed.h +++ b/include/hw/watchdog/wdt_aspeed.h @@ -17,8 +17,8 @@ #define TYPE_ASPEED_WDT "aspeed.wdt" typedef struct AspeedWDTClass AspeedWDTClass; typedef struct AspeedWDTState AspeedWDTState; -#define ASPEED_WDT(obj) \ - OBJECT_CHECK(AspeedWDTState, (obj), TYPE_ASPEED_WDT) +DECLARE_OBJ_CHECKERS(AspeedWDTState, AspeedWDTClass, + ASPEED_WDT, TYPE_ASPEED_WDT) #define TYPE_ASPEED_2400_WDT TYPE_ASPEED_WDT "-ast2400" #define TYPE_ASPEED_2500_WDT TYPE_ASPEED_WDT "-ast2500" #define TYPE_ASPEED_2600_WDT TYPE_ASPEED_WDT "-ast2600" @@ -38,10 +38,6 @@ struct AspeedWDTState { uint32_t pclk_freq; }; -#define ASPEED_WDT_CLASS(klass) \ - OBJECT_CLASS_CHECK(AspeedWDTClass, (klass), TYPE_ASPEED_WDT) -#define ASPEED_WDT_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AspeedWDTClass, (obj), TYPE_ASPEED_WDT) struct AspeedWDTClass { SysBusDeviceClass parent_class; diff --git a/include/hw/watchdog/wdt_diag288.h b/include/hw/watchdog/wdt_diag288.h index e611163821..f72c1d3318 100644 --- a/include/hw/watchdog/wdt_diag288.h +++ b/include/hw/watchdog/wdt_diag288.h @@ -7,12 +7,8 @@ #define TYPE_WDT_DIAG288 "diag288" typedef struct DIAG288Class DIAG288Class; typedef struct DIAG288State DIAG288State; -#define DIAG288(obj) \ - OBJECT_CHECK(DIAG288State, (obj), TYPE_WDT_DIAG288) -#define DIAG288_CLASS(klass) \ - OBJECT_CLASS_CHECK(DIAG288Class, (klass), TYPE_WDT_DIAG288) -#define DIAG288_GET_CLASS(obj) \ - OBJECT_GET_CLASS(DIAG288Class, (obj), TYPE_WDT_DIAG288) +DECLARE_OBJ_CHECKERS(DIAG288State, DIAG288Class, + DIAG288, TYPE_WDT_DIAG288) #define WDT_DIAG288_INIT 0 #define WDT_DIAG288_CHANGE 1 diff --git a/include/hw/watchdog/wdt_imx2.h b/include/hw/watchdog/wdt_imx2.h index 8757418b46..7665d93640 100644 --- a/include/hw/watchdog/wdt_imx2.h +++ b/include/hw/watchdog/wdt_imx2.h @@ -20,7 +20,8 @@ #define TYPE_IMX2_WDT "imx2.wdt" typedef struct IMX2WdtState IMX2WdtState; -#define IMX2_WDT(obj) OBJECT_CHECK(IMX2WdtState, (obj), TYPE_IMX2_WDT) +DECLARE_INSTANCE_CHECKER(IMX2WdtState, IMX2_WDT, + TYPE_IMX2_WDT) enum IMX2WdtRegisters { IMX2_WDT_WCR = 0x0000, /* Control Register */ diff --git a/include/hw/xen/xen-block.h b/include/hw/xen/xen-block.h index 54f2e35122..8ff5421dc3 100644 --- a/include/hw/xen/xen-block.h +++ b/include/hw/xen/xen-block.h @@ -71,12 +71,8 @@ struct XenBlockDeviceClass { typedef struct XenBlockDeviceClass XenBlockDeviceClass; #define TYPE_XEN_BLOCK_DEVICE "xen-block" -#define XEN_BLOCK_DEVICE(obj) \ - OBJECT_CHECK(XenBlockDevice, (obj), TYPE_XEN_BLOCK_DEVICE) -#define XEN_BLOCK_DEVICE_CLASS(class) \ - OBJECT_CLASS_CHECK(XenBlockDeviceClass, (class), TYPE_XEN_BLOCK_DEVICE) -#define XEN_BLOCK_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XenBlockDeviceClass, (obj), TYPE_XEN_BLOCK_DEVICE) +DECLARE_OBJ_CHECKERS(XenBlockDevice, XenBlockDeviceClass, + XEN_BLOCK_DEVICE, TYPE_XEN_BLOCK_DEVICE) struct XenDiskDevice { XenBlockDevice blockdev; @@ -84,8 +80,8 @@ struct XenDiskDevice { typedef struct XenDiskDevice XenDiskDevice; #define TYPE_XEN_DISK_DEVICE "xen-disk" -#define XEN_DISK_DEVICE(obj) \ - OBJECT_CHECK(XenDiskDevice, (obj), TYPE_XEN_DISK_DEVICE) +DECLARE_INSTANCE_CHECKER(XenDiskDevice, XEN_DISK_DEVICE, + TYPE_XEN_DISK_DEVICE) struct XenCDRomDevice { XenBlockDevice blockdev; @@ -93,7 +89,7 @@ struct XenCDRomDevice { typedef struct XenCDRomDevice XenCDRomDevice; #define TYPE_XEN_CDROM_DEVICE "xen-cdrom" -#define XEN_CDROM_DEVICE(obj) \ - OBJECT_CHECK(XenCDRomDevice, (obj), TYPE_XEN_CDROM_DEVICE) +DECLARE_INSTANCE_CHECKER(XenCDRomDevice, XEN_CDROM_DEVICE, + TYPE_XEN_CDROM_DEVICE) #endif /* HW_XEN_BLOCK_H */ diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index 910cf49161..35fec7c905 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -60,12 +60,8 @@ struct XenDeviceClass { typedef struct XenDeviceClass XenDeviceClass; #define TYPE_XEN_DEVICE "xen-device" -#define XEN_DEVICE(obj) \ - OBJECT_CHECK(XenDevice, (obj), TYPE_XEN_DEVICE) -#define XEN_DEVICE_CLASS(class) \ - OBJECT_CLASS_CHECK(XenDeviceClass, (class), TYPE_XEN_DEVICE) -#define XEN_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XenDeviceClass, (obj), TYPE_XEN_DEVICE) +DECLARE_OBJ_CHECKERS(XenDevice, XenDeviceClass, + XEN_DEVICE, TYPE_XEN_DEVICE) struct XenBus { BusState qbus; @@ -84,12 +80,8 @@ struct XenBusClass { typedef struct XenBusClass XenBusClass; #define TYPE_XEN_BUS "xen-bus" -#define XEN_BUS(obj) \ - OBJECT_CHECK(XenBus, (obj), TYPE_XEN_BUS) -#define XEN_BUS_CLASS(class) \ - OBJECT_CLASS_CHECK(XenBusClass, (class), TYPE_XEN_BUS) -#define XEN_BUS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XenBusClass, (obj), TYPE_XEN_BUS) +DECLARE_OBJ_CHECKERS(XenBus, XenBusClass, + XEN_BUS, TYPE_XEN_BUS) void xen_bus_init(void); diff --git a/include/io/channel-buffer.h b/include/io/channel-buffer.h index 344d5957fd..89632ef437 100644 --- a/include/io/channel-buffer.h +++ b/include/io/channel-buffer.h @@ -26,8 +26,8 @@ #define TYPE_QIO_CHANNEL_BUFFER "qio-channel-buffer" typedef struct QIOChannelBuffer QIOChannelBuffer; -#define QIO_CHANNEL_BUFFER(obj) \ - OBJECT_CHECK(QIOChannelBuffer, (obj), TYPE_QIO_CHANNEL_BUFFER) +DECLARE_INSTANCE_CHECKER(QIOChannelBuffer, QIO_CHANNEL_BUFFER, + TYPE_QIO_CHANNEL_BUFFER) /** diff --git a/include/io/channel-command.h b/include/io/channel-command.h index b1671062d0..4b64ff011b 100644 --- a/include/io/channel-command.h +++ b/include/io/channel-command.h @@ -26,8 +26,8 @@ #define TYPE_QIO_CHANNEL_COMMAND "qio-channel-command" typedef struct QIOChannelCommand QIOChannelCommand; -#define QIO_CHANNEL_COMMAND(obj) \ - OBJECT_CHECK(QIOChannelCommand, (obj), TYPE_QIO_CHANNEL_COMMAND) +DECLARE_INSTANCE_CHECKER(QIOChannelCommand, QIO_CHANNEL_COMMAND, + TYPE_QIO_CHANNEL_COMMAND) diff --git a/include/io/channel-file.h b/include/io/channel-file.h index d91c9f5bc1..c6caf179d9 100644 --- a/include/io/channel-file.h +++ b/include/io/channel-file.h @@ -26,8 +26,8 @@ #define TYPE_QIO_CHANNEL_FILE "qio-channel-file" typedef struct QIOChannelFile QIOChannelFile; -#define QIO_CHANNEL_FILE(obj) \ - OBJECT_CHECK(QIOChannelFile, (obj), TYPE_QIO_CHANNEL_FILE) +DECLARE_INSTANCE_CHECKER(QIOChannelFile, QIO_CHANNEL_FILE, + TYPE_QIO_CHANNEL_FILE) /** diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h index ee898d991b..62e3e2e970 100644 --- a/include/io/channel-socket.h +++ b/include/io/channel-socket.h @@ -28,8 +28,8 @@ #define TYPE_QIO_CHANNEL_SOCKET "qio-channel-socket" typedef struct QIOChannelSocket QIOChannelSocket; -#define QIO_CHANNEL_SOCKET(obj) \ - OBJECT_CHECK(QIOChannelSocket, (obj), TYPE_QIO_CHANNEL_SOCKET) +DECLARE_INSTANCE_CHECKER(QIOChannelSocket, QIO_CHANNEL_SOCKET, + TYPE_QIO_CHANNEL_SOCKET) /** diff --git a/include/io/channel-tls.h b/include/io/channel-tls.h index ebd42f981e..036bf54195 100644 --- a/include/io/channel-tls.h +++ b/include/io/channel-tls.h @@ -28,8 +28,8 @@ #define TYPE_QIO_CHANNEL_TLS "qio-channel-tls" typedef struct QIOChannelTLS QIOChannelTLS; -#define QIO_CHANNEL_TLS(obj) \ - OBJECT_CHECK(QIOChannelTLS, (obj), TYPE_QIO_CHANNEL_TLS) +DECLARE_INSTANCE_CHECKER(QIOChannelTLS, QIO_CHANNEL_TLS, + TYPE_QIO_CHANNEL_TLS) /** diff --git a/include/io/channel-websock.h b/include/io/channel-websock.h index 5ab8811306..b07eddabe1 100644 --- a/include/io/channel-websock.h +++ b/include/io/channel-websock.h @@ -28,8 +28,8 @@ #define TYPE_QIO_CHANNEL_WEBSOCK "qio-channel-websock" typedef struct QIOChannelWebsock QIOChannelWebsock; -#define QIO_CHANNEL_WEBSOCK(obj) \ - OBJECT_CHECK(QIOChannelWebsock, (obj), TYPE_QIO_CHANNEL_WEBSOCK) +DECLARE_INSTANCE_CHECKER(QIOChannelWebsock, QIO_CHANNEL_WEBSOCK, + TYPE_QIO_CHANNEL_WEBSOCK) typedef union QIOChannelWebsockMask QIOChannelWebsockMask; diff --git a/include/io/channel.h b/include/io/channel.h index 67b9768eff..3ebdc7954f 100644 --- a/include/io/channel.h +++ b/include/io/channel.h @@ -28,12 +28,8 @@ #define TYPE_QIO_CHANNEL "qio-channel" typedef struct QIOChannel QIOChannel; typedef struct QIOChannelClass QIOChannelClass; -#define QIO_CHANNEL(obj) \ - OBJECT_CHECK(QIOChannel, (obj), TYPE_QIO_CHANNEL) -#define QIO_CHANNEL_CLASS(klass) \ - OBJECT_CLASS_CHECK(QIOChannelClass, klass, TYPE_QIO_CHANNEL) -#define QIO_CHANNEL_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QIOChannelClass, obj, TYPE_QIO_CHANNEL) +DECLARE_OBJ_CHECKERS(QIOChannel, QIOChannelClass, + QIO_CHANNEL, TYPE_QIO_CHANNEL) #define QIO_CHANNEL_ERR_BLOCK -2 diff --git a/include/io/dns-resolver.h b/include/io/dns-resolver.h index 5e720bf267..96a3186b6b 100644 --- a/include/io/dns-resolver.h +++ b/include/io/dns-resolver.h @@ -28,12 +28,8 @@ #define TYPE_QIO_DNS_RESOLVER "qio-dns-resolver" typedef struct QIODNSResolver QIODNSResolver; typedef struct QIODNSResolverClass QIODNSResolverClass; -#define QIO_DNS_RESOLVER(obj) \ - OBJECT_CHECK(QIODNSResolver, (obj), TYPE_QIO_DNS_RESOLVER) -#define QIO_DNS_RESOLVER_CLASS(klass) \ - OBJECT_CLASS_CHECK(QIODNSResolverClass, klass, TYPE_QIO_DNS_RESOLVER) -#define QIO_DNS_RESOLVER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QIODNSResolverClass, obj, TYPE_QIO_DNS_RESOLVER) +DECLARE_OBJ_CHECKERS(QIODNSResolver, QIODNSResolverClass, + QIO_DNS_RESOLVER, TYPE_QIO_DNS_RESOLVER) /** diff --git a/include/io/net-listener.h b/include/io/net-listener.h index fbdd2dbf9a..93367db291 100644 --- a/include/io/net-listener.h +++ b/include/io/net-listener.h @@ -27,12 +27,8 @@ #define TYPE_QIO_NET_LISTENER "qio-net-listener" typedef struct QIONetListener QIONetListener; typedef struct QIONetListenerClass QIONetListenerClass; -#define QIO_NET_LISTENER(obj) \ - OBJECT_CHECK(QIONetListener, (obj), TYPE_QIO_NET_LISTENER) -#define QIO_NET_LISTENER_CLASS(klass) \ - OBJECT_CLASS_CHECK(QIONetListenerClass, klass, TYPE_QIO_NET_LISTENER) -#define QIO_NET_LISTENER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QIONetListenerClass, obj, TYPE_QIO_NET_LISTENER) +DECLARE_OBJ_CHECKERS(QIONetListener, QIONetListenerClass, + QIO_NET_LISTENER, TYPE_QIO_NET_LISTENER) typedef void (*QIONetListenerClientFunc)(QIONetListener *listener, diff --git a/include/net/can_emu.h b/include/net/can_emu.h index 7e90fd8a45..150f91a657 100644 --- a/include/net/can_emu.h +++ b/include/net/can_emu.h @@ -100,8 +100,8 @@ struct CanBusClientState { }; #define TYPE_CAN_BUS "can-bus" -#define CAN_BUS(obj) \ - OBJECT_CHECK(CanBusState, (obj), TYPE_CAN_BUS) +DECLARE_INSTANCE_CHECKER(CanBusState, CAN_BUS, + TYPE_CAN_BUS) int can_bus_filter_match(struct qemu_can_filter *filter, qemu_canid_t can_id); diff --git a/include/net/can_host.h b/include/net/can_host.h index 13b6a191dd..18979c2e2d 100644 --- a/include/net/can_host.h +++ b/include/net/can_host.h @@ -34,12 +34,8 @@ #define TYPE_CAN_HOST "can-host" typedef struct CanHostClass CanHostClass; typedef struct CanHostState CanHostState; -#define CAN_HOST_CLASS(klass) \ - OBJECT_CLASS_CHECK(CanHostClass, (klass), TYPE_CAN_HOST) -#define CAN_HOST_GET_CLASS(obj) \ - OBJECT_GET_CLASS(CanHostClass, (obj), TYPE_CAN_HOST) -#define CAN_HOST(obj) \ - OBJECT_CHECK(CanHostState, (obj), TYPE_CAN_HOST) +DECLARE_OBJ_CHECKERS(CanHostState, CanHostClass, + CAN_HOST, TYPE_CAN_HOST) struct CanHostState { ObjectClass oc; diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h index 2be985f86e..f118fb516b 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -7,12 +7,8 @@ #define TYPE_USER_CREATABLE "user-creatable" typedef struct UserCreatableClass UserCreatableClass; -#define USER_CREATABLE_CLASS(klass) \ - OBJECT_CLASS_CHECK(UserCreatableClass, (klass), \ - TYPE_USER_CREATABLE) -#define USER_CREATABLE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(UserCreatableClass, (obj), \ - TYPE_USER_CREATABLE) +DECLARE_CLASS_CHECKERS(UserCreatableClass, USER_CREATABLE, + TYPE_USER_CREATABLE) #define USER_CREATABLE(obj) \ INTERFACE_CHECK(UserCreatable, (obj), \ TYPE_USER_CREATABLE) diff --git a/include/scsi/pr-manager.h b/include/scsi/pr-manager.h index 2c699e4030..f801fe9533 100644 --- a/include/scsi/pr-manager.h +++ b/include/scsi/pr-manager.h @@ -11,12 +11,8 @@ typedef struct PRManager PRManager; typedef struct PRManagerClass PRManagerClass; -#define PR_MANAGER_CLASS(klass) \ - OBJECT_CLASS_CHECK(PRManagerClass, (klass), TYPE_PR_MANAGER) -#define PR_MANAGER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PRManagerClass, (obj), TYPE_PR_MANAGER) -#define PR_MANAGER(obj) \ - OBJECT_CHECK(PRManager, (obj), TYPE_PR_MANAGER) +DECLARE_OBJ_CHECKERS(PRManager, PRManagerClass, + PR_MANAGER, TYPE_PR_MANAGER) struct sg_io_hdr; diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 2bda18be12..6189f6aa7a 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -61,12 +61,8 @@ typedef struct AccelClass AccelClass; #define ACCEL_CLASS_SUFFIX "-" TYPE_ACCEL #define ACCEL_CLASS_NAME(a) (a ACCEL_CLASS_SUFFIX) -#define ACCEL_CLASS(klass) \ - OBJECT_CLASS_CHECK(AccelClass, (klass), TYPE_ACCEL) -#define ACCEL(obj) \ - OBJECT_CHECK(AccelState, (obj), TYPE_ACCEL) -#define ACCEL_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL) +DECLARE_OBJ_CHECKERS(AccelState, AccelClass, + ACCEL, TYPE_ACCEL) AccelClass *accel_find(const char *opt_name); int accel_init_machine(AccelState *accel, MachineState *ms); diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index e11526271a..65c017cf81 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -39,15 +39,8 @@ typedef struct CryptoDevBackend CryptoDevBackend; typedef struct CryptoDevBackendClass CryptoDevBackendClass; -#define CRYPTODEV_BACKEND(obj) \ - OBJECT_CHECK(CryptoDevBackend, \ - (obj), TYPE_CRYPTODEV_BACKEND) -#define CRYPTODEV_BACKEND_GET_CLASS(obj) \ - OBJECT_GET_CLASS(CryptoDevBackendClass, \ - (obj), TYPE_CRYPTODEV_BACKEND) -#define CRYPTODEV_BACKEND_CLASS(klass) \ - OBJECT_CLASS_CHECK(CryptoDevBackendClass, \ - (klass), TYPE_CRYPTODEV_BACKEND) +DECLARE_OBJ_CHECKERS(CryptoDevBackend, CryptoDevBackendClass, + CRYPTODEV_BACKEND, TYPE_CRYPTODEV_BACKEND) #define MAX_CRYPTO_QUEUE_NUM 64 diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 7b775b6687..1e6078f872 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -22,12 +22,8 @@ #define TYPE_MEMORY_BACKEND "memory-backend" typedef struct HostMemoryBackend HostMemoryBackend; typedef struct HostMemoryBackendClass HostMemoryBackendClass; -#define MEMORY_BACKEND(obj) \ - OBJECT_CHECK(HostMemoryBackend, (obj), TYPE_MEMORY_BACKEND) -#define MEMORY_BACKEND_GET_CLASS(obj) \ - OBJECT_GET_CLASS(HostMemoryBackendClass, (obj), TYPE_MEMORY_BACKEND) -#define MEMORY_BACKEND_CLASS(klass) \ - OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEND) +DECLARE_OBJ_CHECKERS(HostMemoryBackend, HostMemoryBackendClass, + MEMORY_BACKEND, TYPE_MEMORY_BACKEND) /* hostmem-ram.c */ /** diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h index 566b5f52fc..1398679458 100644 --- a/include/sysemu/hvf.h +++ b/include/sysemu/hvf.h @@ -37,7 +37,7 @@ void hvf_vcpu_destroy(CPUState *); #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf") typedef struct HVFState HVFState; -#define HVF_STATE(obj) \ - OBJECT_CHECK(HVFState, (obj), TYPE_HVF_ACCEL) +DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE, + TYPE_HVF_ACCEL) #endif diff --git a/include/sysemu/iothread.h b/include/sysemu/iothread.h index 42902ffb9f..0c5284dbbc 100644 --- a/include/sysemu/iothread.h +++ b/include/sysemu/iothread.h @@ -40,8 +40,8 @@ struct IOThread { }; typedef struct IOThread IOThread; -#define IOTHREAD(obj) \ - OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD) +DECLARE_INSTANCE_CHECKER(IOThread, IOTHREAD, + TYPE_IOTHREAD) char *iothread_get_id(IOThread *iothread); IOThread *iothread_by_id(const char *id); diff --git a/include/sysemu/rng-random.h b/include/sysemu/rng-random.h index 87e82dd7a3..58033ac3fe 100644 --- a/include/sysemu/rng-random.h +++ b/include/sysemu/rng-random.h @@ -16,7 +16,8 @@ #define TYPE_RNG_RANDOM "rng-random" typedef struct RngRandom RngRandom; -#define RNG_RANDOM(obj) OBJECT_CHECK(RngRandom, (obj), TYPE_RNG_RANDOM) +DECLARE_INSTANCE_CHECKER(RngRandom, RNG_RANDOM, + TYPE_RNG_RANDOM) #endif diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h index c38da7d342..f8fc948109 100644 --- a/include/sysemu/rng.h +++ b/include/sysemu/rng.h @@ -19,12 +19,8 @@ #define TYPE_RNG_BACKEND "rng-backend" typedef struct RngBackend RngBackend; typedef struct RngBackendClass RngBackendClass; -#define RNG_BACKEND(obj) \ - OBJECT_CHECK(RngBackend, (obj), TYPE_RNG_BACKEND) -#define RNG_BACKEND_GET_CLASS(obj) \ - OBJECT_GET_CLASS(RngBackendClass, (obj), TYPE_RNG_BACKEND) -#define RNG_BACKEND_CLASS(klass) \ - OBJECT_CLASS_CHECK(RngBackendClass, (klass), TYPE_RNG_BACKEND) +DECLARE_OBJ_CHECKERS(RngBackend, RngBackendClass, + RNG_BACKEND, TYPE_RNG_BACKEND) #define TYPE_RNG_BUILTIN "rng-builtin" diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h index 04673cab53..1a85564e47 100644 --- a/include/sysemu/tpm.h +++ b/include/sysemu/tpm.h @@ -27,10 +27,8 @@ typedef enum TPMVersion { #define TYPE_TPM_IF "tpm-if" typedef struct TPMIfClass TPMIfClass; -#define TPM_IF_CLASS(klass) \ - OBJECT_CLASS_CHECK(TPMIfClass, (klass), TYPE_TPM_IF) -#define TPM_IF_GET_CLASS(obj) \ - OBJECT_GET_CLASS(TPMIfClass, (obj), TYPE_TPM_IF) +DECLARE_CLASS_CHECKERS(TPMIfClass, TPM_IF, + TYPE_TPM_IF) #define TPM_IF(obj) \ INTERFACE_CHECK(TPMIf, (obj), TYPE_TPM_IF) diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h index 740c94c6cd..e038b79d34 100644 --- a/include/sysemu/tpm_backend.h +++ b/include/sysemu/tpm_backend.h @@ -21,12 +21,8 @@ #define TYPE_TPM_BACKEND "tpm-backend" typedef struct TPMBackend TPMBackend; typedef struct TPMBackendClass TPMBackendClass; -#define TPM_BACKEND(obj) \ - OBJECT_CHECK(TPMBackend, (obj), TYPE_TPM_BACKEND) -#define TPM_BACKEND_GET_CLASS(obj) \ - OBJECT_GET_CLASS(TPMBackendClass, (obj), TYPE_TPM_BACKEND) -#define TPM_BACKEND_CLASS(klass) \ - OBJECT_CLASS_CHECK(TPMBackendClass, (klass), TYPE_TPM_BACKEND) +DECLARE_OBJ_CHECKERS(TPMBackend, TPMBackendClass, + TPM_BACKEND, TYPE_TPM_BACKEND) typedef struct TPMBackendCmd { diff --git a/include/sysemu/vhost-user-backend.h b/include/sysemu/vhost-user-backend.h index 89eb5eaf65..e4c85e33c0 100644 --- a/include/sysemu/vhost-user-backend.h +++ b/include/sysemu/vhost-user-backend.h @@ -24,12 +24,8 @@ #define TYPE_VHOST_USER_BACKEND "vhost-user-backend" typedef struct VhostUserBackend VhostUserBackend; typedef struct VhostUserBackendClass VhostUserBackendClass; -#define VHOST_USER_BACKEND(obj) \ - OBJECT_CHECK(VhostUserBackend, (obj), TYPE_VHOST_USER_BACKEND) -#define VHOST_USER_BACKEND_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VhostUserBackendClass, (obj), TYPE_VHOST_USER_BACKEND) -#define VHOST_USER_BACKEND_CLASS(klass) \ - OBJECT_CLASS_CHECK(VhostUserBackendClass, (klass), TYPE_VHOST_USER_BACKEND) +DECLARE_OBJ_CHECKERS(VhostUserBackend, VhostUserBackendClass, + VHOST_USER_BACKEND, TYPE_VHOST_USER_BACKEND) struct VhostUserBackendClass { diff --git a/target/alpha/cpu-qom.h b/target/alpha/cpu-qom.h index 1124668cf0..45350318c9 100644 --- a/target/alpha/cpu-qom.h +++ b/target/alpha/cpu-qom.h @@ -27,12 +27,8 @@ typedef struct AlphaCPU AlphaCPU; typedef struct AlphaCPUClass AlphaCPUClass; -#define ALPHA_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(AlphaCPUClass, (klass), TYPE_ALPHA_CPU) -#define ALPHA_CPU(obj) \ - OBJECT_CHECK(AlphaCPU, (obj), TYPE_ALPHA_CPU) -#define ALPHA_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AlphaCPUClass, (obj), TYPE_ALPHA_CPU) +DECLARE_OBJ_CHECKERS(AlphaCPU, AlphaCPUClass, + ALPHA_CPU, TYPE_ALPHA_CPU) /** * AlphaCPUClass: diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h index 4c8f54b251..eeb1917d07 100644 --- a/target/arm/cpu-qom.h +++ b/target/arm/cpu-qom.h @@ -29,12 +29,8 @@ struct arm_boot_info; typedef struct ARMCPU ARMCPU; typedef struct ARMCPUClass ARMCPUClass; -#define ARM_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(ARMCPUClass, (klass), TYPE_ARM_CPU) -#define ARM_CPU(obj) \ - OBJECT_CHECK(ARMCPU, (obj), TYPE_ARM_CPU) -#define ARM_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ARMCPUClass, (obj), TYPE_ARM_CPU) +DECLARE_OBJ_CHECKERS(ARMCPU, ARMCPUClass, + ARM_CPU, TYPE_ARM_CPU) #define TYPE_ARM_MAX_CPU "max-" TYPE_ARM_CPU diff --git a/target/arm/idau.h b/target/arm/idau.h index 2f09bbb34f..0ef5251971 100644 --- a/target/arm/idau.h +++ b/target/arm/idau.h @@ -34,10 +34,8 @@ #define IDAU_INTERFACE(obj) \ INTERFACE_CHECK(IDAUInterface, (obj), TYPE_IDAU_INTERFACE) typedef struct IDAUInterfaceClass IDAUInterfaceClass; -#define IDAU_INTERFACE_CLASS(class) \ - OBJECT_CLASS_CHECK(IDAUInterfaceClass, (class), TYPE_IDAU_INTERFACE) -#define IDAU_INTERFACE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(IDAUInterfaceClass, (obj), TYPE_IDAU_INTERFACE) +DECLARE_CLASS_CHECKERS(IDAUInterfaceClass, IDAU_INTERFACE, + TYPE_IDAU_INTERFACE) typedef struct IDAUInterface IDAUInterface; diff --git a/target/avr/cpu-qom.h b/target/avr/cpu-qom.h index fac8430253..1bbfbb2087 100644 --- a/target/avr/cpu-qom.h +++ b/target/avr/cpu-qom.h @@ -28,12 +28,8 @@ typedef struct AVRCPU AVRCPU; typedef struct AVRCPUClass AVRCPUClass; -#define AVR_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(AVRCPUClass, (klass), TYPE_AVR_CPU) -#define AVR_CPU(obj) \ - OBJECT_CHECK(AVRCPU, (obj), TYPE_AVR_CPU) -#define AVR_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AVRCPUClass, (obj), TYPE_AVR_CPU) +DECLARE_OBJ_CHECKERS(AVRCPU, AVRCPUClass, + AVR_CPU, TYPE_AVR_CPU) /** * AVRCPUClass: diff --git a/target/cris/cpu-qom.h b/target/cris/cpu-qom.h index cac3e9af1b..eced6ef7c9 100644 --- a/target/cris/cpu-qom.h +++ b/target/cris/cpu-qom.h @@ -27,12 +27,8 @@ typedef struct CRISCPU CRISCPU; typedef struct CRISCPUClass CRISCPUClass; -#define CRIS_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(CRISCPUClass, (klass), TYPE_CRIS_CPU) -#define CRIS_CPU(obj) \ - OBJECT_CHECK(CRISCPU, (obj), TYPE_CRIS_CPU) -#define CRIS_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(CRISCPUClass, (obj), TYPE_CRIS_CPU) +DECLARE_OBJ_CHECKERS(CRISCPU, CRISCPUClass, + CRIS_CPU, TYPE_CRIS_CPU) /** * CRISCPUClass: diff --git a/target/hppa/cpu-qom.h b/target/hppa/cpu-qom.h index 295b2aaf19..5c5aa0c053 100644 --- a/target/hppa/cpu-qom.h +++ b/target/hppa/cpu-qom.h @@ -27,12 +27,8 @@ typedef struct HPPACPU HPPACPU; typedef struct HPPACPUClass HPPACPUClass; -#define HPPA_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(HPPACPUClass, (klass), TYPE_HPPA_CPU) -#define HPPA_CPU(obj) \ - OBJECT_CHECK(HPPACPU, (obj), TYPE_HPPA_CPU) -#define HPPA_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(HPPACPUClass, (obj), TYPE_HPPA_CPU) +DECLARE_OBJ_CHECKERS(HPPACPU, HPPACPUClass, + HPPA_CPU, TYPE_HPPA_CPU) /** * HPPACPUClass: diff --git a/target/i386/cpu-qom.h b/target/i386/cpu-qom.h index 6b0bf476e5..05b52ba74c 100644 --- a/target/i386/cpu-qom.h +++ b/target/i386/cpu-qom.h @@ -32,12 +32,8 @@ typedef struct X86CPU X86CPU; typedef struct X86CPUClass X86CPUClass; -#define X86_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(X86CPUClass, (klass), TYPE_X86_CPU) -#define X86_CPU(obj) \ - OBJECT_CHECK(X86CPU, (obj), TYPE_X86_CPU) -#define X86_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(X86CPUClass, (obj), TYPE_X86_CPU) +DECLARE_OBJ_CHECKERS(X86CPU, X86CPUClass, + X86_CPU, TYPE_X86_CPU) typedef struct X86CPUModel X86CPUModel; diff --git a/target/lm32/cpu-qom.h b/target/lm32/cpu-qom.h index 2c0654b695..9bf2f82ffe 100644 --- a/target/lm32/cpu-qom.h +++ b/target/lm32/cpu-qom.h @@ -27,12 +27,8 @@ typedef struct LM32CPU LM32CPU; typedef struct LM32CPUClass LM32CPUClass; -#define LM32_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(LM32CPUClass, (klass), TYPE_LM32_CPU) -#define LM32_CPU(obj) \ - OBJECT_CHECK(LM32CPU, (obj), TYPE_LM32_CPU) -#define LM32_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(LM32CPUClass, (obj), TYPE_LM32_CPU) +DECLARE_OBJ_CHECKERS(LM32CPU, LM32CPUClass, + LM32_CPU, TYPE_LM32_CPU) /** * LM32CPUClass: diff --git a/target/m68k/cpu-qom.h b/target/m68k/cpu-qom.h index 3b199be545..241a3b19af 100644 --- a/target/m68k/cpu-qom.h +++ b/target/m68k/cpu-qom.h @@ -27,12 +27,8 @@ typedef struct M68kCPU M68kCPU; typedef struct M68kCPUClass M68kCPUClass; -#define M68K_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(M68kCPUClass, (klass), TYPE_M68K_CPU) -#define M68K_CPU(obj) \ - OBJECT_CHECK(M68kCPU, (obj), TYPE_M68K_CPU) -#define M68K_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(M68kCPUClass, (obj), TYPE_M68K_CPU) +DECLARE_OBJ_CHECKERS(M68kCPU, M68kCPUClass, + M68K_CPU, TYPE_M68K_CPU) /* * M68kCPUClass: diff --git a/target/microblaze/cpu-qom.h b/target/microblaze/cpu-qom.h index 564fa18ccb..73c2237f98 100644 --- a/target/microblaze/cpu-qom.h +++ b/target/microblaze/cpu-qom.h @@ -27,12 +27,8 @@ typedef struct MicroBlazeCPU MicroBlazeCPU; typedef struct MicroBlazeCPUClass MicroBlazeCPUClass; -#define MICROBLAZE_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(MicroBlazeCPUClass, (klass), TYPE_MICROBLAZE_CPU) -#define MICROBLAZE_CPU(obj) \ - OBJECT_CHECK(MicroBlazeCPU, (obj), TYPE_MICROBLAZE_CPU) -#define MICROBLAZE_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MicroBlazeCPUClass, (obj), TYPE_MICROBLAZE_CPU) +DECLARE_OBJ_CHECKERS(MicroBlazeCPU, MicroBlazeCPUClass, + MICROBLAZE_CPU, TYPE_MICROBLAZE_CPU) /** * MicroBlazeCPUClass: diff --git a/target/mips/cpu-qom.h b/target/mips/cpu-qom.h index 3a5fd9561e..82f45a828c 100644 --- a/target/mips/cpu-qom.h +++ b/target/mips/cpu-qom.h @@ -31,12 +31,8 @@ typedef struct MIPSCPU MIPSCPU; typedef struct MIPSCPUClass MIPSCPUClass; -#define MIPS_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(MIPSCPUClass, (klass), TYPE_MIPS_CPU) -#define MIPS_CPU(obj) \ - OBJECT_CHECK(MIPSCPU, (obj), TYPE_MIPS_CPU) -#define MIPS_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MIPSCPUClass, (obj), TYPE_MIPS_CPU) +DECLARE_OBJ_CHECKERS(MIPSCPU, MIPSCPUClass, + MIPS_CPU, TYPE_MIPS_CPU) /** * MIPSCPUClass: diff --git a/target/moxie/cpu.h b/target/moxie/cpu.h index af4d6abf16..a9832a2d85 100644 --- a/target/moxie/cpu.h +++ b/target/moxie/cpu.h @@ -53,12 +53,8 @@ typedef struct CPUMoxieState { typedef struct MoxieCPU MoxieCPU; typedef struct MoxieCPUClass MoxieCPUClass; -#define MOXIE_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(MoxieCPUClass, (klass), TYPE_MOXIE_CPU) -#define MOXIE_CPU(obj) \ - OBJECT_CHECK(MoxieCPU, (obj), TYPE_MOXIE_CPU) -#define MOXIE_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MoxieCPUClass, (obj), TYPE_MOXIE_CPU) +DECLARE_OBJ_CHECKERS(MoxieCPU, MoxieCPUClass, + MOXIE_CPU, TYPE_MOXIE_CPU) /** * MoxieCPUClass: diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index 7162cbdf5c..0b91a3634b 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -34,12 +34,8 @@ typedef struct CPUNios2State CPUNios2State; typedef struct Nios2CPU Nios2CPU; typedef struct Nios2CPUClass Nios2CPUClass; -#define NIOS2_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(Nios2CPUClass, (klass), TYPE_NIOS2_CPU) -#define NIOS2_CPU(obj) \ - OBJECT_CHECK(Nios2CPU, (obj), TYPE_NIOS2_CPU) -#define NIOS2_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(Nios2CPUClass, (obj), TYPE_NIOS2_CPU) +DECLARE_OBJ_CHECKERS(Nios2CPU, Nios2CPUClass, + NIOS2_CPU, TYPE_NIOS2_CPU) /** * Nios2CPUClass: diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index ab0dd55358..5e6d8a40d6 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -31,12 +31,8 @@ struct OpenRISCCPU; typedef struct OpenRISCCPU OpenRISCCPU; typedef struct OpenRISCCPUClass OpenRISCCPUClass; -#define OPENRISC_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(OpenRISCCPUClass, (klass), TYPE_OPENRISC_CPU) -#define OPENRISC_CPU(obj) \ - OBJECT_CHECK(OpenRISCCPU, (obj), TYPE_OPENRISC_CPU) -#define OPENRISC_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(OpenRISCCPUClass, (obj), TYPE_OPENRISC_CPU) +DECLARE_OBJ_CHECKERS(OpenRISCCPU, OpenRISCCPUClass, + OPENRISC_CPU, TYPE_OPENRISC_CPU) /** * OpenRISCCPUClass: diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h index 017f0efc7b..f7e600c7b3 100644 --- a/target/ppc/cpu-qom.h +++ b/target/ppc/cpu-qom.h @@ -31,12 +31,8 @@ typedef struct PowerPCCPU PowerPCCPU; typedef struct PowerPCCPUClass PowerPCCPUClass; -#define POWERPC_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(PowerPCCPUClass, (klass), TYPE_POWERPC_CPU) -#define POWERPC_CPU(obj) \ - OBJECT_CHECK(PowerPCCPU, (obj), TYPE_POWERPC_CPU) -#define POWERPC_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PowerPCCPUClass, (obj), TYPE_POWERPC_CPU) +DECLARE_OBJ_CHECKERS(PowerPCCPU, PowerPCCPUClass, + POWERPC_CPU, TYPE_POWERPC_CPU) typedef struct CPUPPCState CPUPPCState; typedef struct ppc_tb_t ppc_tb_t; diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 1a712ba3dd..8c1d593473 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1222,14 +1222,8 @@ struct PPCVirtualHypervisorClass { }; #define TYPE_PPC_VIRTUAL_HYPERVISOR "ppc-virtual-hypervisor" -#define PPC_VIRTUAL_HYPERVISOR(obj) \ - OBJECT_CHECK(PPCVirtualHypervisor, (obj), TYPE_PPC_VIRTUAL_HYPERVISOR) -#define PPC_VIRTUAL_HYPERVISOR_CLASS(klass) \ - OBJECT_CLASS_CHECK(PPCVirtualHypervisorClass, (klass), \ - TYPE_PPC_VIRTUAL_HYPERVISOR) -#define PPC_VIRTUAL_HYPERVISOR_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PPCVirtualHypervisorClass, (obj), \ - TYPE_PPC_VIRTUAL_HYPERVISOR) +DECLARE_OBJ_CHECKERS(PPCVirtualHypervisor, PPCVirtualHypervisorClass, + PPC_VIRTUAL_HYPERVISOR, TYPE_PPC_VIRTUAL_HYPERVISOR) #endif /* CONFIG_USER_ONLY */ void ppc_cpu_do_interrupt(CPUState *cpu); diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 7e4dde2547..07807a8f20 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -234,12 +234,8 @@ struct CPURISCVState { typedef struct RISCVCPU RISCVCPU; typedef struct RISCVCPUClass RISCVCPUClass; -#define RISCV_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(RISCVCPUClass, (klass), TYPE_RISCV_CPU) -#define RISCV_CPU(obj) \ - OBJECT_CHECK(RISCVCPU, (obj), TYPE_RISCV_CPU) -#define RISCV_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(RISCVCPUClass, (obj), TYPE_RISCV_CPU) +DECLARE_OBJ_CHECKERS(RISCVCPU, RISCVCPUClass, + RISCV_CPU, TYPE_RISCV_CPU) /** * RISCVCPUClass: diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h index 13f1f2659e..5f0dccdac1 100644 --- a/target/s390x/cpu-qom.h +++ b/target/s390x/cpu-qom.h @@ -27,12 +27,8 @@ typedef struct S390CPU S390CPU; typedef struct S390CPUClass S390CPUClass; -#define S390_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(S390CPUClass, (klass), TYPE_S390_CPU) -#define S390_CPU(obj) \ - OBJECT_CHECK(S390CPU, (obj), TYPE_S390_CPU) -#define S390_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(S390CPUClass, (obj), TYPE_S390_CPU) +DECLARE_OBJ_CHECKERS(S390CPU, S390CPUClass, + S390_CPU, TYPE_S390_CPU) typedef struct S390CPUModel S390CPUModel; typedef struct S390CPUDef S390CPUDef; diff --git a/target/sh4/cpu-qom.h b/target/sh4/cpu-qom.h index bf71c0f8e5..b04b2bb4bf 100644 --- a/target/sh4/cpu-qom.h +++ b/target/sh4/cpu-qom.h @@ -31,12 +31,8 @@ typedef struct SuperHCPU SuperHCPU; typedef struct SuperHCPUClass SuperHCPUClass; -#define SUPERH_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(SuperHCPUClass, (klass), TYPE_SUPERH_CPU) -#define SUPERH_CPU(obj) \ - OBJECT_CHECK(SuperHCPU, (obj), TYPE_SUPERH_CPU) -#define SUPERH_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SuperHCPUClass, (obj), TYPE_SUPERH_CPU) +DECLARE_OBJ_CHECKERS(SuperHCPU, SuperHCPUClass, + SUPERH_CPU, TYPE_SUPERH_CPU) /** * SuperHCPUClass: diff --git a/target/sparc/cpu-qom.h b/target/sparc/cpu-qom.h index b7cc81e5f3..42cb631d45 100644 --- a/target/sparc/cpu-qom.h +++ b/target/sparc/cpu-qom.h @@ -31,12 +31,8 @@ typedef struct SPARCCPU SPARCCPU; typedef struct SPARCCPUClass SPARCCPUClass; -#define SPARC_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(SPARCCPUClass, (klass), TYPE_SPARC_CPU) -#define SPARC_CPU(obj) \ - OBJECT_CHECK(SPARCCPU, (obj), TYPE_SPARC_CPU) -#define SPARC_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SPARCCPUClass, (obj), TYPE_SPARC_CPU) +DECLARE_OBJ_CHECKERS(SPARCCPU, SPARCCPUClass, + SPARC_CPU, TYPE_SPARC_CPU) typedef struct sparc_def_t sparc_def_t; /** diff --git a/target/tilegx/cpu.h b/target/tilegx/cpu.h index d6cc1d2982..d4cf70dc15 100644 --- a/target/tilegx/cpu.h +++ b/target/tilegx/cpu.h @@ -101,12 +101,8 @@ typedef struct CPUTLGState { typedef struct TileGXCPU TileGXCPU; typedef struct TileGXCPUClass TileGXCPUClass; -#define TILEGX_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(TileGXCPUClass, (klass), TYPE_TILEGX_CPU) -#define TILEGX_CPU(obj) \ - OBJECT_CHECK(TileGXCPU, (obj), TYPE_TILEGX_CPU) -#define TILEGX_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(TileGXCPUClass, (obj), TYPE_TILEGX_CPU) +DECLARE_OBJ_CHECKERS(TileGXCPU, TileGXCPUClass, + TILEGX_CPU, TYPE_TILEGX_CPU) /** * TileGXCPUClass: diff --git a/target/tricore/cpu-qom.h b/target/tricore/cpu-qom.h index cef466da74..1988c26093 100644 --- a/target/tricore/cpu-qom.h +++ b/target/tricore/cpu-qom.h @@ -26,12 +26,8 @@ typedef struct TriCoreCPU TriCoreCPU; typedef struct TriCoreCPUClass TriCoreCPUClass; -#define TRICORE_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(TriCoreCPUClass, (klass), TYPE_TRICORE_CPU) -#define TRICORE_CPU(obj) \ - OBJECT_CHECK(TriCoreCPU, (obj), TYPE_TRICORE_CPU) -#define TRICORE_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(TriCoreCPUClass, (obj), TYPE_TRICORE_CPU) +DECLARE_OBJ_CHECKERS(TriCoreCPU, TriCoreCPUClass, + TRICORE_CPU, TYPE_TRICORE_CPU) struct TriCoreCPUClass { /*< private >*/ diff --git a/target/unicore32/cpu-qom.h b/target/unicore32/cpu-qom.h index 6a1cb1c82d..5b67ac532d 100644 --- a/target/unicore32/cpu-qom.h +++ b/target/unicore32/cpu-qom.h @@ -18,12 +18,8 @@ typedef struct UniCore32CPU UniCore32CPU; typedef struct UniCore32CPUClass UniCore32CPUClass; -#define UNICORE32_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(UniCore32CPUClass, (klass), TYPE_UNICORE32_CPU) -#define UNICORE32_CPU(obj) \ - OBJECT_CHECK(UniCore32CPU, (obj), TYPE_UNICORE32_CPU) -#define UNICORE32_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(UniCore32CPUClass, (obj), TYPE_UNICORE32_CPU) +DECLARE_OBJ_CHECKERS(UniCore32CPU, UniCore32CPUClass, + UNICORE32_CPU, TYPE_UNICORE32_CPU) /** * UniCore32CPUClass: diff --git a/target/xtensa/cpu-qom.h b/target/xtensa/cpu-qom.h index cd9f31dc84..ef13262b42 100644 --- a/target/xtensa/cpu-qom.h +++ b/target/xtensa/cpu-qom.h @@ -36,12 +36,8 @@ typedef struct XtensaCPU XtensaCPU; typedef struct XtensaCPUClass XtensaCPUClass; -#define XTENSA_CPU_CLASS(class) \ - OBJECT_CLASS_CHECK(XtensaCPUClass, (class), TYPE_XTENSA_CPU) -#define XTENSA_CPU(obj) \ - OBJECT_CHECK(XtensaCPU, (obj), TYPE_XTENSA_CPU) -#define XTENSA_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(XtensaCPUClass, (obj), TYPE_XTENSA_CPU) +DECLARE_OBJ_CHECKERS(XtensaCPU, XtensaCPUClass, + XTENSA_CPU, TYPE_XTENSA_CPU) typedef struct XtensaConfig XtensaConfig; diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 39de5eab4b..a385767954 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -46,8 +46,8 @@ typedef struct TCGState TCGState; #define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg") -#define TCG_STATE(obj) \ - OBJECT_CHECK(TCGState, (obj), TYPE_TCG_ACCEL) +DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE, + TYPE_TCG_ACCEL) /* mask must never be zero, except for A20 change call */ static void tcg_handle_interrupt(CPUState *cpu, int mask) diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index 235c0c2572..966779398b 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -37,9 +37,8 @@ typedef struct CryptoDevBackendBuiltin CryptoDevBackendBuiltin; -#define CRYPTODEV_BACKEND_BUILTIN(obj) \ - OBJECT_CHECK(CryptoDevBackendBuiltin, \ - (obj), TYPE_CRYPTODEV_BACKEND_BUILTIN) +DECLARE_INSTANCE_CHECKER(CryptoDevBackendBuiltin, CRYPTODEV_BACKEND_BUILTIN, + TYPE_CRYPTODEV_BACKEND_BUILTIN) typedef struct CryptoDevBackendBuiltinSession { diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c index ae7745cd22..755cff3b7d 100644 --- a/backends/cryptodev-vhost-user.c +++ b/backends/cryptodev-vhost-user.c @@ -40,9 +40,8 @@ #define TYPE_CRYPTODEV_BACKEND_VHOST_USER "cryptodev-vhost-user" typedef struct CryptoDevBackendVhostUser CryptoDevBackendVhostUser; -#define CRYPTODEV_BACKEND_VHOST_USER(obj) \ - OBJECT_CHECK(CryptoDevBackendVhostUser, \ - (obj), TYPE_CRYPTODEV_BACKEND_VHOST_USER) +DECLARE_INSTANCE_CHECKER(CryptoDevBackendVhostUser, CRYPTODEV_BACKEND_VHOST_USER, + TYPE_CRYPTODEV_BACKEND_VHOST_USER) struct CryptoDevBackendVhostUser { diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c index 6a92a0f986..790bc9d728 100644 --- a/backends/dbus-vmstate.c +++ b/backends/dbus-vmstate.c @@ -25,12 +25,8 @@ typedef struct DBusVMState DBusVMState; typedef struct DBusVMStateClass DBusVMStateClass; #define TYPE_DBUS_VMSTATE "dbus-vmstate" -#define DBUS_VMSTATE(obj) \ - OBJECT_CHECK(DBusVMState, (obj), TYPE_DBUS_VMSTATE) -#define DBUS_VMSTATE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(DBusVMStateClass, (obj), TYPE_DBUS_VMSTATE) -#define DBUS_VMSTATE_CLASS(klass) \ - OBJECT_CLASS_CHECK(DBusVMStateClass, (klass), TYPE_DBUS_VMSTATE) +DECLARE_OBJ_CHECKERS(DBusVMState, DBusVMStateClass, + DBUS_VMSTATE, TYPE_DBUS_VMSTATE) struct DBusVMStateClass { ObjectClass parent_class; diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index d4be9ac096..569aeebcda 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -20,8 +20,8 @@ #include "qom/object.h" typedef struct HostMemoryBackendFile HostMemoryBackendFile; -#define MEMORY_BACKEND_FILE(obj) \ - OBJECT_CHECK(HostMemoryBackendFile, (obj), TYPE_MEMORY_BACKEND_FILE) +DECLARE_INSTANCE_CHECKER(HostMemoryBackendFile, MEMORY_BACKEND_FILE, + TYPE_MEMORY_BACKEND_FILE) struct HostMemoryBackendFile { diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index a62e3f2784..ae000ee4e8 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -22,8 +22,8 @@ #define TYPE_MEMORY_BACKEND_MEMFD "memory-backend-memfd" typedef struct HostMemoryBackendMemfd HostMemoryBackendMemfd; -#define MEMORY_BACKEND_MEMFD(obj) \ - OBJECT_CHECK(HostMemoryBackendMemfd, (obj), TYPE_MEMORY_BACKEND_MEMFD) +DECLARE_INSTANCE_CHECKER(HostMemoryBackendMemfd, MEMORY_BACKEND_MEMFD, + TYPE_MEMORY_BACKEND_MEMFD) struct HostMemoryBackendMemfd { diff --git a/backends/rng-builtin.c b/backends/rng-builtin.c index 5e4d0a7292..b0aee973ae 100644 --- a/backends/rng-builtin.c +++ b/backends/rng-builtin.c @@ -12,7 +12,8 @@ #include "qom/object.h" typedef struct RngBuiltin RngBuiltin; -#define RNG_BUILTIN(obj) OBJECT_CHECK(RngBuiltin, (obj), TYPE_RNG_BUILTIN) +DECLARE_INSTANCE_CHECKER(RngBuiltin, RNG_BUILTIN, + TYPE_RNG_BUILTIN) struct RngBuiltin { RngBackend parent; diff --git a/backends/rng-egd.c b/backends/rng-egd.c index c01ec5ee71..a975a8084f 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -20,7 +20,8 @@ #define TYPE_RNG_EGD "rng-egd" typedef struct RngEgd RngEgd; -#define RNG_EGD(obj) OBJECT_CHECK(RngEgd, (obj), TYPE_RNG_EGD) +DECLARE_INSTANCE_CHECKER(RngEgd, RNG_EGD, + TYPE_RNG_EGD) struct RngEgd { RngBackend parent; diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c index 50e455f6fd..9d48c5a788 100644 --- a/backends/tpm/tpm_emulator.c +++ b/backends/tpm/tpm_emulator.c @@ -46,8 +46,8 @@ #define TYPE_TPM_EMULATOR "tpm-emulator" typedef struct TPMEmulator TPMEmulator; -#define TPM_EMULATOR(obj) \ - OBJECT_CHECK(TPMEmulator, (obj), TYPE_TPM_EMULATOR) +DECLARE_INSTANCE_CHECKER(TPMEmulator, TPM_EMULATOR, + TYPE_TPM_EMULATOR) #define TPM_EMULATOR_IMPLEMENTS_ALL_CAPS(S, cap) (((S)->caps & (cap)) == (cap)) diff --git a/backends/tpm/tpm_passthrough.c b/backends/tpm/tpm_passthrough.c index a82c4f324c..3473ce308c 100644 --- a/backends/tpm/tpm_passthrough.c +++ b/backends/tpm/tpm_passthrough.c @@ -37,8 +37,8 @@ #define TYPE_TPM_PASSTHROUGH "tpm-passthrough" typedef struct TPMPassthruState TPMPassthruState; -#define TPM_PASSTHROUGH(obj) \ - OBJECT_CHECK(TPMPassthruState, (obj), TYPE_TPM_PASSTHROUGH) +DECLARE_INSTANCE_CHECKER(TPMPassthruState, TPM_PASSTHROUGH, + TYPE_TPM_PASSTHROUGH) /* data structures */ struct TPMPassthruState { diff --git a/chardev/baum.c b/chardev/baum.c index 1efc61d017..5ae273bfbe 100644 --- a/chardev/baum.c +++ b/chardev/baum.c @@ -105,7 +105,8 @@ struct BaumChardev { typedef struct BaumChardev BaumChardev; #define TYPE_CHARDEV_BRAILLE "chardev-braille" -#define BAUM_CHARDEV(obj) OBJECT_CHECK(BaumChardev, (obj), TYPE_CHARDEV_BRAILLE) +DECLARE_INSTANCE_CHECKER(BaumChardev, BAUM_CHARDEV, + TYPE_CHARDEV_BRAILLE) /* Let's assume NABCC by default */ enum way { diff --git a/chardev/char-parallel.c b/chardev/char-parallel.c index 78b29dd8c2..4439ee88d1 100644 --- a/chardev/char-parallel.c +++ b/chardev/char-parallel.c @@ -57,8 +57,8 @@ struct ParallelChardev { }; typedef struct ParallelChardev ParallelChardev; -#define PARALLEL_CHARDEV(obj) \ - OBJECT_CHECK(ParallelChardev, (obj), TYPE_CHARDEV_PARALLEL) +DECLARE_INSTANCE_CHECKER(ParallelChardev, PARALLEL_CHARDEV, + TYPE_CHARDEV_PARALLEL) static int pp_hw_mode(ParallelChardev *s, uint16_t mode) { @@ -185,8 +185,6 @@ struct ParallelChardev { }; typedef struct ParallelChardev ParallelChardev; -#define PARALLEL_CHARDEV(obj) \ - OBJECT_CHECK(ParallelChardev, (obj), TYPE_CHARDEV_PARALLEL) static int pp_ioctl(Chardev *chr, int cmd, void *arg) { diff --git a/chardev/char-pty.c b/chardev/char-pty.c index 5b3453091a..7d079cb3e1 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -45,7 +45,8 @@ struct PtyChardev { }; typedef struct PtyChardev PtyChardev; -#define PTY_CHARDEV(obj) OBJECT_CHECK(PtyChardev, (obj), TYPE_CHARDEV_PTY) +DECLARE_INSTANCE_CHECKER(PtyChardev, PTY_CHARDEV, + TYPE_CHARDEV_PTY) static void pty_chr_state(Chardev *chr, int connected); diff --git a/chardev/char-ringbuf.c b/chardev/char-ringbuf.c index e498b218ad..4750c3fca4 100644 --- a/chardev/char-ringbuf.c +++ b/chardev/char-ringbuf.c @@ -42,8 +42,8 @@ struct RingBufChardev { }; typedef struct RingBufChardev RingBufChardev; -#define RINGBUF_CHARDEV(obj) \ - OBJECT_CHECK(RingBufChardev, (obj), TYPE_CHARDEV_RINGBUF) +DECLARE_INSTANCE_CHECKER(RingBufChardev, RINGBUF_CHARDEV, + TYPE_CHARDEV_RINGBUF) static size_t ringbuf_count(const Chardev *chr) { diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 86f6c21bf6..204d65b092 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -88,8 +88,8 @@ struct SocketChardev { }; typedef struct SocketChardev SocketChardev; -#define SOCKET_CHARDEV(obj) \ - OBJECT_CHECK(SocketChardev, (obj), TYPE_CHARDEV_SOCKET) +DECLARE_INSTANCE_CHECKER(SocketChardev, SOCKET_CHARDEV, + TYPE_CHARDEV_SOCKET) static gboolean socket_reconnect_timeout(gpointer opaque); static void tcp_chr_telnet_init(Chardev *chr); diff --git a/chardev/char-udp.c b/chardev/char-udp.c index fa7bfe2cbd..b38fec4416 100644 --- a/chardev/char-udp.c +++ b/chardev/char-udp.c @@ -45,7 +45,8 @@ struct UdpChardev { }; typedef struct UdpChardev UdpChardev; -#define UDP_CHARDEV(obj) OBJECT_CHECK(UdpChardev, (obj), TYPE_CHARDEV_UDP) +DECLARE_INSTANCE_CHECKER(UdpChardev, UDP_CHARDEV, + TYPE_CHARDEV_UDP) /* Called with chr_write_lock held. */ static int udp_chr_write(Chardev *chr, const uint8_t *buf, int len) diff --git a/chardev/char-win-stdio.c b/chardev/char-win-stdio.c index bd4e2598c1..82e8457420 100644 --- a/chardev/char-win-stdio.c +++ b/chardev/char-win-stdio.c @@ -40,8 +40,8 @@ struct WinStdioChardev { }; typedef struct WinStdioChardev WinStdioChardev; -#define WIN_STDIO_CHARDEV(obj) \ - OBJECT_CHECK(WinStdioChardev, (obj), TYPE_CHARDEV_WIN_STDIO) +DECLARE_INSTANCE_CHECKER(WinStdioChardev, WIN_STDIO_CHARDEV, + TYPE_CHARDEV_WIN_STDIO) static void win_stdio_wait_func(void *opaque) { diff --git a/chardev/msmouse.c b/chardev/msmouse.c index a901e01d45..0228ea865c 100644 --- a/chardev/msmouse.c +++ b/chardev/msmouse.c @@ -45,8 +45,8 @@ struct MouseChardev { typedef struct MouseChardev MouseChardev; #define TYPE_CHARDEV_MSMOUSE "chardev-msmouse" -#define MOUSE_CHARDEV(obj) \ - OBJECT_CHECK(MouseChardev, (obj), TYPE_CHARDEV_MSMOUSE) +DECLARE_INSTANCE_CHECKER(MouseChardev, MOUSE_CHARDEV, + TYPE_CHARDEV_MSMOUSE) static void msmouse_chr_accept_input(Chardev *chr) { diff --git a/chardev/testdev.c b/chardev/testdev.c index ce1370cd70..d17eec8260 100644 --- a/chardev/testdev.c +++ b/chardev/testdev.c @@ -40,8 +40,8 @@ struct TestdevChardev { typedef struct TestdevChardev TestdevChardev; #define TYPE_CHARDEV_TESTDEV "chardev-testdev" -#define TESTDEV_CHARDEV(obj) \ - OBJECT_CHECK(TestdevChardev, (obj), TYPE_CHARDEV_TESTDEV) +DECLARE_INSTANCE_CHECKER(TestdevChardev, TESTDEV_CHARDEV, + TYPE_CHARDEV_TESTDEV) /* Try to interpret a whole incoming packet */ static int testdev_eat_packet(TestdevChardev *testdev) diff --git a/chardev/wctablet.c b/chardev/wctablet.c index 76f29a793f..82179dd7ad 100644 --- a/chardev/wctablet.c +++ b/chardev/wctablet.c @@ -86,8 +86,8 @@ struct TabletChardev { typedef struct TabletChardev TabletChardev; #define TYPE_CHARDEV_WCTABLET "chardev-wctablet" -#define WCTABLET_CHARDEV(obj) \ - OBJECT_CHECK(TabletChardev, (obj), TYPE_CHARDEV_WCTABLET) +DECLARE_INSTANCE_CHECKER(TabletChardev, WCTABLET_CHARDEV, + TYPE_CHARDEV_WCTABLET) static void wctablet_chr_accept_input(Chardev *chr); diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 4ab0f2b6ae..c7687e5fea 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -92,8 +92,8 @@ struct PIIX4PMState { }; typedef struct PIIX4PMState PIIX4PMState; -#define PIIX4_PM(obj) \ - OBJECT_CHECK(PIIX4PMState, (obj), TYPE_PIIX4_PM) +DECLARE_INSTANCE_CHECKER(PIIX4PMState, PIIX4_PM, + TYPE_PIIX4_PM) static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, PCIBus *bus, PIIX4PMState *s); diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index d60f02fcde..a74bbd882a 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -51,8 +51,8 @@ typedef struct TyphoonPchip { } TyphoonPchip; typedef struct TyphoonState TyphoonState; -#define TYPHOON_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(TyphoonState, (obj), TYPE_TYPHOON_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(TyphoonState, TYPHOON_PCI_HOST_BRIDGE, + TYPE_TYPHOON_PCI_HOST_BRIDGE) struct TyphoonState { PCIHostState parent_obj; diff --git a/hw/arm/collie.c b/hw/arm/collie.c index f2d8d3c529..80655cc839 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -28,8 +28,8 @@ struct CollieMachineState { typedef struct CollieMachineState CollieMachineState; #define TYPE_COLLIE_MACHINE MACHINE_TYPE_NAME("collie") -#define COLLIE_MACHINE(obj) \ - OBJECT_CHECK(CollieMachineState, obj, TYPE_COLLIE_MACHINE) +DECLARE_INSTANCE_CHECKER(CollieMachineState, COLLIE_MACHINE, + TYPE_COLLIE_MACHINE) static struct arm_boot_info collie_binfo = { .loader_start = SA_SDCS0, diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index fa7dc3875a..fcc6c8e7b4 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -157,8 +157,8 @@ static const MemoryRegionOps hb_mem_ops = { #define TYPE_HIGHBANK_REGISTERS "highbank-regs" typedef struct HighbankRegsState HighbankRegsState; -#define HIGHBANK_REGISTERS(obj) \ - OBJECT_CHECK(HighbankRegsState, (obj), TYPE_HIGHBANK_REGISTERS) +DECLARE_INSTANCE_CHECKER(HighbankRegsState, HIGHBANK_REGISTERS, + TYPE_HIGHBANK_REGISTERS) struct HighbankRegsState { /*< private >*/ diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 6d939f69a1..a678b1ed35 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -29,8 +29,8 @@ #define TYPE_INTEGRATOR_CM "integrator_core" typedef struct IntegratorCMState IntegratorCMState; -#define INTEGRATOR_CM(obj) \ - OBJECT_CHECK(IntegratorCMState, (obj), TYPE_INTEGRATOR_CM) +DECLARE_INSTANCE_CHECKER(IntegratorCMState, INTEGRATOR_CM, + TYPE_INTEGRATOR_CM) struct IntegratorCMState { /*< private >*/ @@ -328,8 +328,8 @@ static void integratorcm_realize(DeviceState *d, Error **errp) #define TYPE_INTEGRATOR_PIC "integrator_pic" typedef struct icp_pic_state icp_pic_state; -#define INTEGRATOR_PIC(obj) \ - OBJECT_CHECK(icp_pic_state, (obj), TYPE_INTEGRATOR_PIC) +DECLARE_INSTANCE_CHECKER(icp_pic_state, INTEGRATOR_PIC, + TYPE_INTEGRATOR_PIC) struct icp_pic_state { /*< private >*/ @@ -468,8 +468,8 @@ static void icp_pic_init(Object *obj) #define TYPE_ICP_CONTROL_REGS "icp-ctrl-regs" typedef struct ICPCtrlRegsState ICPCtrlRegsState; -#define ICP_CONTROL_REGS(obj) \ - OBJECT_CHECK(ICPCtrlRegsState, (obj), TYPE_ICP_CONTROL_REGS) +DECLARE_INSTANCE_CHECKER(ICPCtrlRegsState, ICP_CONTROL_REGS, + TYPE_ICP_CONTROL_REGS) struct ICPCtrlRegsState { /*< private >*/ diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c index a5b7319dcc..ec15e5d1fa 100644 --- a/hw/arm/microbit.c +++ b/hw/arm/microbit.c @@ -30,8 +30,8 @@ typedef struct MicrobitMachineState MicrobitMachineState; #define TYPE_MICROBIT_MACHINE MACHINE_TYPE_NAME("microbit") -#define MICROBIT_MACHINE(obj) \ - OBJECT_CHECK(MicrobitMachineState, obj, TYPE_MICROBIT_MACHINE) +DECLARE_INSTANCE_CHECKER(MicrobitMachineState, MICROBIT_MACHINE, + TYPE_MICROBIT_MACHINE) static void microbit_init(MachineState *machine) { diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 7c0efa6a9a..6d45b87f52 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -108,12 +108,8 @@ typedef struct MPS2TZMachineState MPS2TZMachineState; #define TYPE_MPS2TZ_AN505_MACHINE MACHINE_TYPE_NAME("mps2-an505") #define TYPE_MPS2TZ_AN521_MACHINE MACHINE_TYPE_NAME("mps2-an521") -#define MPS2TZ_MACHINE(obj) \ - OBJECT_CHECK(MPS2TZMachineState, obj, TYPE_MPS2TZ_MACHINE) -#define MPS2TZ_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MPS2TZMachineClass, obj, TYPE_MPS2TZ_MACHINE) -#define MPS2TZ_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(MPS2TZMachineClass, klass, TYPE_MPS2TZ_MACHINE) +DECLARE_OBJ_CHECKERS(MPS2TZMachineState, MPS2TZMachineClass, + MPS2TZ_MACHINE, TYPE_MPS2TZ_MACHINE) /* Main SYSCLK frequency in Hz */ #define SYSCLK_FRQ 20000000 diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index 45db6ec52f..e5032a9780 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -84,12 +84,8 @@ typedef struct MPS2MachineState MPS2MachineState; #define TYPE_MPS2_AN385_MACHINE MACHINE_TYPE_NAME("mps2-an385") #define TYPE_MPS2_AN511_MACHINE MACHINE_TYPE_NAME("mps2-an511") -#define MPS2_MACHINE(obj) \ - OBJECT_CHECK(MPS2MachineState, obj, TYPE_MPS2_MACHINE) -#define MPS2_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MPS2MachineClass, obj, TYPE_MPS2_MACHINE) -#define MPS2_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(MPS2MachineClass, klass, TYPE_MPS2_MACHINE) +DECLARE_OBJ_CHECKERS(MPS2MachineState, MPS2MachineClass, + MPS2_MACHINE, TYPE_MPS2_MACHINE) /* Main SYSCLK frequency in Hz */ #define SYSCLK_FRQ 25000000 diff --git a/hw/arm/musca.c b/hw/arm/musca.c index 9831f90820..2e337b8c73 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -90,12 +90,8 @@ typedef struct MuscaMachineState MuscaMachineState; #define TYPE_MUSCA_A_MACHINE MACHINE_TYPE_NAME("musca-a") #define TYPE_MUSCA_B1_MACHINE MACHINE_TYPE_NAME("musca-b1") -#define MUSCA_MACHINE(obj) \ - OBJECT_CHECK(MuscaMachineState, obj, TYPE_MUSCA_MACHINE) -#define MUSCA_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MuscaMachineClass, obj, TYPE_MUSCA_MACHINE) -#define MUSCA_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(MuscaMachineClass, klass, TYPE_MUSCA_MACHINE) +DECLARE_OBJ_CHECKERS(MuscaMachineState, MuscaMachineClass, + MUSCA_MACHINE, TYPE_MUSCA_MACHINE) /* * Main SYSCLK frequency in Hz diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 79d202aa50..8b545e857d 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -155,8 +155,8 @@ typedef struct mv88w8618_rx_desc { #define TYPE_MV88W8618_ETH "mv88w8618_eth" typedef struct mv88w8618_eth_state mv88w8618_eth_state; -#define MV88W8618_ETH(obj) \ - OBJECT_CHECK(mv88w8618_eth_state, (obj), TYPE_MV88W8618_ETH) +DECLARE_INSTANCE_CHECKER(mv88w8618_eth_state, MV88W8618_ETH, + TYPE_MV88W8618_ETH) struct mv88w8618_eth_state { /*< private >*/ @@ -472,8 +472,8 @@ TYPE_INFO(mv88w8618_eth_info) #define TYPE_MUSICPAL_LCD "musicpal_lcd" typedef struct musicpal_lcd_state musicpal_lcd_state; -#define MUSICPAL_LCD(obj) \ - OBJECT_CHECK(musicpal_lcd_state, (obj), TYPE_MUSICPAL_LCD) +DECLARE_INSTANCE_CHECKER(musicpal_lcd_state, MUSICPAL_LCD, + TYPE_MUSICPAL_LCD) struct musicpal_lcd_state { /*< private >*/ @@ -691,8 +691,8 @@ TYPE_INFO(musicpal_lcd_info) #define TYPE_MV88W8618_PIC "mv88w8618_pic" typedef struct mv88w8618_pic_state mv88w8618_pic_state; -#define MV88W8618_PIC(obj) \ - OBJECT_CHECK(mv88w8618_pic_state, (obj), TYPE_MV88W8618_PIC) +DECLARE_INSTANCE_CHECKER(mv88w8618_pic_state, MV88W8618_PIC, + TYPE_MV88W8618_PIC) struct mv88w8618_pic_state { /*< private >*/ @@ -830,8 +830,8 @@ typedef struct mv88w8618_timer_state { #define TYPE_MV88W8618_PIT "mv88w8618_pit" typedef struct mv88w8618_pit_state mv88w8618_pit_state; -#define MV88W8618_PIT(obj) \ - OBJECT_CHECK(mv88w8618_pit_state, (obj), TYPE_MV88W8618_PIT) +DECLARE_INSTANCE_CHECKER(mv88w8618_pit_state, MV88W8618_PIT, + TYPE_MV88W8618_PIT) struct mv88w8618_pit_state { /*< private >*/ @@ -999,8 +999,8 @@ TYPE_INFO(mv88w8618_pit_info) #define TYPE_MV88W8618_FLASHCFG "mv88w8618_flashcfg" typedef struct mv88w8618_flashcfg_state mv88w8618_flashcfg_state; -#define MV88W8618_FLASHCFG(obj) \ - OBJECT_CHECK(mv88w8618_flashcfg_state, (obj), TYPE_MV88W8618_FLASHCFG) +DECLARE_INSTANCE_CHECKER(mv88w8618_flashcfg_state, MV88W8618_FLASHCFG, + TYPE_MV88W8618_FLASHCFG) struct mv88w8618_flashcfg_state { /*< private >*/ @@ -1093,8 +1093,8 @@ struct MusicPalMiscState { typedef struct MusicPalMiscState MusicPalMiscState; #define TYPE_MUSICPAL_MISC "musicpal-misc" -#define MUSICPAL_MISC(obj) \ - OBJECT_CHECK(MusicPalMiscState, (obj), TYPE_MUSICPAL_MISC) +DECLARE_INSTANCE_CHECKER(MusicPalMiscState, MUSICPAL_MISC, + TYPE_MUSICPAL_MISC) static uint64_t musicpal_misc_read(void *opaque, hwaddr offset, unsigned size) @@ -1201,8 +1201,8 @@ static void mv88w8618_wlan_realize(DeviceState *dev, Error **errp) #define TYPE_MUSICPAL_GPIO "musicpal_gpio" typedef struct musicpal_gpio_state musicpal_gpio_state; -#define MUSICPAL_GPIO(obj) \ - OBJECT_CHECK(musicpal_gpio_state, (obj), TYPE_MUSICPAL_GPIO) +DECLARE_INSTANCE_CHECKER(musicpal_gpio_state, MUSICPAL_GPIO, + TYPE_MUSICPAL_GPIO) struct musicpal_gpio_state { /*< private >*/ @@ -1453,8 +1453,8 @@ TYPE_INFO(musicpal_gpio_info) #define TYPE_MUSICPAL_KEY "musicpal_key" typedef struct musicpal_key_state musicpal_key_state; -#define MUSICPAL_KEY(obj) \ - OBJECT_CHECK(musicpal_key_state, (obj), TYPE_MUSICPAL_KEY) +DECLARE_INSTANCE_CHECKER(musicpal_key_state, MUSICPAL_KEY, + TYPE_MUSICPAL_KEY) struct musicpal_key_state { /*< private >*/ diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 70fb1ef59b..d4ad610692 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -134,8 +134,8 @@ static void palmte_button_event(void *opaque, int keycode) #define TYPE_PALM_MISC_GPIO "palm-misc-gpio" typedef struct PalmMiscGPIOState PalmMiscGPIOState; -#define PALM_MISC_GPIO(obj) \ - OBJECT_CHECK(PalmMiscGPIOState, (obj), TYPE_PALM_MISC_GPIO) +DECLARE_INSTANCE_CHECKER(PalmMiscGPIOState, PALM_MISC_GPIO, + TYPE_PALM_MISC_GPIO) struct PalmMiscGPIOState { SysBusDevice parent_obj; diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 5b9c459d9f..1e01bfeaea 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -470,8 +470,8 @@ static const VMStateDescription vmstate_pxa2xx_mm = { #define TYPE_PXA2XX_SSP "pxa2xx-ssp" typedef struct PXA2xxSSPState PXA2xxSSPState; -#define PXA2XX_SSP(obj) \ - OBJECT_CHECK(PXA2xxSSPState, (obj), TYPE_PXA2XX_SSP) +DECLARE_INSTANCE_CHECKER(PXA2xxSSPState, PXA2XX_SSP, + TYPE_PXA2XX_SSP) /* Synchronous Serial Ports */ struct PXA2xxSSPState { @@ -811,8 +811,8 @@ static void pxa2xx_ssp_init(Object *obj) #define TYPE_PXA2XX_RTC "pxa2xx_rtc" typedef struct PXA2xxRTCState PXA2xxRTCState; -#define PXA2XX_RTC(obj) \ - OBJECT_CHECK(PXA2xxRTCState, (obj), TYPE_PXA2XX_RTC) +DECLARE_INSTANCE_CHECKER(PXA2xxRTCState, PXA2XX_RTC, + TYPE_PXA2XX_RTC) struct PXA2xxRTCState { /*< private >*/ @@ -1246,8 +1246,8 @@ TYPE_INFO(pxa2xx_rtc_sysbus_info) #define TYPE_PXA2XX_I2C_SLAVE "pxa2xx-i2c-slave" typedef struct PXA2xxI2CSlaveState PXA2xxI2CSlaveState; -#define PXA2XX_I2C_SLAVE(obj) \ - OBJECT_CHECK(PXA2xxI2CSlaveState, (obj), TYPE_PXA2XX_I2C_SLAVE) +DECLARE_INSTANCE_CHECKER(PXA2xxI2CSlaveState, PXA2XX_I2C_SLAVE, + TYPE_PXA2XX_I2C_SLAVE) struct PXA2xxI2CSlaveState { I2CSlave parent_obj; diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c index 817e7a1de5..7ccdcfe01d 100644 --- a/hw/arm/pxa2xx_gpio.c +++ b/hw/arm/pxa2xx_gpio.c @@ -23,8 +23,8 @@ #define TYPE_PXA2XX_GPIO "pxa2xx-gpio" typedef struct PXA2xxGPIOInfo PXA2xxGPIOInfo; -#define PXA2XX_GPIO(obj) \ - OBJECT_CHECK(PXA2xxGPIOInfo, (obj), TYPE_PXA2XX_GPIO) +DECLARE_INSTANCE_CHECKER(PXA2xxGPIOInfo, PXA2XX_GPIO, + TYPE_PXA2XX_GPIO) struct PXA2xxGPIOInfo { /*< private >*/ diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 34b13f470f..94cb2527c9 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -39,8 +39,8 @@ #define TYPE_PXA2XX_PIC "pxa2xx_pic" typedef struct PXA2xxPICState PXA2xxPICState; -#define PXA2XX_PIC(obj) \ - OBJECT_CHECK(PXA2xxPICState, (obj), TYPE_PXA2XX_PIC) +DECLARE_INSTANCE_CHECKER(PXA2xxPICState, PXA2XX_PIC, + TYPE_PXA2XX_PIC) struct PXA2xxPICState { /*< private >*/ diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index d9f7eeb06b..d2f674587d 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -53,13 +53,9 @@ struct RaspiMachineClass { typedef struct RaspiMachineClass RaspiMachineClass; #define TYPE_RASPI_MACHINE MACHINE_TYPE_NAME("raspi-common") -#define RASPI_MACHINE(obj) \ - OBJECT_CHECK(RaspiMachineState, (obj), TYPE_RASPI_MACHINE) +DECLARE_OBJ_CHECKERS(RaspiMachineState, RaspiMachineClass, + RASPI_MACHINE, TYPE_RASPI_MACHINE) -#define RASPI_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(RaspiMachineClass, (klass), TYPE_RASPI_MACHINE) -#define RASPI_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(RaspiMachineClass, (obj), TYPE_RASPI_MACHINE) /* * Board revision codes: diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 3f01ad40d2..7c194931f3 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -97,8 +97,8 @@ struct SBSAMachineState { typedef struct SBSAMachineState SBSAMachineState; #define TYPE_SBSA_MACHINE MACHINE_TYPE_NAME("sbsa-ref") -#define SBSA_MACHINE(obj) \ - OBJECT_CHECK(SBSAMachineState, (obj), TYPE_SBSA_MACHINE) +DECLARE_INSTANCE_CHECKER(SBSAMachineState, SBSA_MACHINE, + TYPE_SBSA_MACHINE) static const MemMapEntry sbsa_ref_memmap[] = { /* 512M boot ROM */ diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index ecbe69dd04..72e7b75e2f 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -59,12 +59,8 @@ struct SpitzMachineState { typedef struct SpitzMachineState SpitzMachineState; #define TYPE_SPITZ_MACHINE "spitz-common" -#define SPITZ_MACHINE(obj) \ - OBJECT_CHECK(SpitzMachineState, obj, TYPE_SPITZ_MACHINE) -#define SPITZ_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpitzMachineClass, obj, TYPE_SPITZ_MACHINE) -#define SPITZ_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpitzMachineClass, klass, TYPE_SPITZ_MACHINE) +DECLARE_OBJ_CHECKERS(SpitzMachineState, SpitzMachineClass, + SPITZ_MACHINE, TYPE_SPITZ_MACHINE) #define zaurus_printf(format, ...) \ fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__) @@ -89,7 +85,8 @@ typedef struct SpitzMachineState SpitzMachineState; #define TYPE_SL_NAND "sl-nand" typedef struct SLNANDState SLNANDState; -#define SL_NAND(obj) OBJECT_CHECK(SLNANDState, (obj), TYPE_SL_NAND) +DECLARE_INSTANCE_CHECKER(SLNANDState, SL_NAND, + TYPE_SL_NAND) struct SLNANDState { SysBusDevice parent_obj; @@ -266,8 +263,8 @@ static const int spitz_gpiomap[5] = { #define TYPE_SPITZ_KEYBOARD "spitz-keyboard" typedef struct SpitzKeyboardState SpitzKeyboardState; -#define SPITZ_KEYBOARD(obj) \ - OBJECT_CHECK(SpitzKeyboardState, (obj), TYPE_SPITZ_KEYBOARD) +DECLARE_INSTANCE_CHECKER(SpitzKeyboardState, SPITZ_KEYBOARD, + TYPE_SPITZ_KEYBOARD) struct SpitzKeyboardState { SysBusDevice parent_obj; @@ -586,7 +583,8 @@ static void spitz_keyboard_realize(DeviceState *dev, Error **errp) #define TYPE_SPITZ_LCDTG "spitz-lcdtg" typedef struct SpitzLCDTG SpitzLCDTG; -#define SPITZ_LCDTG(obj) OBJECT_CHECK(SpitzLCDTG, (obj), TYPE_SPITZ_LCDTG) +DECLARE_INSTANCE_CHECKER(SpitzLCDTG, SPITZ_LCDTG, + TYPE_SPITZ_LCDTG) struct SpitzLCDTG { SSISlave ssidev; @@ -675,7 +673,8 @@ static void spitz_lcdtg_realize(SSISlave *ssi, Error **errp) #define TYPE_CORGI_SSP "corgi-ssp" typedef struct CorgiSSPState CorgiSSPState; -#define CORGI_SSP(obj) OBJECT_CHECK(CorgiSSPState, (obj), TYPE_CORGI_SSP) +DECLARE_INSTANCE_CHECKER(CorgiSSPState, CORGI_SSP, + TYPE_CORGI_SSP) /* "Demux" the signal based on current chipselect */ struct CorgiSSPState { @@ -827,8 +826,8 @@ static void spitz_akita_i2c_setup(PXA2xxState *cpu) */ #define TYPE_SPITZ_MISC_GPIO "spitz-misc-gpio" typedef struct SpitzMiscGPIOState SpitzMiscGPIOState; -#define SPITZ_MISC_GPIO(obj) \ - OBJECT_CHECK(SpitzMiscGPIOState, (obj), TYPE_SPITZ_MISC_GPIO) +DECLARE_INSTANCE_CHECKER(SpitzMiscGPIOState, SPITZ_MISC_GPIO, + TYPE_SPITZ_MISC_GPIO) struct SpitzMiscGPIOState { SysBusDevice parent_obj; diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index b52eb69aac..e2f04b0091 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -59,8 +59,8 @@ typedef const struct { #define TYPE_STELLARIS_GPTM "stellaris-gptm" typedef struct gptm_state gptm_state; -#define STELLARIS_GPTM(obj) \ - OBJECT_CHECK(gptm_state, (obj), TYPE_STELLARIS_GPTM) +DECLARE_INSTANCE_CHECKER(gptm_state, STELLARIS_GPTM, + TYPE_STELLARIS_GPTM) struct gptm_state { SysBusDevice parent_obj; @@ -722,8 +722,8 @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq, #define TYPE_STELLARIS_I2C "stellaris-i2c" typedef struct stellaris_i2c_state stellaris_i2c_state; -#define STELLARIS_I2C(obj) \ - OBJECT_CHECK(stellaris_i2c_state, (obj), TYPE_STELLARIS_I2C) +DECLARE_INSTANCE_CHECKER(stellaris_i2c_state, STELLARIS_I2C, + TYPE_STELLARIS_I2C) struct stellaris_i2c_state { SysBusDevice parent_obj; @@ -936,8 +936,8 @@ static void stellaris_i2c_init(Object *obj) #define TYPE_STELLARIS_ADC "stellaris-adc" typedef struct StellarisADCState stellaris_adc_state; -#define STELLARIS_ADC(obj) \ - OBJECT_CHECK(stellaris_adc_state, (obj), TYPE_STELLARIS_ADC) +DECLARE_INSTANCE_CHECKER(stellaris_adc_state, STELLARIS_ADC, + TYPE_STELLARIS_ADC) struct StellarisADCState { SysBusDevice parent_obj; diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 538eaccceb..99528e4e99 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -86,8 +86,8 @@ static struct { #define TYPE_STRONGARM_PIC "strongarm_pic" typedef struct StrongARMPICState StrongARMPICState; -#define STRONGARM_PIC(obj) \ - OBJECT_CHECK(StrongARMPICState, (obj), TYPE_STRONGARM_PIC) +DECLARE_INSTANCE_CHECKER(StrongARMPICState, STRONGARM_PIC, + TYPE_STRONGARM_PIC) struct StrongARMPICState { SysBusDevice parent_obj; @@ -256,8 +256,8 @@ TYPE_INFO(strongarm_pic_info) #define TYPE_STRONGARM_RTC "strongarm-rtc" typedef struct StrongARMRTCState StrongARMRTCState; -#define STRONGARM_RTC(obj) \ - OBJECT_CHECK(StrongARMRTCState, (obj), TYPE_STRONGARM_RTC) +DECLARE_INSTANCE_CHECKER(StrongARMRTCState, STRONGARM_RTC, + TYPE_STRONGARM_RTC) struct StrongARMRTCState { SysBusDevice parent_obj; @@ -484,8 +484,8 @@ TYPE_INFO(strongarm_rtc_sysbus_info) #define TYPE_STRONGARM_GPIO "strongarm-gpio" typedef struct StrongARMGPIOInfo StrongARMGPIOInfo; -#define STRONGARM_GPIO(obj) \ - OBJECT_CHECK(StrongARMGPIOInfo, (obj), TYPE_STRONGARM_GPIO) +DECLARE_INSTANCE_CHECKER(StrongARMGPIOInfo, STRONGARM_GPIO, + TYPE_STRONGARM_GPIO) struct StrongARMGPIOInfo { SysBusDevice busdev; @@ -724,8 +724,8 @@ TYPE_INFO(strongarm_gpio_info) #define TYPE_STRONGARM_PPC "strongarm-ppc" typedef struct StrongARMPPCInfo StrongARMPPCInfo; -#define STRONGARM_PPC(obj) \ - OBJECT_CHECK(StrongARMPPCInfo, (obj), TYPE_STRONGARM_PPC) +DECLARE_INSTANCE_CHECKER(StrongARMPPCInfo, STRONGARM_PPC, + TYPE_STRONGARM_PPC) struct StrongARMPPCInfo { SysBusDevice parent_obj; @@ -926,8 +926,8 @@ TYPE_INFO(strongarm_ppc_info) #define TYPE_STRONGARM_UART "strongarm-uart" typedef struct StrongARMUARTState StrongARMUARTState; -#define STRONGARM_UART(obj) \ - OBJECT_CHECK(StrongARMUARTState, (obj), TYPE_STRONGARM_UART) +DECLARE_INSTANCE_CHECKER(StrongARMUARTState, STRONGARM_UART, + TYPE_STRONGARM_UART) struct StrongARMUARTState { SysBusDevice parent_obj; @@ -1359,8 +1359,8 @@ TYPE_INFO(strongarm_uart_info) #define TYPE_STRONGARM_SSP "strongarm-ssp" typedef struct StrongARMSSPState StrongARMSSPState; -#define STRONGARM_SSP(obj) \ - OBJECT_CHECK(StrongARMSSPState, (obj), TYPE_STRONGARM_SSP) +DECLARE_INSTANCE_CHECKER(StrongARMSSPState, STRONGARM_SSP, + TYPE_STRONGARM_SSP) struct StrongARMSSPState { SysBusDevice parent_obj; diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c index da48f4ddcd..ee3e868743 100644 --- a/hw/arm/tosa.c +++ b/hw/arm/tosa.c @@ -76,8 +76,8 @@ static void tosa_microdrive_attach(PXA2xxState *cpu) #define TYPE_TOSA_MISC_GPIO "tosa-misc-gpio" typedef struct TosaMiscGPIOState TosaMiscGPIOState; -#define TOSA_MISC_GPIO(obj) \ - OBJECT_CHECK(TosaMiscGPIOState, (obj), TYPE_TOSA_MISC_GPIO) +DECLARE_INSTANCE_CHECKER(TosaMiscGPIOState, TOSA_MISC_GPIO, + TYPE_TOSA_MISC_GPIO) struct TosaMiscGPIOState { SysBusDevice parent_obj; @@ -173,7 +173,8 @@ static void tosa_ssp_realize(SSISlave *dev, Error **errp) #define TYPE_TOSA_DAC "tosa_dac" typedef struct TosaDACState TosaDACState; -#define TOSA_DAC(obj) OBJECT_CHECK(TosaDACState, (obj), TYPE_TOSA_DAC) +DECLARE_INSTANCE_CHECKER(TosaDACState, TOSA_DAC, + TYPE_TOSA_DAC) struct TosaDACState { I2CSlave parent_obj; diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 2cf8a92692..804225711c 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -35,8 +35,8 @@ #define TYPE_VERSATILE_PB_SIC "versatilepb_sic" typedef struct vpb_sic_state vpb_sic_state; -#define VERSATILE_PB_SIC(obj) \ - OBJECT_CHECK(vpb_sic_state, (obj), TYPE_VERSATILE_PB_SIC) +DECLARE_INSTANCE_CHECKER(vpb_sic_state, VERSATILE_PB_SIC, + TYPE_VERSATILE_PB_SIC) struct vpb_sic_state { SysBusDevice parent_obj; diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index a85fa73f80..9404158cc3 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -182,12 +182,8 @@ typedef struct VexpressMachineState VexpressMachineState; #define TYPE_VEXPRESS_MACHINE "vexpress" #define TYPE_VEXPRESS_A9_MACHINE MACHINE_TYPE_NAME("vexpress-a9") #define TYPE_VEXPRESS_A15_MACHINE MACHINE_TYPE_NAME("vexpress-a15") -#define VEXPRESS_MACHINE(obj) \ - OBJECT_CHECK(VexpressMachineState, (obj), TYPE_VEXPRESS_MACHINE) -#define VEXPRESS_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VexpressMachineClass, obj, TYPE_VEXPRESS_MACHINE) -#define VEXPRESS_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VexpressMachineClass, klass, TYPE_VEXPRESS_MACHINE) +DECLARE_OBJ_CHECKERS(VexpressMachineState, VexpressMachineClass, + VEXPRESS_MACHINE, TYPE_VEXPRESS_MACHINE) typedef void DBoardInitFn(const VexpressMachineState *machine, ram_addr_t ram_size, diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index ef6b4c8a24..3e6e3de826 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -41,8 +41,8 @@ #define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") typedef struct ZynqMachineState ZynqMachineState; -#define ZYNQ_MACHINE(obj) \ - OBJECT_CHECK(ZynqMachineState, (obj), TYPE_ZYNQ_MACHINE) +DECLARE_INSTANCE_CHECKER(ZynqMachineState, ZYNQ_MACHINE, + TYPE_ZYNQ_MACHINE) /* board base frequency: 33.333333 MHz */ #define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3) diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 505960d836..aee9412d2e 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -26,8 +26,8 @@ #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt") typedef struct VersalVirt VersalVirt; -#define XLNX_VERSAL_VIRT_MACHINE(obj) \ - OBJECT_CHECK(VersalVirt, (obj), TYPE_XLNX_VERSAL_VIRT_MACHINE) +DECLARE_INSTANCE_CHECKER(VersalVirt, XLNX_VERSAL_VIRT_MACHINE, + TYPE_XLNX_VERSAL_VIRT_MACHINE) struct VersalVirt { MachineState parent_obj; diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 3e32c57274..4d9fdca13c 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -39,8 +39,8 @@ struct XlnxZCU102 { typedef struct XlnxZCU102 XlnxZCU102; #define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102") -#define ZCU102_MACHINE(obj) \ - OBJECT_CHECK(XlnxZCU102, (obj), TYPE_ZCU102_MACHINE) +DECLARE_INSTANCE_CHECKER(XlnxZCU102, ZCU102_MACHINE, + TYPE_ZCU102_MACHINE) static bool zcu102_get_secure(Object *obj, Error **errp) diff --git a/hw/arm/z2.c b/hw/arm/z2.c index 9c69481269..72ecb6df29 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -114,7 +114,8 @@ struct ZipitLCD { typedef struct ZipitLCD ZipitLCD; #define TYPE_ZIPIT_LCD "zipit-lcd" -#define ZIPIT_LCD(obj) OBJECT_CHECK(ZipitLCD, (obj), TYPE_ZIPIT_LCD) +DECLARE_INSTANCE_CHECKER(ZipitLCD, ZIPIT_LCD, + TYPE_ZIPIT_LCD) static uint32_t zipit_lcd_transfer(SSISlave *dev, uint32_t value) { @@ -198,7 +199,8 @@ static const TypeInfo zipit_lcd_info = { #define TYPE_AER915 "aer915" typedef struct AER915State AER915State; -#define AER915(obj) OBJECT_CHECK(AER915State, (obj), TYPE_AER915) +DECLARE_INSTANCE_CHECKER(AER915State, AER915, + TYPE_AER915) struct AER915State { I2CSlave parent_obj; diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index 9614419b7a..eb8a7f032d 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -128,8 +128,8 @@ enum { #define TYPE_AC97 "AC97" typedef struct AC97LinkState AC97LinkState; -#define AC97(obj) \ - OBJECT_CHECK(AC97LinkState, (obj), TYPE_AC97) +DECLARE_INSTANCE_CHECKER(AC97LinkState, AC97, + TYPE_AC97) #define REC_MASK 7 enum { diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index a216fe1925..870116e324 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -53,7 +53,8 @@ #define TYPE_ADLIB "adlib" typedef struct AdlibState AdlibState; -#define ADLIB(obj) OBJECT_CHECK(AdlibState, (obj), TYPE_ADLIB) +DECLARE_INSTANCE_CHECKER(AdlibState, ADLIB, + TYPE_ADLIB) struct AdlibState { ISADevice parent_obj; diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c index d645f9455f..e5acb33b3e 100644 --- a/hw/audio/cs4231.c +++ b/hw/audio/cs4231.c @@ -39,8 +39,8 @@ #define TYPE_CS4231 "SUNW,CS4231" typedef struct CSState CSState; -#define CS4231(obj) \ - OBJECT_CHECK(CSState, (obj), TYPE_CS4231) +DECLARE_INSTANCE_CHECKER(CSState, CS4231, + TYPE_CS4231) struct CSState { SysBusDevice parent_obj; diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index fc064a93d7..7d60ce6f0e 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -64,7 +64,8 @@ static struct { #define TYPE_CS4231A "cs4231a" typedef struct CSState CSState; -#define CS4231A(obj) OBJECT_CHECK (CSState, (obj), TYPE_CS4231A) +DECLARE_INSTANCE_CHECKER(CSState, CS4231A, + TYPE_CS4231A) struct CSState { ISADevice dev; diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index bd620d5ee2..a824f8949e 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -293,8 +293,8 @@ struct chan_bits { }; #define TYPE_ES1370 "ES1370" -#define ES1370(obj) \ - OBJECT_CHECK(ES1370State, (obj), TYPE_ES1370) +DECLARE_INSTANCE_CHECKER(ES1370State, ES1370, + TYPE_ES1370) static void es1370_dac1_calc_freq (ES1370State *s, uint32_t ctl, uint32_t *old_freq, uint32_t *new_freq); diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 3cd62d43d7..307fd48315 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -44,7 +44,8 @@ #define TYPE_GUS "gus" typedef struct GUSState GUSState; -#define GUS(obj) OBJECT_CHECK (GUSState, (obj), TYPE_GUS) +DECLARE_INSTANCE_CHECKER(GUSState, GUS, + TYPE_GUS) struct GUSState { ISADevice dev; diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index ce6ccee6a0..2377472728 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -172,7 +172,8 @@ struct HDAAudioStream { }; #define TYPE_HDA_AUDIO "hda-audio" -#define HDA_AUDIO(obj) OBJECT_CHECK(HDAAudioState, (obj), TYPE_HDA_AUDIO) +DECLARE_INSTANCE_CHECKER(HDAAudioState, HDA_AUDIO, + TYPE_HDA_AUDIO) struct HDAAudioState { HDACodecDevice hda; diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 4bce3ab8bf..5b09d5d820 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -205,8 +205,8 @@ struct IntelHDAState { #define TYPE_INTEL_HDA_GENERIC "intel-hda-generic" -#define INTEL_HDA(obj) \ - OBJECT_CHECK(IntelHDAState, (obj), TYPE_INTEL_HDA_GENERIC) +DECLARE_INSTANCE_CHECKER(IntelHDAState, INTEL_HDA, + TYPE_INTEL_HDA_GENERIC) struct IntelHDAReg { const char *name; /* register name */ diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c index 6c13075e99..2bbed0b50f 100644 --- a/hw/audio/marvell_88w8618.c +++ b/hw/audio/marvell_88w8618.c @@ -44,8 +44,8 @@ #define MP_AUDIO_MONO (1 << 14) typedef struct mv88w8618_audio_state mv88w8618_audio_state; -#define MV88W8618_AUDIO(obj) \ - OBJECT_CHECK(mv88w8618_audio_state, (obj), TYPE_MV88W8618_AUDIO) +DECLARE_INSTANCE_CHECKER(mv88w8618_audio_state, MV88W8618_AUDIO, + TYPE_MV88W8618_AUDIO) struct mv88w8618_audio_state { SysBusDevice parent_obj; diff --git a/hw/audio/milkymist-ac97.c b/hw/audio/milkymist-ac97.c index 94b17f10cc..6179f435f1 100644 --- a/hw/audio/milkymist-ac97.c +++ b/hw/audio/milkymist-ac97.c @@ -57,8 +57,8 @@ enum { #define TYPE_MILKYMIST_AC97 "milkymist-ac97" typedef struct MilkymistAC97State MilkymistAC97State; -#define MILKYMIST_AC97(obj) \ - OBJECT_CHECK(MilkymistAC97State, (obj), TYPE_MILKYMIST_AC97) +DECLARE_INSTANCE_CHECKER(MilkymistAC97State, MILKYMIST_AC97, + TYPE_MILKYMIST_AC97) struct MilkymistAC97State { SysBusDevice parent_obj; diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index 5467a6b69c..a00084d03c 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -41,7 +41,8 @@ #define PCSPK_MIN_COUNT DIV_ROUND_UP(PIT_FREQ, PCSPK_MAX_FREQ) typedef struct PCSpkState PCSpkState; -#define PC_SPEAKER(obj) OBJECT_CHECK(PCSpkState, (obj), TYPE_PC_SPEAKER) +DECLARE_INSTANCE_CHECKER(PCSpkState, PC_SPEAKER, + TYPE_PC_SPEAKER) struct PCSpkState { ISADevice parent_obj; diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c index b99c151cf9..65e5108b90 100644 --- a/hw/audio/pl041.c +++ b/hw/audio/pl041.c @@ -79,7 +79,8 @@ typedef struct { #define TYPE_PL041 "pl041" typedef struct PL041State PL041State; -#define PL041(obj) OBJECT_CHECK(PL041State, (obj), TYPE_PL041) +DECLARE_INSTANCE_CHECKER(PL041State, PL041, + TYPE_PL041) struct PL041State { SysBusDevice parent_obj; diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 840f743e41..6aa2c0fb93 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -51,7 +51,8 @@ static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992."; #define TYPE_SB16 "sb16" typedef struct SB16State SB16State; -#define SB16(obj) OBJECT_CHECK (SB16State, (obj), TYPE_SB16) +DECLARE_INSTANCE_CHECKER(SB16State, SB16, + TYPE_SB16) struct SB16State { ISADevice parent_obj; diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index c2396fc206..16c8699cc9 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -28,7 +28,8 @@ typedef struct { } WMRate; typedef struct WM8750State WM8750State; -#define WM8750(obj) OBJECT_CHECK(WM8750State, (obj), TYPE_WM8750) +DECLARE_INSTANCE_CHECKER(WM8750State, WM8750, + TYPE_WM8750) struct WM8750State { I2CSlave parent_obj; diff --git a/hw/avr/arduino.c b/hw/avr/arduino.c index c24183c07f..3c8388490d 100644 --- a/hw/avr/arduino.c +++ b/hw/avr/arduino.c @@ -36,12 +36,8 @@ typedef struct ArduinoMachineClass ArduinoMachineClass; #define TYPE_ARDUINO_MACHINE \ MACHINE_TYPE_NAME("arduino") -#define ARDUINO_MACHINE(obj) \ - OBJECT_CHECK(ArduinoMachineState, (obj), TYPE_ARDUINO_MACHINE) -#define ARDUINO_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(ArduinoMachineClass, (klass), TYPE_ARDUINO_MACHINE) -#define ARDUINO_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ArduinoMachineClass, (obj), TYPE_ARDUINO_MACHINE) +DECLARE_OBJ_CHECKERS(ArduinoMachineState, ArduinoMachineClass, + ARDUINO_MACHINE, TYPE_ARDUINO_MACHINE) static void arduino_machine_init(MachineState *machine) { diff --git a/hw/avr/atmega.c b/hw/avr/atmega.c index c3b8e05110..44c6afebbb 100644 --- a/hw/avr/atmega.c +++ b/hw/avr/atmega.c @@ -63,10 +63,8 @@ struct AtmegaMcuClass { }; typedef struct AtmegaMcuClass AtmegaMcuClass; -#define ATMEGA_MCU_CLASS(klass) \ - OBJECT_CLASS_CHECK(AtmegaMcuClass, (klass), TYPE_ATMEGA_MCU) -#define ATMEGA_MCU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(AtmegaMcuClass, (obj), TYPE_ATMEGA_MCU) +DECLARE_CLASS_CHECKERS(AtmegaMcuClass, ATMEGA_MCU, + TYPE_ATMEGA_MCU) static const peripheral_cfg dev168_328[PERIFMAX] = { [USART0] = { 0xc0, POWER0, 1 }, diff --git a/hw/block/fdc.c b/hw/block/fdc.c index f4bb0251dd..9ed8de8160 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -66,7 +66,8 @@ #define TYPE_FLOPPY_BUS "floppy-bus" typedef struct FloppyBus FloppyBus; -#define FLOPPY_BUS(obj) OBJECT_CHECK(FloppyBus, (obj), TYPE_FLOPPY_BUS) +DECLARE_INSTANCE_CHECKER(FloppyBus, FLOPPY_BUS, + TYPE_FLOPPY_BUS) typedef struct FDCtrl FDCtrl; typedef struct FDrive FDrive; @@ -498,8 +499,8 @@ static const BlockDevOps fd_block_ops = { #define TYPE_FLOPPY_DRIVE "floppy" typedef struct FloppyDrive FloppyDrive; -#define FLOPPY_DRIVE(obj) \ - OBJECT_CHECK(FloppyDrive, (obj), TYPE_FLOPPY_DRIVE) +DECLARE_INSTANCE_CHECKER(FloppyDrive, FLOPPY_DRIVE, + TYPE_FLOPPY_DRIVE) struct FloppyDrive { DeviceState qdev; @@ -892,7 +893,8 @@ static FloppyDriveType get_fallback_drive_type(FDrive *drv) #define TYPE_SYSBUS_FDC "base-sysbus-fdc" typedef struct FDCtrlSysBus FDCtrlSysBus; -#define SYSBUS_FDC(obj) OBJECT_CHECK(FDCtrlSysBus, (obj), TYPE_SYSBUS_FDC) +DECLARE_INSTANCE_CHECKER(FDCtrlSysBus, SYSBUS_FDC, + TYPE_SYSBUS_FDC) struct FDCtrlSysBus { /*< private >*/ @@ -903,7 +905,8 @@ struct FDCtrlSysBus { }; typedef struct FDCtrlISABus FDCtrlISABus; -#define ISA_FDC(obj) OBJECT_CHECK(FDCtrlISABus, (obj), TYPE_ISA_FDC) +DECLARE_INSTANCE_CHECKER(FDCtrlISABus, ISA_FDC, + TYPE_ISA_FDC) struct FDCtrlISABus { ISADevice parent_obj; diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 43b8eae529..4cee0721b1 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -462,12 +462,8 @@ struct M25P80Class { typedef struct M25P80Class M25P80Class; #define TYPE_M25P80 "m25p80-generic" -#define M25P80(obj) \ - OBJECT_CHECK(Flash, (obj), TYPE_M25P80) -#define M25P80_CLASS(klass) \ - OBJECT_CLASS_CHECK(M25P80Class, (klass), TYPE_M25P80) -#define M25P80_GET_CLASS(obj) \ - OBJECT_GET_CLASS(M25P80Class, (obj), TYPE_M25P80) +DECLARE_OBJ_CHECKERS(Flash, M25P80Class, + M25P80, TYPE_M25P80) static inline Manufacturer get_man(Flash *s) { diff --git a/hw/block/nand.c b/hw/block/nand.c index e409d3d752..c8e9f7ffcf 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -90,8 +90,8 @@ struct NANDFlashState { #define TYPE_NAND "nand" -#define NAND(obj) \ - OBJECT_CHECK(NANDFlashState, (obj), TYPE_NAND) +DECLARE_INSTANCE_CHECKER(NANDFlashState, NAND, + TYPE_NAND) static void mem_and(uint8_t *dest, const uint8_t *src, size_t n) { diff --git a/hw/block/onenand.c b/hw/block/onenand.c index 39d9cf74f3..8b541819cf 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -41,7 +41,8 @@ #define TYPE_ONE_NAND "onenand" typedef struct OneNANDState OneNANDState; -#define ONE_NAND(obj) OBJECT_CHECK(OneNANDState, (obj), TYPE_ONE_NAND) +DECLARE_INSTANCE_CHECKER(OneNANDState, ONE_NAND, + TYPE_ONE_NAND) struct OneNANDState { SysBusDevice parent_obj; diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 62cad0636b..7b1fae28a3 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -34,8 +34,8 @@ #define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon" typedef struct ISADebugconState ISADebugconState; -#define ISA_DEBUGCON_DEVICE(obj) \ - OBJECT_CHECK(ISADebugconState, (obj), TYPE_ISA_DEBUGCON_DEVICE) +DECLARE_INSTANCE_CHECKER(ISADebugconState, ISA_DEBUGCON_DEVICE, + TYPE_ISA_DEBUGCON_DEVICE) //#define DEBUG_DEBUGCON diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c index f2fbe4aab3..732d961476 100644 --- a/hw/char/etraxfs_ser.c +++ b/hw/char/etraxfs_ser.c @@ -51,8 +51,8 @@ #define TYPE_ETRAX_FS_SERIAL "etraxfs,serial" typedef struct ETRAXSerial ETRAXSerial; -#define ETRAX_SERIAL(obj) \ - OBJECT_CHECK(ETRAXSerial, (obj), TYPE_ETRAX_FS_SERIAL) +DECLARE_INSTANCE_CHECKER(ETRAXSerial, ETRAX_SERIAL, + TYPE_ETRAX_FS_SERIAL) struct ETRAXSerial { SysBusDevice parent_obj; diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index dadd50853f..7bf5274cc1 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -140,8 +140,8 @@ typedef struct { #define TYPE_EXYNOS4210_UART "exynos4210.uart" typedef struct Exynos4210UartState Exynos4210UartState; -#define EXYNOS4210_UART(obj) \ - OBJECT_CHECK(Exynos4210UartState, (obj), TYPE_EXYNOS4210_UART) +DECLARE_INSTANCE_CHECKER(Exynos4210UartState, EXYNOS4210_UART, + TYPE_EXYNOS4210_UART) struct Exynos4210UartState { SysBusDevice parent_obj; diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index 9d5ad8b0b1..3c61871257 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -74,8 +74,8 @@ #define FIFO_LENGTH 1024 typedef struct UART UART; -#define GRLIB_APB_UART(obj) \ - OBJECT_CHECK(UART, (obj), TYPE_GRLIB_APB_UART) +DECLARE_INSTANCE_CHECKER(UART, GRLIB_APB_UART, + TYPE_GRLIB_APB_UART) struct UART { SysBusDevice parent_obj; diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index 4077608114..5371961ed2 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -123,8 +123,8 @@ struct IPOctalState { #define TYPE_IPOCTAL "ipoctal232" -#define IPOCTAL(obj) \ - OBJECT_CHECK(IPOctalState, (obj), TYPE_IPOCTAL) +DECLARE_INSTANCE_CHECKER(IPOctalState, IPOCTAL, + TYPE_IPOCTAL) static const VMStateDescription vmstate_scc2698_channel = { .name = "scc2698_channel", diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c index 22d072d4cc..94d79963ef 100644 --- a/hw/char/lm32_juart.c +++ b/hw/char/lm32_juart.c @@ -43,7 +43,8 @@ enum { }; typedef struct LM32JuartState LM32JuartState; -#define LM32_JUART(obj) OBJECT_CHECK(LM32JuartState, (obj), TYPE_LM32_JUART) +DECLARE_INSTANCE_CHECKER(LM32JuartState, LM32_JUART, + TYPE_LM32_JUART) struct LM32JuartState { SysBusDevice parent_obj; diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c index 0c66976e80..3220694ad2 100644 --- a/hw/char/lm32_uart.c +++ b/hw/char/lm32_uart.c @@ -96,7 +96,8 @@ enum { #define TYPE_LM32_UART "lm32-uart" typedef struct LM32UartState LM32UartState; -#define LM32_UART(obj) OBJECT_CHECK(LM32UartState, (obj), TYPE_LM32_UART) +DECLARE_INSTANCE_CHECKER(LM32UartState, LM32_UART, + TYPE_LM32_UART) struct LM32UartState { SysBusDevice parent_obj; diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index d6c43105ec..2a66742a02 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -38,7 +38,8 @@ struct mcf_uart_state { typedef struct mcf_uart_state mcf_uart_state; #define TYPE_MCF_UART "mcf-uart" -#define MCF_UART(obj) OBJECT_CHECK(mcf_uart_state, (obj), TYPE_MCF_UART) +DECLARE_INSTANCE_CHECKER(mcf_uart_state, MCF_UART, + TYPE_MCF_UART) /* UART Status Register bits. */ #define MCF_UART_RxRDY 0x01 diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c index f148240e43..ea6d24851b 100644 --- a/hw/char/milkymist-uart.c +++ b/hw/char/milkymist-uart.c @@ -59,8 +59,8 @@ enum { #define TYPE_MILKYMIST_UART "milkymist-uart" typedef struct MilkymistUartState MilkymistUartState; -#define MILKYMIST_UART(obj) \ - OBJECT_CHECK(MilkymistUartState, (obj), TYPE_MILKYMIST_UART) +DECLARE_INSTANCE_CHECKER(MilkymistUartState, MILKYMIST_UART, + TYPE_MILKYMIST_UART) struct MilkymistUartState { SysBusDevice parent_obj; diff --git a/hw/char/parallel.c b/hw/char/parallel.c index bf4708e277..9384c57d13 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -94,8 +94,8 @@ typedef struct ParallelState { #define TYPE_ISA_PARALLEL "isa-parallel" typedef struct ISAParallelState ISAParallelState; -#define ISA_PARALLEL(obj) \ - OBJECT_CHECK(ISAParallelState, (obj), TYPE_ISA_PARALLEL) +DECLARE_INSTANCE_CHECKER(ISAParallelState, ISA_PARALLEL, + TYPE_ISA_PARALLEL) struct ISAParallelState { ISADevice parent_obj; diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 6ea976eabc..795d9c4039 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -49,8 +49,8 @@ struct SCLPConsoleLM { typedef struct SCLPConsoleLM SCLPConsoleLM; #define TYPE_SCLPLM_CONSOLE "sclplmconsole" -#define SCLPLM_CONSOLE(obj) \ - OBJECT_CHECK(SCLPConsoleLM, (obj), TYPE_SCLPLM_CONSOLE) +DECLARE_INSTANCE_CHECKER(SCLPConsoleLM, SCLPLM_CONSOLE, + TYPE_SCLPLM_CONSOLE) /* * Character layer call-back functions diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 4c58773f89..fd335c4206 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -45,8 +45,8 @@ struct SCLPConsole { typedef struct SCLPConsole SCLPConsole; #define TYPE_SCLP_CONSOLE "sclpconsole" -#define SCLP_CONSOLE(obj) \ - OBJECT_CHECK(SCLPConsole, (obj), TYPE_SCLP_CONSOLE) +DECLARE_INSTANCE_CHECKER(SCLPConsole, SCLP_CONSOLE, + TYPE_SCLP_CONSOLE) /* character layer call-back functions */ diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index 2b4e8006da..f28da240c5 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -35,7 +35,8 @@ #include "qom/object.h" typedef struct ISASerialState ISASerialState; -#define ISA_SERIAL(obj) OBJECT_CHECK(ISASerialState, (obj), TYPE_ISA_SERIAL) +DECLARE_INSTANCE_CHECKER(ISASerialState, ISA_SERIAL, + TYPE_ISA_SERIAL) struct ISASerialState { ISADevice parent_obj; diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index de4b3b2584..f5808af09e 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -43,7 +43,8 @@ struct PCISerialState { typedef struct PCISerialState PCISerialState; #define TYPE_PCI_SERIAL "pci-serial" -#define PCI_SERIAL(s) OBJECT_CHECK(PCISerialState, (s), TYPE_PCI_SERIAL) +DECLARE_INSTANCE_CHECKER(PCISerialState, PCI_SERIAL, + TYPE_PCI_SERIAL) static void serial_pci_realize(PCIDevice *dev, Error **errp) { diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index 79b68d0c77..117cda89f5 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -21,8 +21,8 @@ struct SpaprVioVty { typedef struct SpaprVioVty SpaprVioVty; #define TYPE_VIO_SPAPR_VTY_DEVICE "spapr-vty" -#define VIO_SPAPR_VTY_DEVICE(obj) \ - OBJECT_CHECK(SpaprVioVty, (obj), TYPE_VIO_SPAPR_VTY_DEVICE) +DECLARE_INSTANCE_CHECKER(SpaprVioVty, VIO_SPAPR_VTY_DEVICE, + TYPE_VIO_SPAPR_VTY_DEVICE) static int vty_can_receive(void *opaque) { diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c index aa151bc1c3..a893a61431 100644 --- a/hw/char/terminal3270.c +++ b/hw/char/terminal3270.c @@ -39,8 +39,8 @@ struct Terminal3270 { typedef struct Terminal3270 Terminal3270; #define TYPE_TERMINAL_3270 "x-terminal3270" -#define TERMINAL_3270(obj) \ - OBJECT_CHECK(Terminal3270, (obj), TYPE_TERMINAL_3270) +DECLARE_INSTANCE_CHECKER(Terminal3270, TERMINAL_3270, + TYPE_TERMINAL_3270) static int terminal_can_read(void *opaque) { diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 9a8c74d5c2..445ddf0df9 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -23,8 +23,8 @@ #define TYPE_VIRTIO_CONSOLE_SERIAL_PORT "virtserialport" typedef struct VirtConsole VirtConsole; -#define VIRTIO_CONSOLE(obj) \ - OBJECT_CHECK(VirtConsole, (obj), TYPE_VIRTIO_CONSOLE_SERIAL_PORT) +DECLARE_INSTANCE_CHECKER(VirtConsole, VIRTIO_CONSOLE, + TYPE_VIRTIO_CONSOLE_SERIAL_PORT) struct VirtConsole { VirtIOSerialPort parent_obj; diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index 14ba0707a2..8138e0f625 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -54,8 +54,8 @@ #define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite" typedef struct XilinxUARTLite XilinxUARTLite; -#define XILINX_UARTLITE(obj) \ - OBJECT_CHECK(XilinxUARTLite, (obj), TYPE_XILINX_UARTLITE) +DECLARE_INSTANCE_CHECKER(XilinxUARTLite, XILINX_UARTLITE, + TYPE_XILINX_UARTLITE) struct XilinxUARTLite { SysBusDevice parent_obj; diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c index 386a7b1f58..7a4be1fc0e 100644 --- a/hw/cpu/realview_mpcore.c +++ b/hw/cpu/realview_mpcore.c @@ -19,8 +19,8 @@ #define TYPE_REALVIEW_MPCORE_RIRQ "realview_mpcore" typedef struct mpcore_rirq_state mpcore_rirq_state; -#define REALVIEW_MPCORE_RIRQ(obj) \ - OBJECT_CHECK(mpcore_rirq_state, (obj), TYPE_REALVIEW_MPCORE_RIRQ) +DECLARE_INSTANCE_CHECKER(mpcore_rirq_state, REALVIEW_MPCORE_RIRQ, + TYPE_REALVIEW_MPCORE_RIRQ) /* Dummy PIC to route IRQ lines. The baseboard has 4 independent IRQ controllers. The output of these, plus some of the raw input lines diff --git a/hw/display/ads7846.c b/hw/display/ads7846.c index 9118438f32..a8b972dd1b 100644 --- a/hw/display/ads7846.c +++ b/hw/display/ads7846.c @@ -32,7 +32,8 @@ struct ADS7846State { typedef struct ADS7846State ADS7846State; #define TYPE_ADS7846 "ads7846" -#define ADS7846(obj) OBJECT_CHECK(ADS7846State, (obj), TYPE_ADS7846) +DECLARE_INSTANCE_CHECKER(ADS7846State, ADS7846, + TYPE_ADS7846) /* Control-byte bitfields */ #define CB_PD0 (1 << 0) diff --git a/hw/display/artist.c b/hw/display/artist.c index 2e8272665b..aef38ba233 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -26,7 +26,8 @@ #define TYPE_ARTIST "artist" typedef struct ARTISTState ARTISTState; -#define ARTIST(obj) OBJECT_CHECK(ARTISTState, (obj), TYPE_ARTIST) +DECLARE_INSTANCE_CHECKER(ARTISTState, ARTIST, + TYPE_ARTIST) #ifdef HOST_WORDS_BIGENDIAN #define ROP8OFF(_i) (3 - (_i)) diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c index 10f0ad01d2..05dbdb7c69 100644 --- a/hw/display/bochs-display.c +++ b/hw/display/bochs-display.c @@ -58,8 +58,8 @@ struct BochsDisplayState { typedef struct BochsDisplayState BochsDisplayState; #define TYPE_BOCHS_DISPLAY "bochs-display" -#define BOCHS_DISPLAY(obj) OBJECT_CHECK(BochsDisplayState, (obj), \ - TYPE_BOCHS_DISPLAY) +DECLARE_INSTANCE_CHECKER(BochsDisplayState, BOCHS_DISPLAY, + TYPE_BOCHS_DISPLAY) static const VMStateDescription vmstate_bochs_display = { .name = "bochs-display", diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 12185f89ee..ec0a449381 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -67,7 +67,8 @@ #define TYPE_CG3 "cgthree" typedef struct CG3State CG3State; -#define CG3(obj) OBJECT_CHECK(CG3State, (obj), TYPE_CG3) +DECLARE_INSTANCE_CHECKER(CG3State, CG3, + TYPE_CG3) struct CG3State { SysBusDevice parent_obj; diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index 055ffa2082..d2cb2f944c 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -186,8 +186,8 @@ struct PCICirrusVGAState { typedef struct PCICirrusVGAState PCICirrusVGAState; #define TYPE_PCI_CIRRUS_VGA "cirrus-vga" -#define PCI_CIRRUS_VGA(obj) \ - OBJECT_CHECK(PCICirrusVGAState, (obj), TYPE_PCI_CIRRUS_VGA) +DECLARE_INSTANCE_CHECKER(PCICirrusVGAState, PCI_CIRRUS_VGA, + TYPE_PCI_CIRRUS_VGA) static uint8_t rop_to_index[256]; diff --git a/hw/display/cirrus_vga_isa.c b/hw/display/cirrus_vga_isa.c index 9c59593c7c..d844a703e1 100644 --- a/hw/display/cirrus_vga_isa.c +++ b/hw/display/cirrus_vga_isa.c @@ -34,8 +34,8 @@ #define TYPE_ISA_CIRRUS_VGA "isa-cirrus-vga" typedef struct ISACirrusVGAState ISACirrusVGAState; -#define ISA_CIRRUS_VGA(obj) \ - OBJECT_CHECK(ISACirrusVGAState, (obj), TYPE_ISA_CIRRUS_VGA) +DECLARE_INSTANCE_CHECKER(ISACirrusVGAState, ISA_CIRRUS_VGA, + TYPE_ISA_CIRRUS_VGA) struct ISACirrusVGAState { ISADevice parent_obj; diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c index e280e61cc9..5026e61c6e 100644 --- a/hw/display/exynos4210_fimd.c +++ b/hw/display/exynos4210_fimd.c @@ -295,8 +295,8 @@ struct Exynos4210fimdWindow { #define TYPE_EXYNOS4210_FIMD "exynos4210.fimd" typedef struct Exynos4210fimdState Exynos4210fimdState; -#define EXYNOS4210_FIMD(obj) \ - OBJECT_CHECK(Exynos4210fimdState, (obj), TYPE_EXYNOS4210_FIMD) +DECLARE_INSTANCE_CHECKER(Exynos4210fimdState, EXYNOS4210_FIMD, + TYPE_EXYNOS4210_FIMD) struct Exynos4210fimdState { SysBusDevice parent_obj; diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index 2158240dde..087440db9f 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -488,7 +488,8 @@ static void g364fb_init(DeviceState *dev, G364State *s) #define TYPE_G364 "sysbus-g364" typedef struct G364SysBusState G364SysBusState; -#define G364(obj) OBJECT_CHECK(G364SysBusState, (obj), TYPE_G364) +DECLARE_INSTANCE_CHECKER(G364SysBusState, G364, + TYPE_G364) struct G364SysBusState { SysBusDevice parent_obj; diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 66f6a59a26..8dd30763c0 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -37,7 +37,8 @@ typedef enum { #define TYPE_JAZZ_LED "jazz-led" typedef struct LedState LedState; -#define JAZZ_LED(obj) OBJECT_CHECK(LedState, (obj), TYPE_JAZZ_LED) +DECLARE_INSTANCE_CHECKER(LedState, JAZZ_LED, + TYPE_JAZZ_LED) struct LedState { SysBusDevice parent_obj; diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index 53f5707c9c..ce98febe51 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -84,8 +84,8 @@ struct vertex { #define TYPE_MILKYMIST_TMU2 "milkymist-tmu2" typedef struct MilkymistTMU2State MilkymistTMU2State; -#define MILKYMIST_TMU2(obj) \ - OBJECT_CHECK(MilkymistTMU2State, (obj), TYPE_MILKYMIST_TMU2) +DECLARE_INSTANCE_CHECKER(MilkymistTMU2State, MILKYMIST_TMU2, + TYPE_MILKYMIST_TMU2) struct MilkymistTMU2State { SysBusDevice parent_obj; diff --git a/hw/display/milkymist-vgafb.c b/hw/display/milkymist-vgafb.c index 54cdc612a4..0f38701461 100644 --- a/hw/display/milkymist-vgafb.c +++ b/hw/display/milkymist-vgafb.c @@ -70,8 +70,8 @@ enum { #define TYPE_MILKYMIST_VGAFB "milkymist-vgafb" typedef struct MilkymistVgafbState MilkymistVgafbState; -#define MILKYMIST_VGAFB(obj) \ - OBJECT_CHECK(MilkymistVgafbState, (obj), TYPE_MILKYMIST_VGAFB) +DECLARE_INSTANCE_CHECKER(MilkymistVgafbState, MILKYMIST_VGAFB, + TYPE_MILKYMIST_VGAFB) struct MilkymistVgafbState { SysBusDevice parent_obj; diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c index aef7058c76..2e2d92ed12 100644 --- a/hw/display/next-fb.c +++ b/hw/display/next-fb.c @@ -33,7 +33,8 @@ #include "qom/object.h" typedef struct NeXTFbState NeXTFbState; -#define NEXTFB(obj) OBJECT_CHECK(NeXTFbState, (obj), TYPE_NEXTFB) +DECLARE_INSTANCE_CHECKER(NeXTFbState, NEXTFB, + TYPE_NEXTFB) struct NeXTFbState { SysBusDevice parent_obj; diff --git a/hw/display/pl110.c b/hw/display/pl110.c index 1a3a0bb145..8c67eede41 100644 --- a/hw/display/pl110.c +++ b/hw/display/pl110.c @@ -50,7 +50,8 @@ enum pl110_version #define TYPE_PL110 "pl110" typedef struct PL110State PL110State; -#define PL110(obj) OBJECT_CHECK(PL110State, (obj), TYPE_PL110) +DECLARE_INSTANCE_CHECKER(PL110State, PL110, + TYPE_PL110) struct PL110State { SysBusDevice parent_obj; diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c index b15fc7e580..f480885434 100644 --- a/hw/display/ramfb-standalone.c +++ b/hw/display/ramfb-standalone.c @@ -8,7 +8,8 @@ #include "qom/object.h" typedef struct RAMFBStandaloneState RAMFBStandaloneState; -#define RAMFB(obj) OBJECT_CHECK(RAMFBStandaloneState, (obj), TYPE_RAMFB_DEVICE) +DECLARE_INSTANCE_CHECKER(RAMFBStandaloneState, RAMFB, + TYPE_RAMFB_DEVICE) struct RAMFBStandaloneState { SysBusDevice parent_obj; diff --git a/hw/display/sii9022.c b/hw/display/sii9022.c index 636bf66c1d..5a68efdaa9 100644 --- a/hw/display/sii9022.c +++ b/hw/display/sii9022.c @@ -37,7 +37,8 @@ #define TYPE_SII9022 "sii9022" typedef struct sii9022_state sii9022_state; -#define SII9022(obj) OBJECT_CHECK(sii9022_state, (obj), TYPE_SII9022) +DECLARE_INSTANCE_CHECKER(sii9022_state, SII9022, + TYPE_SII9022) struct sii9022_state { I2CSlave parent_obj; diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 7e456c4a0a..a7bf0ade8d 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1933,8 +1933,8 @@ static const VMStateDescription vmstate_sm501_state = { #define TYPE_SYSBUS_SM501 "sysbus-sm501" typedef struct SM501SysBusState SM501SysBusState; -#define SYSBUS_SM501(obj) \ - OBJECT_CHECK(SM501SysBusState, (obj), TYPE_SYSBUS_SM501) +DECLARE_INSTANCE_CHECKER(SM501SysBusState, SYSBUS_SM501, + TYPE_SYSBUS_SM501) struct SM501SysBusState { /*< private >*/ @@ -2038,7 +2038,8 @@ TYPE_INFO(sm501_sysbus_info) #define TYPE_PCI_SM501 "sm501" typedef struct SM501PCIState SM501PCIState; -#define PCI_SM501(obj) OBJECT_CHECK(SM501PCIState, (obj), TYPE_PCI_SM501) +DECLARE_INSTANCE_CHECKER(SM501PCIState, PCI_SM501, + TYPE_PCI_SM501) struct SM501PCIState { /*< private >*/ diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c index 87f5b909ce..f1afd5b520 100644 --- a/hw/display/ssd0303.c +++ b/hw/display/ssd0303.c @@ -48,7 +48,8 @@ enum ssd0303_cmd { #define TYPE_SSD0303 "ssd0303" typedef struct ssd0303_state ssd0303_state; -#define SSD0303(obj) OBJECT_CHECK(ssd0303_state, (obj), TYPE_SSD0303) +DECLARE_INSTANCE_CHECKER(ssd0303_state, SSD0303, + TYPE_SSD0303) struct ssd0303_state { I2CSlave parent_obj; diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c index 4818a3f648..3f4b08afd7 100644 --- a/hw/display/ssd0323.c +++ b/hw/display/ssd0323.c @@ -69,7 +69,8 @@ struct ssd0323_state { typedef struct ssd0323_state ssd0323_state; #define TYPE_SSD0323 "ssd0323" -#define SSD0323(obj) OBJECT_CHECK(ssd0323_state, (obj), TYPE_SSD0323) +DECLARE_INSTANCE_CHECKER(ssd0323_state, SSD0323, + TYPE_SSD0323) static uint32_t ssd0323_transfer(SSISlave *dev, uint32_t data) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index 029bb2e4e9..108aa2e062 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -57,7 +57,8 @@ #define TYPE_TCX "SUNW,tcx" typedef struct TCXState TCXState; -#define TCX(obj) OBJECT_CHECK(TCXState, (obj), TYPE_TCX) +DECLARE_INSTANCE_CHECKER(TCXState, TCX, + TYPE_TCX) struct TCXState { SysBusDevice parent_obj; diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c index 896cd4c611..f3d3ec9d3b 100644 --- a/hw/display/vga-isa.c +++ b/hw/display/vga-isa.c @@ -36,7 +36,8 @@ #define TYPE_ISA_VGA "isa-vga" typedef struct ISAVGAState ISAVGAState; -#define ISA_VGA(obj) OBJECT_CHECK(ISAVGAState, (obj), TYPE_ISA_VGA) +DECLARE_INSTANCE_CHECKER(ISAVGAState, ISA_VGA, + TYPE_ISA_VGA) struct ISAVGAState { ISADevice parent_obj; diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c index 092e99787e..f0b3d22a03 100644 --- a/hw/display/vga-pci.c +++ b/hw/display/vga-pci.c @@ -54,7 +54,8 @@ struct PCIVGAState { typedef struct PCIVGAState PCIVGAState; #define TYPE_PCI_VGA "pci-vga" -#define PCI_VGA(obj) OBJECT_CHECK(PCIVGAState, (obj), TYPE_PCI_VGA) +DECLARE_INSTANCE_CHECKER(PCIVGAState, PCI_VGA, + TYPE_PCI_VGA) static const VMStateDescription vmstate_vga_pci = { .name = "vga", diff --git a/hw/display/vhost-user-gpu-pci.c b/hw/display/vhost-user-gpu-pci.c index 678b762bbb..a02b23ecaf 100644 --- a/hw/display/vhost-user-gpu-pci.c +++ b/hw/display/vhost-user-gpu-pci.c @@ -15,8 +15,8 @@ #define TYPE_VHOST_USER_GPU_PCI "vhost-user-gpu-pci" typedef struct VhostUserGPUPCI VhostUserGPUPCI; -#define VHOST_USER_GPU_PCI(obj) \ - OBJECT_CHECK(VhostUserGPUPCI, (obj), TYPE_VHOST_USER_GPU_PCI) +DECLARE_INSTANCE_CHECKER(VhostUserGPUPCI, VHOST_USER_GPU_PCI, + TYPE_VHOST_USER_GPU_PCI) struct VhostUserGPUPCI { VirtIOGPUPCIBase parent_obj; diff --git a/hw/display/vhost-user-vga.c b/hw/display/vhost-user-vga.c index 2cc9616bea..7110ea6231 100644 --- a/hw/display/vhost-user-vga.c +++ b/hw/display/vhost-user-vga.c @@ -16,8 +16,8 @@ #define TYPE_VHOST_USER_VGA "vhost-user-vga" typedef struct VhostUserVGA VhostUserVGA; -#define VHOST_USER_VGA(obj) \ - OBJECT_CHECK(VhostUserVGA, (obj), TYPE_VHOST_USER_VGA) +DECLARE_INSTANCE_CHECKER(VhostUserVGA, VHOST_USER_VGA, + TYPE_VHOST_USER_VGA) struct VhostUserVGA { VirtIOVGABase parent_obj; diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c index 949ec88e12..55e381ff70 100644 --- a/hw/display/virtio-gpu-pci.c +++ b/hw/display/virtio-gpu-pci.c @@ -68,8 +68,8 @@ TYPE_INFO(virtio_gpu_pci_base_info) #define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci" typedef struct VirtIOGPUPCI VirtIOGPUPCI; -#define VIRTIO_GPU_PCI(obj) \ - OBJECT_CHECK(VirtIOGPUPCI, (obj), TYPE_VIRTIO_GPU_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOGPUPCI, VIRTIO_GPU_PCI, + TYPE_VIRTIO_GPU_PCI) struct VirtIOGPUPCI { VirtIOGPUPCIBase parent_obj; diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c index 66fafce541..6757e8e961 100644 --- a/hw/display/virtio-vga.c +++ b/hw/display/virtio-vga.c @@ -205,8 +205,8 @@ TYPE_INFO(virtio_vga_base_info) #define TYPE_VIRTIO_VGA "virtio-vga" typedef struct VirtIOVGA VirtIOVGA; -#define VIRTIO_VGA(obj) \ - OBJECT_CHECK(VirtIOVGA, (obj), TYPE_VIRTIO_VGA) +DECLARE_INSTANCE_CHECKER(VirtIOVGA, VIRTIO_VGA, + TYPE_VIRTIO_VGA) struct VirtIOVGA { VirtIOVGABase parent_obj; diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c index da9e6c99a7..2fff8b5080 100644 --- a/hw/dma/i82374.c +++ b/hw/dma/i82374.c @@ -33,7 +33,8 @@ #define TYPE_I82374 "i82374" typedef struct I82374State I82374State; -#define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374) +DECLARE_INSTANCE_CHECKER(I82374State, I82374, + TYPE_I82374) //#define DEBUG_I82374 diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c index 6724a989dc..4431428adc 100644 --- a/hw/dma/pl330.c +++ b/hw/dma/pl330.c @@ -272,7 +272,8 @@ struct PL330State { }; #define TYPE_PL330 "pl330" -#define PL330(obj) OBJECT_CHECK(PL330State, (obj), TYPE_PL330) +DECLARE_INSTANCE_CHECKER(PL330State, PL330, + TYPE_PL330) static const VMStateDescription vmstate_pl330 = { .name = "pl330", diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c index eb5c3de582..ea7046d1f3 100644 --- a/hw/dma/puv3_dma.c +++ b/hw/dma/puv3_dma.c @@ -24,7 +24,8 @@ #define TYPE_PUV3_DMA "puv3_dma" typedef struct PUV3DMAState PUV3DMAState; -#define PUV3_DMA(obj) OBJECT_CHECK(PUV3DMAState, (obj), TYPE_PUV3_DMA) +DECLARE_INSTANCE_CHECKER(PUV3DMAState, PUV3_DMA, + TYPE_PUV3_DMA) struct PUV3DMAState { SysBusDevice parent_obj; diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c index c81a2fbe72..5e79f07bd5 100644 --- a/hw/dma/pxa2xx_dma.c +++ b/hw/dma/pxa2xx_dma.c @@ -36,7 +36,8 @@ typedef struct { #define TYPE_PXA2XX_DMA "pxa2xx-dma" typedef struct PXA2xxDMAState PXA2xxDMAState; -#define PXA2XX_DMA(obj) OBJECT_CHECK(PXA2xxDMAState, (obj), TYPE_PXA2XX_DMA) +DECLARE_INSTANCE_CHECKER(PXA2xxDMAState, PXA2XX_DMA, + TYPE_PXA2XX_DMA) struct PXA2xxDMAState { SysBusDevice parent_obj; diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index b686a2ea33..dd92b2a241 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -57,8 +57,8 @@ typedef struct dma_pagetable_entry { #define TYPE_RC4030 "rc4030" typedef struct rc4030State rc4030State; -#define RC4030(obj) \ - OBJECT_CHECK(rc4030State, (obj), TYPE_RC4030) +DECLARE_INSTANCE_CHECKER(rc4030State, RC4030, + TYPE_RC4030) #define TYPE_RC4030_IOMMU_MEMORY_REGION "rc4030-iommu-memory-region" diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index 39c8a49493..fdcaa8dcf7 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -44,17 +44,15 @@ #define TYPE_XILINX_AXI_DMA_CONTROL_STREAM "xilinx-axi-dma-control-stream" typedef struct XilinxAXIDMA XilinxAXIDMA; -#define XILINX_AXI_DMA(obj) \ - OBJECT_CHECK(XilinxAXIDMA, (obj), TYPE_XILINX_AXI_DMA) +DECLARE_INSTANCE_CHECKER(XilinxAXIDMA, XILINX_AXI_DMA, + TYPE_XILINX_AXI_DMA) typedef struct XilinxAXIDMAStreamSlave XilinxAXIDMAStreamSlave; -#define XILINX_AXI_DMA_DATA_STREAM(obj) \ - OBJECT_CHECK(XilinxAXIDMAStreamSlave, (obj),\ - TYPE_XILINX_AXI_DMA_DATA_STREAM) +DECLARE_INSTANCE_CHECKER(XilinxAXIDMAStreamSlave, XILINX_AXI_DMA_DATA_STREAM, + TYPE_XILINX_AXI_DMA_DATA_STREAM) -#define XILINX_AXI_DMA_CONTROL_STREAM(obj) \ - OBJECT_CHECK(XilinxAXIDMAStreamSlave, (obj),\ - TYPE_XILINX_AXI_DMA_CONTROL_STREAM) +DECLARE_INSTANCE_CHECKER(XilinxAXIDMAStreamSlave, XILINX_AXI_DMA_CONTROL_STREAM, + TYPE_XILINX_AXI_DMA_CONTROL_STREAM) #define R_DMACR (0x00 / 4) #define R_DMASR (0x04 / 4) diff --git a/hw/gpio/gpio_key.c b/hw/gpio/gpio_key.c index f1d6c8ff0e..c9fb5a467f 100644 --- a/hw/gpio/gpio_key.c +++ b/hw/gpio/gpio_key.c @@ -32,7 +32,8 @@ #define TYPE_GPIOKEY "gpio-key" typedef struct GPIOKEYState GPIOKEYState; -#define GPIOKEY(obj) OBJECT_CHECK(GPIOKEYState, (obj), TYPE_GPIOKEY) +DECLARE_INSTANCE_CHECKER(GPIOKEYState, GPIOKEY, + TYPE_GPIOKEY) #define GPIO_KEY_LATENCY 100 /* 100ms */ struct GPIOKEYState { diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c index 969ca5bbf7..d6204781e9 100644 --- a/hw/gpio/max7310.c +++ b/hw/gpio/max7310.c @@ -18,7 +18,8 @@ #define TYPE_MAX7310 "max7310" typedef struct MAX7310State MAX7310State; -#define MAX7310(obj) OBJECT_CHECK(MAX7310State, (obj), TYPE_MAX7310) +DECLARE_INSTANCE_CHECKER(MAX7310State, MAX7310, + TYPE_MAX7310) struct MAX7310State { I2CSlave parent_obj; diff --git a/hw/gpio/mpc8xxx.c b/hw/gpio/mpc8xxx.c index acf45f6e2c..5df9f1ab4c 100644 --- a/hw/gpio/mpc8xxx.c +++ b/hw/gpio/mpc8xxx.c @@ -28,7 +28,8 @@ #define TYPE_MPC8XXX_GPIO "mpc8xxx_gpio" typedef struct MPC8XXXGPIOState MPC8XXXGPIOState; -#define MPC8XXX_GPIO(obj) OBJECT_CHECK(MPC8XXXGPIOState, (obj), TYPE_MPC8XXX_GPIO) +DECLARE_INSTANCE_CHECKER(MPC8XXXGPIOState, MPC8XXX_GPIO, + TYPE_MPC8XXX_GPIO) struct MPC8XXXGPIOState { SysBusDevice parent_obj; diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c index 352c46d2c4..4a52c7be9c 100644 --- a/hw/gpio/pl061.c +++ b/hw/gpio/pl061.c @@ -36,7 +36,8 @@ static const uint8_t pl061_id_luminary[12] = #define TYPE_PL061 "pl061" typedef struct PL061State PL061State; -#define PL061(obj) OBJECT_CHECK(PL061State, (obj), TYPE_PL061) +DECLARE_INSTANCE_CHECKER(PL061State, PL061, + TYPE_PL061) #define N_GPIOS 8 diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c index d4ef5cf0dc..4f83e4ff20 100644 --- a/hw/gpio/puv3_gpio.c +++ b/hw/gpio/puv3_gpio.c @@ -20,7 +20,8 @@ #define TYPE_PUV3_GPIO "puv3_gpio" typedef struct PUV3GPIOState PUV3GPIOState; -#define PUV3_GPIO(obj) OBJECT_CHECK(PUV3GPIOState, (obj), TYPE_PUV3_GPIO) +DECLARE_INSTANCE_CHECKER(PUV3GPIOState, PUV3_GPIO, + TYPE_PUV3_GPIO) struct PUV3GPIOState { SysBusDevice parent_obj; diff --git a/hw/gpio/zaurus.c b/hw/gpio/zaurus.c index a9c2bc7102..bfcfba8459 100644 --- a/hw/gpio/zaurus.c +++ b/hw/gpio/zaurus.c @@ -29,7 +29,8 @@ #define TYPE_SCOOP "scoop" typedef struct ScoopInfo ScoopInfo; -#define SCOOP(obj) OBJECT_CHECK(ScoopInfo, (obj), TYPE_SCOOP) +DECLARE_INSTANCE_CHECKER(ScoopInfo, SCOOP, + TYPE_SCOOP) struct ScoopInfo { SysBusDevice parent_obj; diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c index 853d65e304..8cf067669f 100644 --- a/hw/hppa/dino.c +++ b/hw/hppa/dino.c @@ -82,8 +82,8 @@ #define DINO_MEM_CHUNK_SIZE (8 * MiB) typedef struct DinoState DinoState; -#define DINO_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(DinoState, (obj), TYPE_DINO_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(DinoState, DINO_PCI_HOST_BRIDGE, + TYPE_DINO_PCI_HOST_BRIDGE) #define DINO800_REGS (1 + (DINO_TLTIM - DINO_GMASK) / 4) static const uint32_t reg800_keep_bits[DINO800_REGS] = { diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c index a3dd8761fa..a83dc57ba5 100644 --- a/hw/hppa/lasi.c +++ b/hw/hppa/lasi.c @@ -53,8 +53,8 @@ #define ICR_TOC_BIT LASI_BIT(1) /* bit 1 in ICR */ typedef struct LasiState LasiState; -#define LASI_CHIP(obj) \ - OBJECT_CHECK(LasiState, (obj), TYPE_LASI_CHIP) +DECLARE_INSTANCE_CHECKER(LasiState, LASI_CHIP, + TYPE_LASI_CHIP) #define LASI_RTC_HPA (LASI_HPA + 0x9000) diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index 89c6a0b6f9..048a366e64 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -38,7 +38,8 @@ struct SynICState { typedef struct SynICState SynICState; #define TYPE_SYNIC "hyperv-synic" -#define SYNIC(obj) OBJECT_CHECK(SynICState, (obj), TYPE_SYNIC) +DECLARE_INSTANCE_CHECKER(SynICState, SYNIC, + TYPE_SYNIC) static bool synic_enabled; diff --git a/hw/hyperv/hyperv_testdev.c b/hw/hyperv/hyperv_testdev.c index 46b67c140e..08b5e47d19 100644 --- a/hw/hyperv/hyperv_testdev.c +++ b/hw/hyperv/hyperv_testdev.c @@ -50,8 +50,8 @@ struct HypervTestDev { typedef struct HypervTestDev HypervTestDev; #define TYPE_HYPERV_TEST_DEV "hyperv-testdev" -#define HYPERV_TEST_DEV(obj) \ - OBJECT_CHECK(HypervTestDev, (obj), TYPE_HYPERV_TEST_DEV) +DECLARE_INSTANCE_CHECKER(HypervTestDev, HYPERV_TEST_DEV, + TYPE_HYPERV_TEST_DEV) enum { HV_TEST_DEV_SINT_ROUTE_CREATE = 1, diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c index 71d5cc89ae..016646807e 100644 --- a/hw/i2c/bitbang_i2c.c +++ b/hw/i2c/bitbang_i2c.c @@ -164,7 +164,8 @@ void bitbang_i2c_init(bitbang_i2c_interface *s, I2CBus *bus) #define TYPE_GPIO_I2C "gpio_i2c" typedef struct GPIOI2CState GPIOI2CState; -#define GPIO_I2C(obj) OBJECT_CHECK(GPIOI2CState, (obj), TYPE_GPIO_I2C) +DECLARE_INSTANCE_CHECKER(GPIOI2CState, GPIO_I2C, + TYPE_GPIO_I2C) struct GPIOI2CState { SysBusDevice parent_obj; diff --git a/hw/i2c/exynos4210_i2c.c b/hw/i2c/exynos4210_i2c.c index a8f49e32b6..e13dca3ed1 100644 --- a/hw/i2c/exynos4210_i2c.c +++ b/hw/i2c/exynos4210_i2c.c @@ -35,8 +35,8 @@ #define TYPE_EXYNOS4_I2C "exynos4210.i2c" typedef struct Exynos4210I2CState Exynos4210I2CState; -#define EXYNOS4_I2C(obj) \ - OBJECT_CHECK(Exynos4210I2CState, (obj), TYPE_EXYNOS4_I2C) +DECLARE_INSTANCE_CHECKER(Exynos4210I2CState, EXYNOS4_I2C, + TYPE_EXYNOS4_I2C) /* Exynos4210 I2C memory map */ #define EXYNOS4_I2C_MEM_SIZE 0x14 diff --git a/hw/i2c/mpc_i2c.c b/hw/i2c/mpc_i2c.c index 30a9f737be..39355f0670 100644 --- a/hw/i2c/mpc_i2c.c +++ b/hw/i2c/mpc_i2c.c @@ -38,8 +38,8 @@ #define TYPE_MPC_I2C "mpc-i2c" typedef struct MPCI2CState MPCI2CState; -#define MPC_I2C(obj) \ - OBJECT_CHECK(MPCI2CState, (obj), TYPE_MPC_I2C) +DECLARE_INSTANCE_CHECKER(MPCI2CState, MPC_I2C, + TYPE_MPC_I2C) #define MPC_I2C_ADR 0x00 #define MPC_I2C_FDR 0x04 diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index fefc6360a7..ff8332d22e 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -38,8 +38,8 @@ #define TYPE_SMBUS_EEPROM "smbus-eeprom" typedef struct SMBusEEPROMDevice SMBusEEPROMDevice; -#define SMBUS_EEPROM(obj) \ - OBJECT_CHECK(SMBusEEPROMDevice, (obj), TYPE_SMBUS_EEPROM) +DECLARE_INSTANCE_CHECKER(SMBusEEPROMDevice, SMBUS_EEPROM, + TYPE_SMBUS_EEPROM) #define SMBUS_EEPROM_SIZE 256 diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c index 15e1b6ced5..1eac4347b0 100644 --- a/hw/i2c/smbus_ich9.c +++ b/hw/i2c/smbus_ich9.c @@ -31,8 +31,8 @@ #include "qom/object.h" typedef struct ICH9SMBState ICH9SMBState; -#define ICH9_SMB_DEVICE(obj) \ - OBJECT_CHECK(ICH9SMBState, (obj), TYPE_ICH9_SMB_DEVICE) +DECLARE_INSTANCE_CHECKER(ICH9SMBState, ICH9_SMB_DEVICE, + TYPE_ICH9_SMB_DEVICE) struct ICH9SMBState { PCIDevice dev; diff --git a/hw/i2c/versatile_i2c.c b/hw/i2c/versatile_i2c.c index acd9617e9c..c0501831bd 100644 --- a/hw/i2c/versatile_i2c.c +++ b/hw/i2c/versatile_i2c.c @@ -30,8 +30,8 @@ #include "qom/object.h" typedef ArmSbconI2CState VersatileI2CState; -#define VERSATILE_I2C(obj) \ - OBJECT_CHECK(VersatileI2CState, (obj), TYPE_VERSATILE_I2C) +DECLARE_INSTANCE_CHECKER(VersatileI2CState, VERSATILE_I2C, + TYPE_VERSATILE_I2C) diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index 1909c8a1dc..018bc92119 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -33,7 +33,8 @@ #define TYPE_KVM_CLOCK "kvmclock" typedef struct KVMClockState KVMClockState; -#define KVM_CLOCK(obj) OBJECT_CHECK(KVMClockState, (obj), TYPE_KVM_CLOCK) +DECLARE_INSTANCE_CHECKER(KVMClockState, KVM_CLOCK, + TYPE_KVM_CLOCK) struct KVMClockState { /*< private >*/ diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index 2f82f6d5f4..893a0acdfc 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -41,11 +41,8 @@ typedef struct KVMPITClass KVMPITClass; typedef struct KVMPITState KVMPITState; -#define KVM_PIT(obj) OBJECT_CHECK(KVMPITState, (obj), TYPE_KVM_I8254) -#define KVM_PIT_CLASS(class) \ - OBJECT_CLASS_CHECK(KVMPITClass, (class), TYPE_KVM_I8254) -#define KVM_PIT_GET_CLASS(obj) \ - OBJECT_GET_CLASS(KVMPITClass, (obj), TYPE_KVM_I8254) +DECLARE_OBJ_CHECKERS(KVMPITState, KVMPITClass, + KVM_PIT, TYPE_KVM_I8254) struct KVMPITState { PITCommonState parent_obj; diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c index 82986aff66..9e6f4dd4f5 100644 --- a/hw/i386/kvm/i8259.c +++ b/hw/i386/kvm/i8259.c @@ -21,10 +21,8 @@ #define TYPE_KVM_I8259 "kvm-i8259" typedef struct KVMPICClass KVMPICClass; -#define KVM_PIC_CLASS(class) \ - OBJECT_CLASS_CHECK(KVMPICClass, (class), TYPE_KVM_I8259) -#define KVM_PIC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(KVMPICClass, (obj), TYPE_KVM_I8259) +DECLARE_CLASS_CHECKERS(KVMPICClass, KVM_PIC, + TYPE_KVM_I8259) /** * KVMPICClass: diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index 57360ebc43..4e7c697702 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -74,7 +74,8 @@ struct VAPICROMState { typedef struct VAPICROMState VAPICROMState; #define TYPE_VAPIC "kvmvapic" -#define VAPIC(obj) OBJECT_CHECK(VAPICROMState, (obj), TYPE_VAPIC) +DECLARE_INSTANCE_CHECKER(VAPICROMState, VAPIC, + TYPE_VAPIC) #define TPR_INSTR_ABS_MODRM 0x1 #define TPR_INSTR_MATCH_MODRM_REG 0x2 diff --git a/hw/i386/port92.c b/hw/i386/port92.c index 6074e5088f..cd76633464 100644 --- a/hw/i386/port92.c +++ b/hw/i386/port92.c @@ -15,7 +15,8 @@ #include "qom/object.h" typedef struct Port92State Port92State; -#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92) +DECLARE_INSTANCE_CHECKER(Port92State, PORT92, + TYPE_PORT92) struct Port92State { ISADevice parent_obj; diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c index c3b14c23df..29a250543e 100644 --- a/hw/i386/vmmouse.c +++ b/hw/i386/vmmouse.c @@ -52,7 +52,8 @@ #define TYPE_VMMOUSE "vmmouse" typedef struct VMMouseState VMMouseState; -#define VMMOUSE(obj) OBJECT_CHECK(VMMouseState, (obj), TYPE_VMMOUSE) +DECLARE_INSTANCE_CHECKER(VMMouseState, VMMOUSE, + TYPE_VMMOUSE) struct VMMouseState { ISADevice parent_obj; diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c index 0fd6af31a8..fc0bcec088 100644 --- a/hw/i386/vmport.c +++ b/hw/i386/vmport.c @@ -64,7 +64,8 @@ #define VCPU_INFO_RESERVED_BIT 31 typedef struct VMPortState VMPortState; -#define VMPORT(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT) +DECLARE_INSTANCE_CHECKER(VMPortState, VMPORT, + TYPE_VMPORT) struct VMPortState { ISADevice parent_obj; diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c index fa0e86d26e..c93acb50f8 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -72,8 +72,8 @@ struct PCIXenPlatformState { typedef struct PCIXenPlatformState PCIXenPlatformState; #define TYPE_XEN_PLATFORM "xen-platform" -#define XEN_PLATFORM(obj) \ - OBJECT_CHECK(PCIXenPlatformState, (obj), TYPE_XEN_PLATFORM) +DECLARE_INSTANCE_CHECKER(PCIXenPlatformState, XEN_PLATFORM, + TYPE_XEN_PLATFORM) #define XEN_PLATFORM_IOPORT 0x10 diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c index 7c65690689..b1bedec3ed 100644 --- a/hw/i386/xen/xen_pvdevice.c +++ b/hw/i386/xen/xen_pvdevice.c @@ -41,8 +41,8 @@ #define TYPE_XEN_PV_DEVICE "xen-pvdevice" typedef struct XenPVDevice XenPVDevice; -#define XEN_PV_DEVICE(obj) \ - OBJECT_CHECK(XenPVDevice, (obj), TYPE_XEN_PV_DEVICE) +DECLARE_INSTANCE_CHECKER(XenPVDevice, XEN_PV_DEVICE, + TYPE_XEN_PV_DEVICE) struct XenPVDevice { /*< private >*/ diff --git a/hw/ide/isa.c b/hw/ide/isa.c index cffd839d94..27f809b376 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -39,7 +39,8 @@ #define TYPE_ISA_IDE "isa-ide" typedef struct ISAIDEState ISAIDEState; -#define ISA_IDE(obj) OBJECT_CHECK(ISAIDEState, (obj), TYPE_ISA_IDE) +DECLARE_INSTANCE_CHECKER(ISAIDEState, ISA_IDE, + TYPE_ISA_IDE) struct ISAIDEState { ISADevice parent_obj; diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index 7676e9383f..6a41534174 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -35,7 +35,8 @@ #define TYPE_MICRODRIVE "microdrive" typedef struct MicroDriveState MicroDriveState; -#define MICRODRIVE(obj) OBJECT_CHECK(MicroDriveState, (obj), TYPE_MICRODRIVE) +DECLARE_INSTANCE_CHECKER(MicroDriveState, MICRODRIVE, + TYPE_MICRODRIVE) /***********************************************************/ /* CF-ATA Microdrive */ diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c index ff4bbbf938..38ecc2e1dc 100644 --- a/hw/ide/mmio.c +++ b/hw/ide/mmio.c @@ -41,7 +41,8 @@ #define TYPE_MMIO_IDE "mmio-ide" typedef struct MMIOIDEState MMIOState; -#define MMIO_IDE(obj) OBJECT_CHECK(MMIOState, (obj), TYPE_MMIO_IDE) +DECLARE_INSTANCE_CHECKER(MMIOState, MMIO_IDE, + TYPE_MMIO_IDE) struct MMIOIDEState { /*< private >*/ diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c index 4730e798f3..bae46d021c 100644 --- a/hw/ide/sii3112.c +++ b/hw/ide/sii3112.c @@ -20,7 +20,7 @@ #define TYPE_SII3112_PCI "sii3112" typedef struct SiI3112PCIState SiI3112PCIState; -#define SII3112_PCI(obj) OBJECT_CHECK(SiI3112PCIState, (obj), \ +DECLARE_INSTANCE_CHECKER(SiI3112PCIState, SII3112_PCI, TYPE_SII3112_PCI) typedef struct SiI3112Regs { diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c index cb7c1f4306..141d22577f 100644 --- a/hw/input/adb-kbd.c +++ b/hw/input/adb-kbd.c @@ -34,7 +34,8 @@ typedef struct ADBKeyboardClass ADBKeyboardClass; typedef struct KBDState KBDState; -#define ADB_KEYBOARD(obj) OBJECT_CHECK(KBDState, (obj), TYPE_ADB_KEYBOARD) +DECLARE_OBJ_CHECKERS(KBDState, ADBKeyboardClass, + ADB_KEYBOARD, TYPE_ADB_KEYBOARD) struct KBDState { /*< private >*/ @@ -45,10 +46,6 @@ struct KBDState { int rptr, wptr, count; }; -#define ADB_KEYBOARD_CLASS(class) \ - OBJECT_CLASS_CHECK(ADBKeyboardClass, (class), TYPE_ADB_KEYBOARD) -#define ADB_KEYBOARD_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ADBKeyboardClass, (obj), TYPE_ADB_KEYBOARD) struct ADBKeyboardClass { /*< private >*/ diff --git a/hw/input/adb-mouse.c b/hw/input/adb-mouse.c index 27cc9d40b9..371800df01 100644 --- a/hw/input/adb-mouse.c +++ b/hw/input/adb-mouse.c @@ -33,7 +33,8 @@ typedef struct ADBMouseClass ADBMouseClass; typedef struct MouseState MouseState; -#define ADB_MOUSE(obj) OBJECT_CHECK(MouseState, (obj), TYPE_ADB_MOUSE) +DECLARE_OBJ_CHECKERS(MouseState, ADBMouseClass, + ADB_MOUSE, TYPE_ADB_MOUSE) struct MouseState { /*< public >*/ @@ -44,10 +45,6 @@ struct MouseState { int dx, dy, dz; }; -#define ADB_MOUSE_CLASS(class) \ - OBJECT_CLASS_CHECK(ADBMouseClass, (class), TYPE_ADB_MOUSE) -#define ADB_MOUSE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ADBMouseClass, (obj), TYPE_ADB_MOUSE) struct ADBMouseClass { /*< public >*/ diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c index 569cd26a44..cd491a6828 100644 --- a/hw/input/lm832x.c +++ b/hw/input/lm832x.c @@ -29,7 +29,8 @@ #define TYPE_LM8323 "lm8323" typedef struct LM823KbdState LM823KbdState; -#define LM8323(obj) OBJECT_CHECK(LM823KbdState, (obj), TYPE_LM8323) +DECLARE_INSTANCE_CHECKER(LM823KbdState, LM8323, + TYPE_LM8323) struct LM823KbdState { I2CSlave parent_obj; diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c index 4dfa04bef0..2062ecddbc 100644 --- a/hw/input/milkymist-softusb.c +++ b/hw/input/milkymist-softusb.c @@ -52,8 +52,8 @@ enum { #define TYPE_MILKYMIST_SOFTUSB "milkymist-softusb" typedef struct MilkymistSoftUsbState MilkymistSoftUsbState; -#define MILKYMIST_SOFTUSB(obj) \ - OBJECT_CHECK(MilkymistSoftUsbState, (obj), TYPE_MILKYMIST_SOFTUSB) +DECLARE_INSTANCE_CHECKER(MilkymistSoftUsbState, MILKYMIST_SOFTUSB, + TYPE_MILKYMIST_SOFTUSB) struct MilkymistSoftUsbState { SysBusDevice parent_obj; diff --git a/hw/input/pl050.c b/hw/input/pl050.c index af2b81f5c0..c15e0a5660 100644 --- a/hw/input/pl050.c +++ b/hw/input/pl050.c @@ -18,7 +18,8 @@ #define TYPE_PL050 "pl050" typedef struct PL050State PL050State; -#define PL050(obj) OBJECT_CHECK(PL050State, (obj), TYPE_PL050) +DECLARE_INSTANCE_CHECKER(PL050State, PL050, + TYPE_PL050) struct PL050State { SysBusDevice parent_obj; diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c index 99a3cfbad5..10907406b2 100644 --- a/hw/intc/arm_gicv2m.c +++ b/hw/intc/arm_gicv2m.c @@ -38,7 +38,8 @@ #define TYPE_ARM_GICV2M "arm-gicv2m" typedef struct ARMGICv2mState ARMGICv2mState; -#define ARM_GICV2M(obj) OBJECT_CHECK(ARMGICv2mState, (obj), TYPE_ARM_GICV2M) +DECLARE_INSTANCE_CHECKER(ARMGICv2mState, ARM_GICV2M, + TYPE_ARM_GICV2M) #define GICV2M_NUM_SPI_MAX 128 diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c index 296cd2c5d1..3923c50d84 100644 --- a/hw/intc/exynos4210_combiner.c +++ b/hw/intc/exynos4210_combiner.c @@ -65,8 +65,8 @@ typedef struct CombinerGroupState { #define TYPE_EXYNOS4210_COMBINER "exynos4210.combiner" typedef struct Exynos4210CombinerState Exynos4210CombinerState; -#define EXYNOS4210_COMBINER(obj) \ - OBJECT_CHECK(Exynos4210CombinerState, (obj), TYPE_EXYNOS4210_COMBINER) +DECLARE_INSTANCE_CHECKER(Exynos4210CombinerState, EXYNOS4210_COMBINER, + TYPE_EXYNOS4210_COMBINER) struct Exynos4210CombinerState { SysBusDevice parent_obj; diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index 711f0597b8..a4ad55dfd7 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -266,8 +266,8 @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit) #define TYPE_EXYNOS4210_GIC "exynos4210.gic" typedef struct Exynos4210GicState Exynos4210GicState; -#define EXYNOS4210_GIC(obj) \ - OBJECT_CHECK(Exynos4210GicState, (obj), TYPE_EXYNOS4210_GIC) +DECLARE_INSTANCE_CHECKER(Exynos4210GicState, EXYNOS4210_GIC, + TYPE_EXYNOS4210_GIC) struct Exynos4210GicState { SysBusDevice parent_obj; @@ -381,8 +381,8 @@ TYPE_INFO(exynos4210_gic_info) #define TYPE_EXYNOS4210_IRQ_GATE "exynos4210.irq_gate" typedef struct Exynos4210IRQGateState Exynos4210IRQGateState; -#define EXYNOS4210_IRQ_GATE(obj) \ - OBJECT_CHECK(Exynos4210IRQGateState, (obj), TYPE_EXYNOS4210_IRQ_GATE) +DECLARE_INSTANCE_CHECKER(Exynos4210IRQGateState, EXYNOS4210_IRQ_GATE, + TYPE_EXYNOS4210_IRQ_GATE) struct Exynos4210IRQGateState { SysBusDevice parent_obj; diff --git a/hw/intc/grlib_irqmp.c b/hw/intc/grlib_irqmp.c index 734f3803cf..e857e9b097 100644 --- a/hw/intc/grlib_irqmp.c +++ b/hw/intc/grlib_irqmp.c @@ -52,7 +52,8 @@ #define EXTENDED_OFFSET 0xC0 typedef struct IRQMP IRQMP; -#define GRLIB_IRQMP(obj) OBJECT_CHECK(IRQMP, (obj), TYPE_GRLIB_IRQMP) +DECLARE_INSTANCE_CHECKER(IRQMP, GRLIB_IRQMP, + TYPE_GRLIB_IRQMP) typedef struct IRQMPState IRQMPState; diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index cf69921d31..a6474a7ff8 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -39,8 +39,8 @@ #define TYPE_I8259 "isa-i8259" typedef struct PICClass PICClass; -#define PIC_CLASS(class) OBJECT_CLASS_CHECK(PICClass, (class), TYPE_I8259) -#define PIC_GET_CLASS(obj) OBJECT_GET_CLASS(PICClass, (obj), TYPE_I8259) +DECLARE_CLASS_CHECKERS(PICClass, PIC, + TYPE_I8259) /** * PICClass: diff --git a/hw/intc/lm32_pic.c b/hw/intc/lm32_pic.c index ec6535d37b..4db527c9ec 100644 --- a/hw/intc/lm32_pic.c +++ b/hw/intc/lm32_pic.c @@ -31,7 +31,8 @@ #define TYPE_LM32_PIC "lm32-pic" typedef struct LM32PicState LM32PicState; -#define LM32_PIC(obj) OBJECT_CHECK(LM32PicState, (obj), TYPE_LM32_PIC) +DECLARE_INSTANCE_CHECKER(LM32PicState, LM32_PIC, + TYPE_LM32_PIC) struct LM32PicState { SysBusDevice parent_obj; diff --git a/hw/intc/nios2_iic.c b/hw/intc/nios2_iic.c index 156139792e..5bc23eab23 100644 --- a/hw/intc/nios2_iic.c +++ b/hw/intc/nios2_iic.c @@ -29,8 +29,8 @@ #define TYPE_ALTERA_IIC "altera,iic" typedef struct AlteraIIC AlteraIIC; -#define ALTERA_IIC(obj) \ - OBJECT_CHECK(AlteraIIC, (obj), TYPE_ALTERA_IIC) +DECLARE_INSTANCE_CHECKER(AlteraIIC, ALTERA_IIC, + TYPE_ALTERA_IIC) struct AlteraIIC { SysBusDevice parent_obj; diff --git a/hw/intc/ompic.c b/hw/intc/ompic.c index 8db109298f..e29d3ef213 100644 --- a/hw/intc/ompic.c +++ b/hw/intc/ompic.c @@ -19,7 +19,8 @@ #define TYPE_OR1K_OMPIC "or1k-ompic" typedef struct OR1KOMPICState OR1KOMPICState; -#define OR1K_OMPIC(obj) OBJECT_CHECK(OR1KOMPICState, (obj), TYPE_OR1K_OMPIC) +DECLARE_INSTANCE_CHECKER(OR1KOMPICState, OR1K_OMPIC, + TYPE_OR1K_OMPIC) #define OMPIC_CTRL_IRQ_ACK (1 << 31) #define OMPIC_CTRL_IRQ_GEN (1 << 30) diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c index 0f67683b1a..de5ba9df4b 100644 --- a/hw/intc/openpic_kvm.c +++ b/hw/intc/openpic_kvm.c @@ -40,8 +40,8 @@ #define GCR_RESET 0x80000000 typedef struct KVMOpenPICState KVMOpenPICState; -#define KVM_OPENPIC(obj) \ - OBJECT_CHECK(KVMOpenPICState, (obj), TYPE_KVM_OPENPIC) +DECLARE_INSTANCE_CHECKER(KVMOpenPICState, KVM_OPENPIC, + TYPE_KVM_OPENPIC) struct KVMOpenPICState { /*< private >*/ diff --git a/hw/intc/pl190.c b/hw/intc/pl190.c index 6fd0d6856b..5c8a56ce47 100644 --- a/hw/intc/pl190.c +++ b/hw/intc/pl190.c @@ -23,7 +23,8 @@ #define TYPE_PL190 "pl190" typedef struct PL190State PL190State; -#define PL190(obj) OBJECT_CHECK(PL190State, (obj), TYPE_PL190) +DECLARE_INSTANCE_CHECKER(PL190State, PL190, + TYPE_PL190) struct PL190State { SysBusDevice parent_obj; diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c index cf8b472639..ac6e82a128 100644 --- a/hw/intc/puv3_intc.c +++ b/hw/intc/puv3_intc.c @@ -21,7 +21,8 @@ #define TYPE_PUV3_INTC "puv3_intc" typedef struct PUV3INTCState PUV3INTCState; -#define PUV3_INTC(obj) OBJECT_CHECK(PUV3INTCState, (obj), TYPE_PUV3_INTC) +DECLARE_INSTANCE_CHECKER(PUV3INTCState, PUV3_INTC, + TYPE_PUV3_INTC) struct PUV3INTCState { SysBusDevice parent_obj; diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c index bac2ac3c13..6f72ed0e0f 100644 --- a/hw/intc/s390_flic_kvm.c +++ b/hw/intc/s390_flic_kvm.c @@ -576,11 +576,9 @@ struct KVMS390FLICStateClass { }; typedef struct KVMS390FLICStateClass KVMS390FLICStateClass; -#define KVM_S390_FLIC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(KVMS390FLICStateClass, (obj), TYPE_KVM_S390_FLIC) +DECLARE_CLASS_CHECKERS(KVMS390FLICStateClass, KVM_S390_FLIC, + TYPE_KVM_S390_FLIC) -#define KVM_S390_FLIC_CLASS(klass) \ - OBJECT_CLASS_CHECK(KVMS390FLICStateClass, (klass), TYPE_KVM_S390_FLIC) static void kvm_s390_flic_realize(DeviceState *dev, Error **errp) { diff --git a/hw/intc/slavio_intctl.c b/hw/intc/slavio_intctl.c index 890a55dbec..847af78d3a 100644 --- a/hw/intc/slavio_intctl.c +++ b/hw/intc/slavio_intctl.c @@ -60,8 +60,8 @@ typedef struct SLAVIO_CPUINTCTLState { #define TYPE_SLAVIO_INTCTL "slavio_intctl" typedef struct SLAVIO_INTCTLState SLAVIO_INTCTLState; -#define SLAVIO_INTCTL(obj) \ - OBJECT_CHECK(SLAVIO_INTCTLState, (obj), TYPE_SLAVIO_INTCTL) +DECLARE_INSTANCE_CHECKER(SLAVIO_INTCTLState, SLAVIO_INTCTL, + TYPE_SLAVIO_INTCTL) struct SLAVIO_INTCTLState { SysBusDevice parent_obj; diff --git a/hw/ipack/tpci200.c b/hw/ipack/tpci200.c index 71dfb046da..81ff6ed8aa 100644 --- a/hw/ipack/tpci200.c +++ b/hw/ipack/tpci200.c @@ -73,8 +73,8 @@ typedef struct TPCI200State TPCI200State; #define TYPE_TPCI200 "tpci200" -#define TPCI200(obj) \ - OBJECT_CHECK(TPCI200State, (obj), TYPE_TPCI200) +DECLARE_INSTANCE_CHECKER(TPCI200State, TPCI200, + TYPE_TPCI200) static const uint8_t local_config_regs[] = { 0x00, 0xFF, 0xFF, 0x0F, 0x00, 0xFC, 0xFF, 0x0F, 0x00, 0x00, 0x00, diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index 018667e0ca..159831cbc5 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -63,8 +63,8 @@ #define TYPE_IPMI_BMC_EXTERN "ipmi-bmc-extern" typedef struct IPMIBmcExtern IPMIBmcExtern; -#define IPMI_BMC_EXTERN(obj) OBJECT_CHECK(IPMIBmcExtern, (obj), \ - TYPE_IPMI_BMC_EXTERN) +DECLARE_INSTANCE_CHECKER(IPMIBmcExtern, IPMI_BMC_EXTERN, + TYPE_IPMI_BMC_EXTERN) struct IPMIBmcExtern { IPMIBmc parent; diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c index f8a38cef74..4304ee9701 100644 --- a/hw/ipmi/isa_ipmi_bt.c +++ b/hw/ipmi/isa_ipmi_bt.c @@ -35,8 +35,8 @@ #define TYPE_ISA_IPMI_BT "isa-ipmi-bt" typedef struct ISAIPMIBTDevice ISAIPMIBTDevice; -#define ISA_IPMI_BT(obj) OBJECT_CHECK(ISAIPMIBTDevice, (obj), \ - TYPE_ISA_IPMI_BT) +DECLARE_INSTANCE_CHECKER(ISAIPMIBTDevice, ISA_IPMI_BT, + TYPE_ISA_IPMI_BT) struct ISAIPMIBTDevice { ISADevice dev; diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c index c2885bafee..ad5fa6cf41 100644 --- a/hw/ipmi/isa_ipmi_kcs.c +++ b/hw/ipmi/isa_ipmi_kcs.c @@ -35,8 +35,8 @@ #define TYPE_ISA_IPMI_KCS "isa-ipmi-kcs" typedef struct ISAIPMIKCSDevice ISAIPMIKCSDevice; -#define ISA_IPMI_KCS(obj) OBJECT_CHECK(ISAIPMIKCSDevice, (obj), \ - TYPE_ISA_IPMI_KCS) +DECLARE_INSTANCE_CHECKER(ISAIPMIKCSDevice, ISA_IPMI_KCS, + TYPE_ISA_IPMI_KCS) struct ISAIPMIKCSDevice { ISADevice dev; diff --git a/hw/ipmi/pci_ipmi_bt.c b/hw/ipmi/pci_ipmi_bt.c index 0a2a04b368..ab87c626ad 100644 --- a/hw/ipmi/pci_ipmi_bt.c +++ b/hw/ipmi/pci_ipmi_bt.c @@ -30,8 +30,8 @@ #define TYPE_PCI_IPMI_BT "pci-ipmi-bt" typedef struct PCIIPMIBTDevice PCIIPMIBTDevice; -#define PCI_IPMI_BT(obj) OBJECT_CHECK(PCIIPMIBTDevice, (obj), \ - TYPE_PCI_IPMI_BT) +DECLARE_INSTANCE_CHECKER(PCIIPMIBTDevice, PCI_IPMI_BT, + TYPE_PCI_IPMI_BT) struct PCIIPMIBTDevice { PCIDevice dev; diff --git a/hw/ipmi/pci_ipmi_kcs.c b/hw/ipmi/pci_ipmi_kcs.c index 2bd5311200..435c4edef4 100644 --- a/hw/ipmi/pci_ipmi_kcs.c +++ b/hw/ipmi/pci_ipmi_kcs.c @@ -30,8 +30,8 @@ #define TYPE_PCI_IPMI_KCS "pci-ipmi-kcs" typedef struct PCIIPMIKCSDevice PCIIPMIKCSDevice; -#define PCI_IPMI_KCS(obj) OBJECT_CHECK(PCIIPMIKCSDevice, (obj), \ - TYPE_PCI_IPMI_KCS) +DECLARE_INSTANCE_CHECKER(PCIIPMIKCSDevice, PCI_IPMI_KCS, + TYPE_PCI_IPMI_KCS) struct PCIIPMIKCSDevice { PCIDevice dev; diff --git a/hw/ipmi/smbus_ipmi.c b/hw/ipmi/smbus_ipmi.c index 45636be1af..a1289cda10 100644 --- a/hw/ipmi/smbus_ipmi.c +++ b/hw/ipmi/smbus_ipmi.c @@ -31,7 +31,8 @@ #define TYPE_SMBUS_IPMI "smbus-ipmi" typedef struct SMBusIPMIDevice SMBusIPMIDevice; -#define SMBUS_IPMI(obj) OBJECT_CHECK(SMBusIPMIDevice, (obj), TYPE_SMBUS_IPMI) +DECLARE_INSTANCE_CHECKER(SMBusIPMIDevice, SMBUS_IPMI, + TYPE_SMBUS_IPMI) #define SSIF_IPMI_REQUEST 2 #define SSIF_IPMI_MULTI_PART_REQUEST_START 6 diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c index e4f62d9d43..2bf7ef0689 100644 --- a/hw/isa/i82378.c +++ b/hw/isa/i82378.c @@ -28,8 +28,8 @@ #define TYPE_I82378 "i82378" typedef struct I82378State I82378State; -#define I82378(obj) \ - OBJECT_CHECK(I82378State, (obj), TYPE_I82378) +DECLARE_INSTANCE_CHECKER(I82378State, I82378, + TYPE_I82378) struct I82378State { PCIDevice parent_obj; diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 95e2046773..0d709ef5e8 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -54,8 +54,8 @@ struct PIIX4State { }; typedef struct PIIX4State PIIX4State; -#define PIIX4_PCI_DEVICE(obj) \ - OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE) +DECLARE_INSTANCE_CHECKER(PIIX4State, PIIX4_PCI_DEVICE, + TYPE_PIIX4_PCI_DEVICE) static void piix4_isa_reset(DeviceState *dev) { diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 872fb6c62e..9fd81fac95 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -51,8 +51,8 @@ struct VT82C686BState { typedef struct VT82C686BState VT82C686BState; #define TYPE_VT82C686B_DEVICE "VT82C686B" -#define VT82C686B_DEVICE(obj) \ - OBJECT_CHECK(VT82C686BState, (obj), TYPE_VT82C686B_DEVICE) +DECLARE_INSTANCE_CHECKER(VT82C686BState, VT82C686B_DEVICE, + TYPE_VT82C686B_DEVICE) static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, unsigned size) @@ -182,16 +182,16 @@ struct VT686MC97State { typedef struct VT686MC97State VT686MC97State; #define TYPE_VT82C686B_PM_DEVICE "VT82C686B_PM" -#define VT82C686B_PM_DEVICE(obj) \ - OBJECT_CHECK(VT686PMState, (obj), TYPE_VT82C686B_PM_DEVICE) +DECLARE_INSTANCE_CHECKER(VT686PMState, VT82C686B_PM_DEVICE, + TYPE_VT82C686B_PM_DEVICE) #define TYPE_VT82C686B_MC97_DEVICE "VT82C686B_MC97" -#define VT82C686B_MC97_DEVICE(obj) \ - OBJECT_CHECK(VT686MC97State, (obj), TYPE_VT82C686B_MC97_DEVICE) +DECLARE_INSTANCE_CHECKER(VT686MC97State, VT82C686B_MC97_DEVICE, + TYPE_VT82C686B_MC97_DEVICE) #define TYPE_VT82C686B_AC97_DEVICE "VT82C686B_AC97" -#define VT82C686B_AC97_DEVICE(obj) \ - OBJECT_CHECK(VT686AC97State, (obj), TYPE_VT82C686B_AC97_DEVICE) +DECLARE_INSTANCE_CHECKER(VT686AC97State, VT82C686B_AC97_DEVICE, + TYPE_VT82C686B_AC97_DEVICE) static void pm_update_sci(VT686PMState *s) { diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c index cc3d4edc20..e73b9a062e 100644 --- a/hw/m68k/mcf_intc.c +++ b/hw/m68k/mcf_intc.c @@ -19,7 +19,8 @@ #define TYPE_MCF_INTC "mcf-intc" typedef struct mcf_intc_state mcf_intc_state; -#define MCF_INTC(obj) OBJECT_CHECK(mcf_intc_state, (obj), TYPE_MCF_INTC) +DECLARE_INSTANCE_CHECKER(mcf_intc_state, MCF_INTC, + TYPE_MCF_INTC) struct mcf_intc_state { SysBusDevice parent_obj; diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 989f990e5e..8a8a1031bf 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -39,7 +39,8 @@ #define TYPE_NEXT_MACHINE MACHINE_TYPE_NAME("next-cube") typedef struct NeXTState NeXTState; -#define NEXT_MACHINE(obj) OBJECT_CHECK(NeXTState, (obj), TYPE_NEXT_MACHINE) +DECLARE_INSTANCE_CHECKER(NeXTState, NEXT_MACHINE, + TYPE_NEXT_MACHINE) #define ENTRY 0x0100001e #define RAM_SIZE 0x4000000 diff --git a/hw/m68k/next-kbd.c b/hw/m68k/next-kbd.c index 955f28661e..3f6b31ae58 100644 --- a/hw/m68k/next-kbd.c +++ b/hw/m68k/next-kbd.c @@ -39,7 +39,8 @@ #include "qom/object.h" typedef struct NextKBDState NextKBDState; -#define NEXTKBD(obj) OBJECT_CHECK(NextKBDState, (obj), TYPE_NEXTKBD) +DECLARE_INSTANCE_CHECKER(NextKBDState, NEXTKBD, + TYPE_NEXTKBD) /* following defintions from next68k netbsd */ #define CSR_INT 0x00800000 diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c index 7a1af64b0a..18a9bf4a5b 100644 --- a/hw/microblaze/xlnx-zynqmp-pmu.c +++ b/hw/microblaze/xlnx-zynqmp-pmu.c @@ -30,8 +30,8 @@ #define TYPE_XLNX_ZYNQMP_PMU_SOC "xlnx,zynqmp-pmu-soc" typedef struct XlnxZynqMPPMUSoCState XlnxZynqMPPMUSoCState; -#define XLNX_ZYNQMP_PMU_SOC(obj) OBJECT_CHECK(XlnxZynqMPPMUSoCState, (obj), \ - TYPE_XLNX_ZYNQMP_PMU_SOC) +DECLARE_INSTANCE_CHECKER(XlnxZynqMPPMUSoCState, XLNX_ZYNQMP_PMU_SOC, + TYPE_XLNX_ZYNQMP_PMU_SOC) #define XLNX_ZYNQMP_PMU_ROM_SIZE 0x8000 #define XLNX_ZYNQMP_PMU_ROM_ADDR 0xFFD00000 diff --git a/hw/mips/boston.c b/hw/mips/boston.c index b09407217c..eac4e5bfa2 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -45,7 +45,8 @@ #define TYPE_MIPS_BOSTON "mips-boston" typedef struct BostonState BostonState; -#define BOSTON(obj) OBJECT_CHECK(BostonState, (obj), TYPE_MIPS_BOSTON) +DECLARE_INSTANCE_CHECKER(BostonState, BOSTON, + TYPE_MIPS_BOSTON) struct BostonState { SysBusDevice parent_obj; diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index 553f227c3b..676fc6dec8 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -232,8 +232,8 @@ #define TYPE_GT64120_PCI_HOST_BRIDGE "gt64120" typedef struct GT64120State GT64120State; -#define GT64120_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(GT64120State, (obj), TYPE_GT64120_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(GT64120State, GT64120_PCI_HOST_BRIDGE, + TYPE_GT64120_PCI_HOST_BRIDGE) struct GT64120State { PCIHostState parent_obj; diff --git a/hw/mips/malta.c b/hw/mips/malta.c index a6135503ab..0b36b761c2 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -90,7 +90,8 @@ typedef struct { #define TYPE_MIPS_MALTA "mips-malta" typedef struct MaltaState MaltaState; -#define MIPS_MALTA(obj) OBJECT_CHECK(MaltaState, (obj), TYPE_MIPS_MALTA) +DECLARE_INSTANCE_CHECKER(MaltaState, MIPS_MALTA, + TYPE_MIPS_MALTA) struct MaltaState { SysBusDevice parent_obj; diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c index 45c3a17919..280a7bda5a 100644 --- a/hw/misc/applesmc.c +++ b/hw/misc/applesmc.c @@ -91,7 +91,8 @@ struct AppleSMCData { }; typedef struct AppleSMCState AppleSMCState; -#define APPLE_SMC(obj) OBJECT_CHECK(AppleSMCState, (obj), TYPE_APPLE_SMC) +DECLARE_INSTANCE_CHECKER(AppleSMCState, APPLE_SMC, + TYPE_APPLE_SMC) struct AppleSMCState { ISADevice parent_obj; diff --git a/hw/misc/arm_integrator_debug.c b/hw/misc/arm_integrator_debug.c index b39fe10c6f..c25519c4d6 100644 --- a/hw/misc/arm_integrator_debug.c +++ b/hw/misc/arm_integrator_debug.c @@ -22,8 +22,8 @@ #include "qom/object.h" typedef struct IntegratorDebugState IntegratorDebugState; -#define INTEGRATOR_DEBUG(obj) \ - OBJECT_CHECK(IntegratorDebugState, (obj), TYPE_INTEGRATOR_DEBUG) +DECLARE_INSTANCE_CHECKER(IntegratorDebugState, INTEGRATOR_DEBUG, + TYPE_INTEGRATOR_DEBUG) struct IntegratorDebugState { SysBusDevice parent_obj; diff --git a/hw/misc/arm_l2x0.c b/hw/misc/arm_l2x0.c index ff8e999beb..dc42f61fd5 100644 --- a/hw/misc/arm_l2x0.c +++ b/hw/misc/arm_l2x0.c @@ -31,7 +31,8 @@ #define TYPE_ARM_L2X0 "l2x0" typedef struct L2x0State L2x0State; -#define ARM_L2X0(obj) OBJECT_CHECK(L2x0State, (obj), TYPE_ARM_L2X0) +DECLARE_INSTANCE_CHECKER(L2x0State, ARM_L2X0, + TYPE_ARM_L2X0) struct L2x0State { SysBusDevice parent_obj; diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c index b905d2d48a..a3e0a55060 100644 --- a/hw/misc/arm_sysctl.c +++ b/hw/misc/arm_sysctl.c @@ -24,8 +24,8 @@ #define TYPE_ARM_SYSCTL "realview_sysctl" typedef struct arm_sysctl_state arm_sysctl_state; -#define ARM_SYSCTL(obj) \ - OBJECT_CHECK(arm_sysctl_state, (obj), TYPE_ARM_SYSCTL) +DECLARE_INSTANCE_CHECKER(arm_sysctl_state, ARM_SYSCTL, + TYPE_ARM_SYSCTL) struct arm_sysctl_state { SysBusDevice parent_obj; diff --git a/hw/misc/debugexit.c b/hw/misc/debugexit.c index 1aff146f5e..b57a02d288 100644 --- a/hw/misc/debugexit.c +++ b/hw/misc/debugexit.c @@ -15,8 +15,8 @@ #define TYPE_ISA_DEBUG_EXIT_DEVICE "isa-debug-exit" typedef struct ISADebugExitState ISADebugExitState; -#define ISA_DEBUG_EXIT_DEVICE(obj) \ - OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE) +DECLARE_INSTANCE_CHECKER(ISADebugExitState, ISA_DEBUG_EXIT_DEVICE, + TYPE_ISA_DEBUG_EXIT_DEVICE) struct ISADebugExitState { ISADevice parent_obj; diff --git a/hw/misc/eccmemctl.c b/hw/misc/eccmemctl.c index e54c6abda8..846934340d 100644 --- a/hw/misc/eccmemctl.c +++ b/hw/misc/eccmemctl.c @@ -128,7 +128,8 @@ #define TYPE_ECC_MEMCTL "eccmemctl" typedef struct ECCState ECCState; -#define ECC_MEMCTL(obj) OBJECT_CHECK(ECCState, (obj), TYPE_ECC_MEMCTL) +DECLARE_INSTANCE_CHECKER(ECCState, ECC_MEMCTL, + TYPE_ECC_MEMCTL) struct ECCState { SysBusDevice parent_obj; diff --git a/hw/misc/edu.c b/hw/misc/edu.c index 2db9d63eeb..0ff9d1ac78 100644 --- a/hw/misc/edu.c +++ b/hw/misc/edu.c @@ -35,7 +35,8 @@ #define TYPE_PCI_EDU_DEVICE "edu" typedef struct EduState EduState; -#define EDU(obj) OBJECT_CHECK(EduState, obj, TYPE_PCI_EDU_DEVICE) +DECLARE_INSTANCE_CHECKER(EduState, EDU, + TYPE_PCI_EDU_DEVICE) #define FACT_IRQ 0x00000001 #define DMA_IRQ 0x00000100 diff --git a/hw/misc/empty_slot.c b/hw/misc/empty_slot.c index 50cfd0e871..8c18295f7a 100644 --- a/hw/misc/empty_slot.c +++ b/hw/misc/empty_slot.c @@ -19,7 +19,8 @@ #define TYPE_EMPTY_SLOT "empty_slot" typedef struct EmptySlot EmptySlot; -#define EMPTY_SLOT(obj) OBJECT_CHECK(EmptySlot, (obj), TYPE_EMPTY_SLOT) +DECLARE_INSTANCE_CHECKER(EmptySlot, EMPTY_SLOT, + TYPE_EMPTY_SLOT) struct EmptySlot { SysBusDevice parent_obj; diff --git a/hw/misc/exynos4210_clk.c b/hw/misc/exynos4210_clk.c index f84008d4d8..e8b4339065 100644 --- a/hw/misc/exynos4210_clk.c +++ b/hw/misc/exynos4210_clk.c @@ -26,8 +26,8 @@ #define TYPE_EXYNOS4210_CLK "exynos4210.clk" typedef struct Exynos4210ClkState Exynos4210ClkState; -#define EXYNOS4210_CLK(obj) \ - OBJECT_CHECK(Exynos4210ClkState, (obj), TYPE_EXYNOS4210_CLK) +DECLARE_INSTANCE_CHECKER(Exynos4210ClkState, EXYNOS4210_CLK, + TYPE_EXYNOS4210_CLK) #define CLK_PLL_LOCKED BIT(29) diff --git a/hw/misc/exynos4210_pmu.c b/hw/misc/exynos4210_pmu.c index 8f6081e5cc..aed854bc96 100644 --- a/hw/misc/exynos4210_pmu.c +++ b/hw/misc/exynos4210_pmu.c @@ -396,8 +396,8 @@ static const Exynos4210PmuReg exynos4210_pmu_regs[] = { #define TYPE_EXYNOS4210_PMU "exynos4210.pmu" typedef struct Exynos4210PmuState Exynos4210PmuState; -#define EXYNOS4210_PMU(obj) \ - OBJECT_CHECK(Exynos4210PmuState, (obj), TYPE_EXYNOS4210_PMU) +DECLARE_INSTANCE_CHECKER(Exynos4210PmuState, EXYNOS4210_PMU, + TYPE_EXYNOS4210_PMU) struct Exynos4210PmuState { SysBusDevice parent_obj; diff --git a/hw/misc/exynos4210_rng.c b/hw/misc/exynos4210_rng.c index 620b6a867b..5073fdb763 100644 --- a/hw/misc/exynos4210_rng.c +++ b/hw/misc/exynos4210_rng.c @@ -37,8 +37,8 @@ #define TYPE_EXYNOS4210_RNG "exynos4210.rng" typedef struct Exynos4210RngState Exynos4210RngState; -#define EXYNOS4210_RNG(obj) \ - OBJECT_CHECK(Exynos4210RngState, (obj), TYPE_EXYNOS4210_RNG) +DECLARE_INSTANCE_CHECKER(Exynos4210RngState, EXYNOS4210_RNG, + TYPE_EXYNOS4210_RNG) /* * Exynos4220, PRNG, only polling mode is supported. diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 890cd9445d..89db397061 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -59,20 +59,20 @@ #define TYPE_IVSHMEM_COMMON "ivshmem-common" typedef struct IVShmemState IVShmemState; -#define IVSHMEM_COMMON(obj) \ - OBJECT_CHECK(IVShmemState, (obj), TYPE_IVSHMEM_COMMON) +DECLARE_INSTANCE_CHECKER(IVShmemState, IVSHMEM_COMMON, + TYPE_IVSHMEM_COMMON) #define TYPE_IVSHMEM_PLAIN "ivshmem-plain" -#define IVSHMEM_PLAIN(obj) \ - OBJECT_CHECK(IVShmemState, (obj), TYPE_IVSHMEM_PLAIN) +DECLARE_INSTANCE_CHECKER(IVShmemState, IVSHMEM_PLAIN, + TYPE_IVSHMEM_PLAIN) #define TYPE_IVSHMEM_DOORBELL "ivshmem-doorbell" -#define IVSHMEM_DOORBELL(obj) \ - OBJECT_CHECK(IVShmemState, (obj), TYPE_IVSHMEM_DOORBELL) +DECLARE_INSTANCE_CHECKER(IVShmemState, IVSHMEM_DOORBELL, + TYPE_IVSHMEM_DOORBELL) #define TYPE_IVSHMEM "ivshmem" -#define IVSHMEM(obj) \ - OBJECT_CHECK(IVShmemState, (obj), TYPE_IVSHMEM) +DECLARE_INSTANCE_CHECKER(IVShmemState, IVSHMEM, + TYPE_IVSHMEM) typedef struct Peer { int nb_eventfds; diff --git a/hw/misc/milkymist-hpdmc.c b/hw/misc/milkymist-hpdmc.c index 64e226e5f9..ce9ebeb07f 100644 --- a/hw/misc/milkymist-hpdmc.c +++ b/hw/misc/milkymist-hpdmc.c @@ -45,8 +45,8 @@ enum { #define TYPE_MILKYMIST_HPDMC "milkymist-hpdmc" typedef struct MilkymistHpdmcState MilkymistHpdmcState; -#define MILKYMIST_HPDMC(obj) \ - OBJECT_CHECK(MilkymistHpdmcState, (obj), TYPE_MILKYMIST_HPDMC) +DECLARE_INSTANCE_CHECKER(MilkymistHpdmcState, MILKYMIST_HPDMC, + TYPE_MILKYMIST_HPDMC) struct MilkymistHpdmcState { SysBusDevice parent_obj; diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c index 43b85b88fc..ff1f8e1910 100644 --- a/hw/misc/milkymist-pfpu.c +++ b/hw/misc/milkymist-pfpu.c @@ -122,8 +122,8 @@ static const char *opcode_to_str[] = { #define TYPE_MILKYMIST_PFPU "milkymist-pfpu" typedef struct MilkymistPFPUState MilkymistPFPUState; -#define MILKYMIST_PFPU(obj) \ - OBJECT_CHECK(MilkymistPFPUState, (obj), TYPE_MILKYMIST_PFPU) +DECLARE_INSTANCE_CHECKER(MilkymistPFPUState, MILKYMIST_PFPU, + TYPE_MILKYMIST_PFPU) struct MilkymistPFPUState { SysBusDevice parent_obj; diff --git a/hw/misc/mst_fpga.c b/hw/misc/mst_fpga.c index 5a5c7e814a..7b91c730c0 100644 --- a/hw/misc/mst_fpga.c +++ b/hw/misc/mst_fpga.c @@ -42,8 +42,8 @@ #define TYPE_MAINSTONE_FPGA "mainstone-fpga" typedef struct mst_irq_state mst_irq_state; -#define MAINSTONE_FPGA(obj) \ - OBJECT_CHECK(mst_irq_state, (obj), TYPE_MAINSTONE_FPGA) +DECLARE_INSTANCE_CHECKER(mst_irq_state, MAINSTONE_FPGA, + TYPE_MAINSTONE_FPGA) struct mst_irq_state { SysBusDevice parent_obj; diff --git a/hw/misc/pc-testdev.c b/hw/misc/pc-testdev.c index 275740762e..ea705ba4c9 100644 --- a/hw/misc/pc-testdev.c +++ b/hw/misc/pc-testdev.c @@ -57,8 +57,8 @@ struct PCTestdev { typedef struct PCTestdev PCTestdev; #define TYPE_TESTDEV "pc-testdev" -#define TESTDEV(obj) \ - OBJECT_CHECK(PCTestdev, (obj), TYPE_TESTDEV) +DECLARE_INSTANCE_CHECKER(PCTestdev, TESTDEV, + TYPE_TESTDEV) static uint64_t test_irq_line_read(void *opaque, hwaddr addr, unsigned size) { diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c index 597c390639..c714bc7717 100644 --- a/hw/misc/pca9552.c +++ b/hw/misc/pca9552.c @@ -34,10 +34,8 @@ struct PCA955xClass { }; typedef struct PCA955xClass PCA955xClass; -#define PCA955X_CLASS(klass) \ - OBJECT_CLASS_CHECK(PCA955xClass, (klass), TYPE_PCA955X) -#define PCA955X_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PCA955xClass, (obj), TYPE_PCA955X) +DECLARE_CLASS_CHECKERS(PCA955xClass, PCA955X, + TYPE_PCA955X) #define PCA9552_LED_ON 0x0 #define PCA9552_LED_OFF 0x1 diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c index 9e524507f2..4c33453087 100644 --- a/hw/misc/pci-testdev.c +++ b/hw/misc/pci-testdev.c @@ -96,8 +96,8 @@ typedef struct PCITestDevState PCITestDevState; #define TYPE_PCI_TEST_DEV "pci-testdev" -#define PCI_TEST_DEV(obj) \ - OBJECT_CHECK(PCITestDevState, (obj), TYPE_PCI_TEST_DEV) +DECLARE_INSTANCE_CHECKER(PCITestDevState, PCI_TEST_DEV, + TYPE_PCI_TEST_DEV) #define IOTEST_IS_MEM(i) (strcmp(IOTEST_TYPE(i), "portio")) #define IOTEST_REGION(d, i) (IOTEST_IS_MEM(i) ? &(d)->mmio : &(d)->portio) diff --git a/hw/misc/puv3_pm.c b/hw/misc/puv3_pm.c index 811424a1a7..244b1819b2 100644 --- a/hw/misc/puv3_pm.c +++ b/hw/misc/puv3_pm.c @@ -20,7 +20,8 @@ #define TYPE_PUV3_PM "puv3_pm" typedef struct PUV3PMState PUV3PMState; -#define PUV3_PM(obj) OBJECT_CHECK(PUV3PMState, (obj), TYPE_PUV3_PM) +DECLARE_INSTANCE_CHECKER(PUV3PMState, PUV3_PM, + TYPE_PUV3_PM) struct PUV3PMState { SysBusDevice parent_obj; diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index be2ab91832..7e45b16026 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -31,8 +31,8 @@ #define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) typedef struct PVPanicState PVPanicState; -#define ISA_PVPANIC_DEVICE(obj) \ - OBJECT_CHECK(PVPanicState, (obj), TYPE_PVPANIC) +DECLARE_INSTANCE_CHECKER(PVPanicState, ISA_PVPANIC_DEVICE, + TYPE_PVPANIC) static void handle_event(int event) { diff --git a/hw/misc/sga.c b/hw/misc/sga.c index a2167a9a97..a2734f8b9f 100644 --- a/hw/misc/sga.c +++ b/hw/misc/sga.c @@ -35,7 +35,8 @@ #define TYPE_SGA "sga" typedef struct ISASGAState ISASGAState; -#define SGA(obj) OBJECT_CHECK(ISASGAState, (obj), TYPE_SGA) +DECLARE_INSTANCE_CHECKER(ISASGAState, SGA, + TYPE_SGA) struct ISASGAState { ISADevice parent_obj; diff --git a/hw/misc/slavio_misc.c b/hw/misc/slavio_misc.c index ee735137de..a1ad1fe60b 100644 --- a/hw/misc/slavio_misc.c +++ b/hw/misc/slavio_misc.c @@ -41,7 +41,8 @@ #define TYPE_SLAVIO_MISC "slavio_misc" typedef struct MiscState MiscState; -#define SLAVIO_MISC(obj) OBJECT_CHECK(MiscState, (obj), TYPE_SLAVIO_MISC) +DECLARE_INSTANCE_CHECKER(MiscState, SLAVIO_MISC, + TYPE_SLAVIO_MISC) struct MiscState { SysBusDevice parent_obj; @@ -65,7 +66,8 @@ struct MiscState { #define TYPE_APC "apc" typedef struct APCState APCState; -#define APC(obj) OBJECT_CHECK(APCState, (obj), TYPE_APC) +DECLARE_INSTANCE_CHECKER(APCState, APC, + TYPE_APC) struct APCState { SysBusDevice parent_obj; diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c index 19026b3662..62d35eb5ae 100644 --- a/hw/misc/tmp421.c +++ b/hw/misc/tmp421.c @@ -74,12 +74,9 @@ struct TMP421Class { typedef struct TMP421Class TMP421Class; #define TYPE_TMP421 "tmp421-generic" -#define TMP421(obj) OBJECT_CHECK(TMP421State, (obj), TYPE_TMP421) +DECLARE_OBJ_CHECKERS(TMP421State, TMP421Class, + TMP421, TYPE_TMP421) -#define TMP421_CLASS(klass) \ - OBJECT_CLASS_CHECK(TMP421Class, (klass), TYPE_TMP421) -#define TMP421_GET_CLASS(obj) \ - OBJECT_GET_CLASS(TMP421Class, (obj), TYPE_TMP421) /* the TMP421 registers */ #define TMP421_STATUS_REG 0x08 diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c index ed7edbafcc..0ccacd8fe1 100644 --- a/hw/misc/zynq_slcr.c +++ b/hw/misc/zynq_slcr.c @@ -184,7 +184,8 @@ REG32(DDRIOB, 0xb40) #define TYPE_ZYNQ_SLCR "xilinx,zynq_slcr" typedef struct ZynqSLCRState ZynqSLCRState; -#define ZYNQ_SLCR(obj) OBJECT_CHECK(ZynqSLCRState, (obj), TYPE_ZYNQ_SLCR) +DECLARE_INSTANCE_CHECKER(ZynqSLCRState, ZYNQ_SLCR, + TYPE_ZYNQ_SLCR) struct ZynqSLCRState { SysBusDevice parent_obj; diff --git a/hw/net/can/can_kvaser_pci.c b/hw/net/can/can_kvaser_pci.c index 52fa81d76d..3890e3991f 100644 --- a/hw/net/can/can_kvaser_pci.c +++ b/hw/net/can/can_kvaser_pci.c @@ -48,8 +48,8 @@ #define TYPE_CAN_PCI_DEV "kvaser_pci" typedef struct KvaserPCIState KvaserPCIState; -#define KVASER_PCI_DEV(obj) \ - OBJECT_CHECK(KvaserPCIState, (obj), TYPE_CAN_PCI_DEV) +DECLARE_INSTANCE_CHECKER(KvaserPCIState, KVASER_PCI_DEV, + TYPE_CAN_PCI_DEV) #ifndef KVASER_PCI_VENDOR_ID1 #define KVASER_PCI_VENDOR_ID1 0x10e8 /* the PCI device and vendor IDs */ diff --git a/hw/net/can/can_mioe3680_pci.c b/hw/net/can/can_mioe3680_pci.c index 28cbfb79ec..d647cd82c4 100644 --- a/hw/net/can/can_mioe3680_pci.c +++ b/hw/net/can/can_mioe3680_pci.c @@ -44,8 +44,8 @@ #define TYPE_CAN_PCI_DEV "mioe3680_pci" typedef struct Mioe3680PCIState Mioe3680PCIState; -#define MIOe3680_PCI_DEV(obj) \ - OBJECT_CHECK(Mioe3680PCIState, (obj), TYPE_CAN_PCI_DEV) +DECLARE_INSTANCE_CHECKER(Mioe3680PCIState, MIOe3680_PCI_DEV, + TYPE_CAN_PCI_DEV) /* the PCI device and vendor IDs */ #ifndef MIOe3680_PCI_VENDOR_ID1 diff --git a/hw/net/can/can_pcm3680_pci.c b/hw/net/can/can_pcm3680_pci.c index aeaebd3562..0d3c2ee491 100644 --- a/hw/net/can/can_pcm3680_pci.c +++ b/hw/net/can/can_pcm3680_pci.c @@ -44,8 +44,8 @@ #define TYPE_CAN_PCI_DEV "pcm3680_pci" typedef struct Pcm3680iPCIState Pcm3680iPCIState; -#define PCM3680i_PCI_DEV(obj) \ - OBJECT_CHECK(Pcm3680iPCIState, (obj), TYPE_CAN_PCI_DEV) +DECLARE_INSTANCE_CHECKER(Pcm3680iPCIState, PCM3680i_PCI_DEV, + TYPE_CAN_PCI_DEV) /* the PCI device and vendor IDs */ #ifndef PCM3680i_PCI_VENDOR_ID1 diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index e20780d0ae..2a427c2acb 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -152,7 +152,8 @@ do { printf("sonic ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0) #define TYPE_DP8393X "dp8393x" typedef struct dp8393xState dp8393xState; -#define DP8393X(obj) OBJECT_CHECK(dp8393xState, (obj), TYPE_DP8393X) +DECLARE_INSTANCE_CHECKER(dp8393xState, DP8393X, + TYPE_DP8393X) struct dp8393xState { SysBusDevice parent_obj; diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 2ec24acad3..19cb026028 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -151,13 +151,9 @@ typedef struct E1000BaseClass E1000BaseClass; #define TYPE_E1000_BASE "e1000-base" -#define E1000(obj) \ - OBJECT_CHECK(E1000State, (obj), TYPE_E1000_BASE) +DECLARE_OBJ_CHECKERS(E1000State, E1000BaseClass, + E1000, TYPE_E1000_BASE) -#define E1000_CLASS(klass) \ - OBJECT_CLASS_CHECK(E1000BaseClass, (klass), TYPE_E1000_BASE) -#define E1000_GET_CLASS(obj) \ - OBJECT_GET_CLASS(E1000BaseClass, (obj), TYPE_E1000_BASE) static void e1000_link_up(E1000State *s) diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index 2bbefc89de..1691540963 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -57,7 +57,8 @@ #define TYPE_E1000E "e1000e" typedef struct E1000EState E1000EState; -#define E1000E(obj) OBJECT_CHECK(E1000EState, (obj), TYPE_E1000E) +DECLARE_INSTANCE_CHECKER(E1000EState, E1000E, + TYPE_E1000E) struct E1000EState { PCIDevice parent_obj; diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c index ca5e5dd805..a9c86fabab 100644 --- a/hw/net/etraxfs_eth.c +++ b/hw/net/etraxfs_eth.c @@ -325,8 +325,8 @@ static void mdio_cycle(struct qemu_mdio *bus) #define TYPE_ETRAX_FS_ETH "etraxfs-eth" typedef struct ETRAXFSEthState ETRAXFSEthState; -#define ETRAX_FS_ETH(obj) \ - OBJECT_CHECK(ETRAXFSEthState, (obj), TYPE_ETRAX_FS_ETH) +DECLARE_INSTANCE_CHECKER(ETRAXFSEthState, ETRAX_FS_ETH, + TYPE_ETRAX_FS_ETH) struct ETRAXFSEthState { SysBusDevice parent_obj; diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 4eb9f68200..864408b06a 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -182,7 +182,8 @@ static const VMStateDescription vmstate_lan9118_packet = { }; typedef struct lan9118_state lan9118_state; -#define LAN9118(obj) OBJECT_CHECK(lan9118_state, (obj), TYPE_LAN9118) +DECLARE_INSTANCE_CHECKER(lan9118_state, LAN9118, + TYPE_LAN9118) struct lan9118_state { SysBusDevice parent_obj; diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c index e042970ba6..b92597ca63 100644 --- a/hw/net/milkymist-minimac2.c +++ b/hw/net/milkymist-minimac2.c @@ -100,8 +100,8 @@ typedef struct MilkymistMinimac2MdioState MilkymistMinimac2MdioState; #define TYPE_MILKYMIST_MINIMAC2 "milkymist-minimac2" typedef struct MilkymistMinimac2State MilkymistMinimac2State; -#define MILKYMIST_MINIMAC2(obj) \ - OBJECT_CHECK(MilkymistMinimac2State, (obj), TYPE_MILKYMIST_MINIMAC2) +DECLARE_INSTANCE_CHECKER(MilkymistMinimac2State, MILKYMIST_MINIMAC2, + TYPE_MILKYMIST_MINIMAC2) struct MilkymistMinimac2State { SysBusDevice parent_obj; diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c index f58f3f83bd..3386e432c9 100644 --- a/hw/net/mipsnet.c +++ b/hw/net/mipsnet.c @@ -26,7 +26,8 @@ #define TYPE_MIPS_NET "mipsnet" typedef struct MIPSnetState MIPSnetState; -#define MIPS_NET(obj) OBJECT_CHECK(MIPSnetState, (obj), TYPE_MIPS_NET) +DECLARE_INSTANCE_CHECKER(MIPSnetState, MIPS_NET, + TYPE_MIPS_NET) struct MIPSnetState { SysBusDevice parent_obj; diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c index aa20a0d702..cc4db30cfc 100644 --- a/hw/net/ne2000-isa.c +++ b/hw/net/ne2000-isa.c @@ -34,7 +34,8 @@ #include "qom/object.h" typedef struct ISANE2000State ISANE2000State; -#define ISA_NE2000(obj) OBJECT_CHECK(ISANE2000State, (obj), TYPE_ISA_NE2000) +DECLARE_INSTANCE_CHECKER(ISANE2000State, ISA_NE2000, + TYPE_ISA_NE2000) struct ISANE2000State { ISADevice parent_obj; diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c index f92008c3d1..e3b2db8f4e 100644 --- a/hw/net/opencores_eth.c +++ b/hw/net/opencores_eth.c @@ -273,7 +273,8 @@ typedef struct desc { #define TYPE_OPEN_ETH "open_eth" typedef struct OpenEthState OpenEthState; -#define OPEN_ETH(obj) OBJECT_CHECK(OpenEthState, (obj), TYPE_OPEN_ETH) +DECLARE_INSTANCE_CHECKER(OpenEthState, OPEN_ETH, + TYPE_OPEN_ETH) struct OpenEthState { SysBusDevice parent_obj; diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c index bc553e3c4a..b02132ca2f 100644 --- a/hw/net/pcnet-pci.c +++ b/hw/net/pcnet-pci.c @@ -53,8 +53,8 @@ #define TYPE_PCI_PCNET "pcnet" typedef struct PCIPCNetState PCIPCNetState; -#define PCI_PCNET(obj) \ - OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PCNET) +DECLARE_INSTANCE_CHECKER(PCIPCNetState, PCI_PCNET, + TYPE_PCI_PCNET) struct PCIPCNetState { /*< private >*/ diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 78d652a331..9e0c6d53dc 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -95,8 +95,8 @@ static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char *fmt, ...) #define TYPE_RTL8139 "rtl8139" typedef struct RTL8139State RTL8139State; -#define RTL8139(obj) \ - OBJECT_CHECK(RTL8139State, (obj), TYPE_RTL8139) +DECLARE_INSTANCE_CHECKER(RTL8139State, RTL8139, + TYPE_RTL8139) /* Symbolic offsets to registers. */ enum RTL8139_registers { diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c index cfbf7dc867..42768a731e 100644 --- a/hw/net/smc91c111.c +++ b/hw/net/smc91c111.c @@ -26,7 +26,8 @@ #define TYPE_SMC91C111 "smc91c111" typedef struct smc91c111_state smc91c111_state; -#define SMC91C111(obj) OBJECT_CHECK(smc91c111_state, (obj), TYPE_SMC91C111) +DECLARE_INSTANCE_CHECKER(smc91c111_state, SMC91C111, + TYPE_SMC91C111) struct smc91c111_state { SysBusDevice parent_obj; diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index 3dc35bfb7e..4ed03a1fa7 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -86,8 +86,8 @@ typedef uint64_t vlan_bd_t; #define TYPE_VIO_SPAPR_VLAN_DEVICE "spapr-vlan" typedef struct SpaprVioVlan SpaprVioVlan; -#define VIO_SPAPR_VLAN_DEVICE(obj) \ - OBJECT_CHECK(SpaprVioVlan, (obj), TYPE_VIO_SPAPR_VLAN_DEVICE) +DECLARE_INSTANCE_CHECKER(SpaprVioVlan, VIO_SPAPR_VLAN_DEVICE, + TYPE_VIO_SPAPR_VLAN_DEVICE) #define RX_POOL_MAX_BDS 4096 #define RX_MAX_POOLS 5 diff --git a/hw/net/stellaris_enet.c b/hw/net/stellaris_enet.c index 6708b99bbb..7093b8190c 100644 --- a/hw/net/stellaris_enet.c +++ b/hw/net/stellaris_enet.c @@ -52,8 +52,8 @@ do { fprintf(stderr, "stellaris_enet: error: " fmt , ## __VA_ARGS__);} while (0) #define TYPE_STELLARIS_ENET "stellaris_enet" typedef struct stellaris_enet_state stellaris_enet_state; -#define STELLARIS_ENET(obj) \ - OBJECT_CHECK(stellaris_enet_state, (obj), TYPE_STELLARIS_ENET) +DECLARE_INSTANCE_CHECKER(stellaris_enet_state, STELLARIS_ENET, + TYPE_STELLARIS_ENET) typedef struct { uint8_t data[2048]; diff --git a/hw/net/sungem.c b/hw/net/sungem.c index 929ce13b9e..eb358f8f88 100644 --- a/hw/net/sungem.c +++ b/hw/net/sungem.c @@ -24,7 +24,8 @@ #define TYPE_SUNGEM "sungem" typedef struct SunGEMState SunGEMState; -#define SUNGEM(obj) OBJECT_CHECK(SunGEMState, (obj), TYPE_SUNGEM) +DECLARE_INSTANCE_CHECKER(SunGEMState, SUNGEM, + TYPE_SUNGEM) #define MAX_PACKET_SIZE 9016 diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c index 832cdfd0c2..e28ceb61fa 100644 --- a/hw/net/sunhme.c +++ b/hw/net/sunhme.c @@ -131,7 +131,8 @@ #define TYPE_SUNHME "sunhme" typedef struct SunHMEState SunHMEState; -#define SUNHME(obj) OBJECT_CHECK(SunHMEState, (obj), TYPE_SUNHME) +DECLARE_INSTANCE_CHECKER(SunHMEState, SUNHME, + TYPE_SUNHME) /* Maximum size of buffer */ #define HME_FIFO_SIZE 0x800 diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index c599639a28..614f731a0d 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -135,10 +135,8 @@ struct VMXNET3Class { }; typedef struct VMXNET3Class VMXNET3Class; -#define VMXNET3_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VMXNET3Class, (klass), TYPE_VMXNET3) -#define VMXNET3_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VMXNET3Class, (obj), TYPE_VMXNET3) +DECLARE_CLASS_CHECKERS(VMXNET3Class, VMXNET3_DEVICE, + TYPE_VMXNET3) static inline void vmxnet3_ring_init(PCIDevice *d, Vmxnet3Ring *ring, diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c index 9ccb95a4d9..c2c7c34268 100644 --- a/hw/net/xgmac.c +++ b/hw/net/xgmac.c @@ -141,7 +141,8 @@ typedef struct RxTxStats { #define TYPE_XGMAC "xgmac" typedef struct XgmacState XgmacState; -#define XGMAC(obj) OBJECT_CHECK(XgmacState, (obj), TYPE_XGMAC) +DECLARE_INSTANCE_CHECKER(XgmacState, XGMAC, + TYPE_XGMAC) struct XgmacState { SysBusDevice parent_obj; diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 40980e9a29..fa44c608f8 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -44,17 +44,15 @@ #define TYPE_XILINX_AXI_ENET_CONTROL_STREAM "xilinx-axienet-control-stream" typedef struct XilinxAXIEnet XilinxAXIEnet; -#define XILINX_AXI_ENET(obj) \ - OBJECT_CHECK(XilinxAXIEnet, (obj), TYPE_XILINX_AXI_ENET) +DECLARE_INSTANCE_CHECKER(XilinxAXIEnet, XILINX_AXI_ENET, + TYPE_XILINX_AXI_ENET) typedef struct XilinxAXIEnetStreamSlave XilinxAXIEnetStreamSlave; -#define XILINX_AXI_ENET_DATA_STREAM(obj) \ - OBJECT_CHECK(XilinxAXIEnetStreamSlave, (obj),\ - TYPE_XILINX_AXI_ENET_DATA_STREAM) +DECLARE_INSTANCE_CHECKER(XilinxAXIEnetStreamSlave, XILINX_AXI_ENET_DATA_STREAM, + TYPE_XILINX_AXI_ENET_DATA_STREAM) -#define XILINX_AXI_ENET_CONTROL_STREAM(obj) \ - OBJECT_CHECK(XilinxAXIEnetStreamSlave, (obj),\ - TYPE_XILINX_AXI_ENET_CONTROL_STREAM) +DECLARE_INSTANCE_CHECKER(XilinxAXIEnetStreamSlave, XILINX_AXI_ENET_CONTROL_STREAM, + TYPE_XILINX_AXI_ENET_CONTROL_STREAM) /* Advertisement control register. */ #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ diff --git a/hw/nvram/ds1225y.c b/hw/nvram/ds1225y.c index 9c35f5ea27..6f12ca005e 100644 --- a/hw/nvram/ds1225y.c +++ b/hw/nvram/ds1225y.c @@ -111,7 +111,8 @@ static const VMStateDescription vmstate_nvram = { #define TYPE_DS1225Y "ds1225y" typedef struct SysBusNvRamState SysBusNvRamState; -#define DS1225Y(obj) OBJECT_CHECK(SysBusNvRamState, (obj), TYPE_DS1225Y) +DECLARE_INSTANCE_CHECKER(SysBusNvRamState, DS1225Y, + TYPE_DS1225Y) struct SysBusNvRamState { SysBusDevice parent_obj; diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c index 7a76ab27aa..f7d6c96b57 100644 --- a/hw/nvram/eeprom_at24c.c +++ b/hw/nvram/eeprom_at24c.c @@ -29,7 +29,8 @@ #define TYPE_AT24C_EE "at24c-eeprom" typedef struct EEPROMState EEPROMState; -#define AT24C_EE(obj) OBJECT_CHECK(EEPROMState, (obj), TYPE_AT24C_EE) +DECLARE_INSTANCE_CHECKER(EEPROMState, AT24C_EE, + TYPE_AT24C_EE) struct EEPROMState { I2CSlave parent_obj; diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c index df1a804b8f..17c9124abc 100644 --- a/hw/nvram/spapr_nvram.c +++ b/hw/nvram/spapr_nvram.c @@ -51,8 +51,8 @@ struct SpaprNvram { typedef struct SpaprNvram SpaprNvram; #define TYPE_VIO_SPAPR_NVRAM "spapr-nvram" -#define VIO_SPAPR_NVRAM(obj) \ - OBJECT_CHECK(SpaprNvram, (obj), TYPE_VIO_SPAPR_NVRAM) +DECLARE_INSTANCE_CHECKER(SpaprNvram, VIO_SPAPR_NVRAM, + TYPE_VIO_SPAPR_NVRAM) #define MIN_NVRAM_SIZE (8 * KiB) #define DEFAULT_NVRAM_SIZE (64 * KiB) diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c index 91e24f68c8..d6db5bf9dc 100644 --- a/hw/pci-bridge/dec.c +++ b/hw/pci-bridge/dec.c @@ -35,7 +35,8 @@ #include "qom/object.h" typedef struct DECState DECState; -#define DEC_21154(obj) OBJECT_CHECK(DECState, (obj), TYPE_DEC_21154) +DECLARE_INSTANCE_CHECKER(DECState, DEC_21154, + TYPE_DEC_21154) struct DECState { PCIHostState parent_obj; diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c index b62e20a648..67c71d566b 100644 --- a/hw/pci-bridge/gen_pcie_root_port.c +++ b/hw/pci-bridge/gen_pcie_root_port.c @@ -21,8 +21,8 @@ #define TYPE_GEN_PCIE_ROOT_PORT "pcie-root-port" typedef struct GenPCIERootPort GenPCIERootPort; -#define GEN_PCIE_ROOT_PORT(obj) \ - OBJECT_CHECK(GenPCIERootPort, (obj), TYPE_GEN_PCIE_ROOT_PORT) +DECLARE_INSTANCE_CHECKER(GenPCIERootPort, GEN_PCIE_ROOT_PORT, + TYPE_GEN_PCIE_ROOT_PORT) #define GEN_PCIE_ROOT_PORT_AER_OFFSET 0x100 #define GEN_PCIE_ROOT_PORT_ACS_OFFSET \ diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c index 7f57f90969..279c1e0b6d 100644 --- a/hw/pci-bridge/pci_bridge_dev.c +++ b/hw/pci-bridge/pci_bridge_dev.c @@ -36,8 +36,8 @@ #define TYPE_PCI_BRIDGE_DEV "pci-bridge" #define TYPE_PCI_BRIDGE_SEAT_DEV "pci-bridge-seat" typedef struct PCIBridgeDev PCIBridgeDev; -#define PCI_BRIDGE_DEV(obj) \ - OBJECT_CHECK(PCIBridgeDev, (obj), TYPE_PCI_BRIDGE_DEV) +DECLARE_INSTANCE_CHECKER(PCIBridgeDev, PCI_BRIDGE_DEV, + TYPE_PCI_BRIDGE_DEV) struct PCIBridgeDev { /*< private >*/ diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index 7d9f44e314..23d273b5c7 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -26,10 +26,12 @@ #define TYPE_PXB_BUS "pxb-bus" typedef struct PXBBus PXBBus; -#define PXB_BUS(obj) OBJECT_CHECK(PXBBus, (obj), TYPE_PXB_BUS) +DECLARE_INSTANCE_CHECKER(PXBBus, PXB_BUS, + TYPE_PXB_BUS) #define TYPE_PXB_PCIE_BUS "pxb-pcie-bus" -#define PXB_PCIE_BUS(obj) OBJECT_CHECK(PXBBus, (obj), TYPE_PXB_PCIE_BUS) +DECLARE_INSTANCE_CHECKER(PXBBus, PXB_PCIE_BUS, + TYPE_PXB_PCIE_BUS) struct PXBBus { /*< private >*/ @@ -41,10 +43,12 @@ struct PXBBus { #define TYPE_PXB_DEVICE "pxb" typedef struct PXBDev PXBDev; -#define PXB_DEV(obj) OBJECT_CHECK(PXBDev, (obj), TYPE_PXB_DEVICE) +DECLARE_INSTANCE_CHECKER(PXBDev, PXB_DEV, + TYPE_PXB_DEVICE) #define TYPE_PXB_PCIE_DEVICE "pxb-pcie" -#define PXB_PCIE_DEV(obj) OBJECT_CHECK(PXBDev, (obj), TYPE_PXB_PCIE_DEVICE) +DECLARE_INSTANCE_CHECKER(PXBDev, PXB_PCIE_DEV, + TYPE_PXB_PCIE_DEVICE) struct PXBDev { /*< private >*/ diff --git a/hw/pci-bridge/pcie_pci_bridge.c b/hw/pci-bridge/pcie_pci_bridge.c index 0f4c8a0cae..b3ec9dddef 100644 --- a/hw/pci-bridge/pcie_pci_bridge.c +++ b/hw/pci-bridge/pcie_pci_bridge.c @@ -30,8 +30,8 @@ struct PCIEPCIBridge { typedef struct PCIEPCIBridge PCIEPCIBridge; #define TYPE_PCIE_PCI_BRIDGE_DEV "pcie-pci-bridge" -#define PCIE_PCI_BRIDGE_DEV(obj) \ - OBJECT_CHECK(PCIEPCIBridge, (obj), TYPE_PCIE_PCI_BRIDGE_DEV) +DECLARE_INSTANCE_CHECKER(PCIEPCIBridge, PCIE_PCI_BRIDGE_DEV, + TYPE_PCIE_PCI_BRIDGE_DEV) static void pcie_pci_bridge_realize(PCIDevice *d, Error **errp) { diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index f4d5a052aa..ce813fd8b3 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -240,12 +240,12 @@ struct BonitoState { }; #define TYPE_BONITO_PCI_HOST_BRIDGE "Bonito-pcihost" -#define BONITO_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(BonitoState, (obj), TYPE_BONITO_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(BonitoState, BONITO_PCI_HOST_BRIDGE, + TYPE_BONITO_PCI_HOST_BRIDGE) #define TYPE_PCI_BONITO "Bonito" -#define PCI_BONITO(obj) \ - OBJECT_CHECK(PCIBonitoState, (obj), TYPE_PCI_BONITO) +DECLARE_INSTANCE_CHECKER(PCIBonitoState, PCI_BONITO, + TYPE_PCI_BONITO) static void bonito_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size) diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c index 0f38e31d1e..8fd4913921 100644 --- a/hw/pci-host/grackle.c +++ b/hw/pci-host/grackle.c @@ -36,8 +36,8 @@ #include "qom/object.h" typedef struct GrackleState GrackleState; -#define GRACKLE_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(GrackleState, (obj), TYPE_GRACKLE_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(GrackleState, GRACKLE_PCI_HOST_BRIDGE, + TYPE_GRACKLE_PCI_HOST_BRIDGE) struct GrackleState { PCIHostState parent_obj; diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 21896f96ed..189f89250f 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -43,8 +43,8 @@ */ typedef struct I440FXState I440FXState; -#define I440FX_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(I440FXState, (obj), TYPE_I440FX_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(I440FXState, I440FX_PCI_HOST_BRIDGE, + TYPE_I440FX_PCI_HOST_BRIDGE) struct I440FXState { PCIHostState parent_obj; diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c index 3ba0204601..b76051ed1f 100644 --- a/hw/pci-host/ppce500.c +++ b/hw/pci-host/ppce500.c @@ -93,8 +93,8 @@ struct pci_inbound { #define TYPE_PPC_E500_PCI_HOST_BRIDGE "e500-pcihost" typedef struct PPCE500PCIState PPCE500PCIState; -#define PPC_E500_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(PPCE500PCIState, (obj), TYPE_PPC_E500_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(PPCE500PCIState, PPC_E500_PCI_HOST_BRIDGE, + TYPE_PPC_E500_PCI_HOST_BRIDGE) struct PPCE500PCIState { PCIHostState parent_obj; @@ -117,8 +117,8 @@ struct PPCE500PCIState { #define TYPE_PPC_E500_PCI_BRIDGE "e500-host-bridge" typedef struct PPCE500PCIBridgeState PPCE500PCIBridgeState; -#define PPC_E500_PCI_BRIDGE(obj) \ - OBJECT_CHECK(PPCE500PCIBridgeState, (obj), TYPE_PPC_E500_PCI_BRIDGE) +DECLARE_INSTANCE_CHECKER(PPCE500PCIBridgeState, PPC_E500_PCI_BRIDGE, + TYPE_PPC_E500_PCI_BRIDGE) struct PPCE500PCIBridgeState { /*< private >*/ diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index e6d262db1e..a2b235c73f 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -44,8 +44,8 @@ #define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost" typedef struct RavenPCIState RavenPCIState; -#define RAVEN_PCI_DEVICE(obj) \ - OBJECT_CHECK(RavenPCIState, (obj), TYPE_RAVEN_PCI_DEVICE) +DECLARE_INSTANCE_CHECKER(RavenPCIState, RAVEN_PCI_DEVICE, + TYPE_RAVEN_PCI_DEVICE) struct RavenPCIState { PCIDevice dev; @@ -56,8 +56,8 @@ struct RavenPCIState { }; typedef struct PRePPCIState PREPPCIState; -#define RAVEN_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(PREPPCIState, (obj), TYPE_RAVEN_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(PREPPCIState, RAVEN_PCI_HOST_BRIDGE, + TYPE_RAVEN_PCI_HOST_BRIDGE) struct PRePPCIState { PCIHostState parent_obj; diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index bcb0f96885..2af7ce83eb 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -158,8 +158,8 @@ static const VMStateDescription pci_vpb_vmstate = { }; #define TYPE_VERSATILE_PCI "versatile_pci" -#define PCI_VPB(obj) \ - OBJECT_CHECK(PCIVPBState, (obj), TYPE_VERSATILE_PCI) +DECLARE_INSTANCE_CHECKER(PCIVPBState, PCI_VPB, + TYPE_VERSATILE_PCI) #define TYPE_VERSATILE_PCI_HOST "versatile_pci_host" #define PCI_VPB_HOST(obj) \ diff --git a/hw/ppc/mpc8544_guts.c b/hw/ppc/mpc8544_guts.c index 7949f7004a..e435254d39 100644 --- a/hw/ppc/mpc8544_guts.c +++ b/hw/ppc/mpc8544_guts.c @@ -56,7 +56,8 @@ #define TYPE_MPC8544_GUTS "mpc8544-guts" typedef struct GutsState GutsState; -#define MPC8544_GUTS(obj) OBJECT_CHECK(GutsState, (obj), TYPE_MPC8544_GUTS) +DECLARE_INSTANCE_CHECKER(GutsState, MPC8544_GUTS, + TYPE_MPC8544_GUTS) struct GutsState { /*< private >*/ diff --git a/hw/ppc/ppc440_pcix.c b/hw/ppc/ppc440_pcix.c index 7c3145ce43..96b81cd6cf 100644 --- a/hw/ppc/ppc440_pcix.c +++ b/hw/ppc/ppc440_pcix.c @@ -47,8 +47,8 @@ struct PLBInMap { #define TYPE_PPC440_PCIX_HOST_BRIDGE "ppc440-pcix-host" typedef struct PPC440PCIXState PPC440PCIXState; -#define PPC440_PCIX_HOST_BRIDGE(obj) \ - OBJECT_CHECK(PPC440PCIXState, (obj), TYPE_PPC440_PCIX_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(PPC440PCIXState, PPC440_PCIX_HOST_BRIDGE, + TYPE_PPC440_PCIX_HOST_BRIDGE) #define PPC440_PCIX_NR_POMS 3 #define PPC440_PCIX_NR_PIMS 3 diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c index 1ff714458d..db5f761237 100644 --- a/hw/ppc/ppc440_uc.c +++ b/hw/ppc/ppc440_uc.c @@ -1034,8 +1034,8 @@ void ppc4xx_dma_init(CPUPPCState *env, int dcr_base) #define TYPE_PPC460EX_PCIE_HOST "ppc460ex-pcie-host" typedef struct PPC460EXPCIEState PPC460EXPCIEState; -#define PPC460EX_PCIE_HOST(obj) \ - OBJECT_CHECK(PPC460EXPCIEState, (obj), TYPE_PPC460EX_PCIE_HOST) +DECLARE_INSTANCE_CHECKER(PPC460EXPCIEState, PPC460EX_PCIE_HOST, + TYPE_PPC460EX_PCIE_HOST) struct PPC460EXPCIEState { PCIExpressHost host; diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c index 8eb83080b0..e6888fff9d 100644 --- a/hw/ppc/ppc4xx_pci.c +++ b/hw/ppc/ppc4xx_pci.c @@ -45,8 +45,8 @@ struct PCITargetMap { }; typedef struct PPC4xxPCIState PPC4xxPCIState; -#define PPC4xx_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(PPC4xxPCIState, (obj), TYPE_PPC4xx_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(PPC4xxPCIState, PPC4xx_PCI_HOST_BRIDGE, + TYPE_PPC4xx_PCI_HOST_BRIDGE) #define PPC4xx_PCI_NR_PMMS 3 #define PPC4xx_PCI_NR_PTMS 2 diff --git a/hw/ppc/ppce500_spin.c b/hw/ppc/ppce500_spin.c index 5858fdaa10..5b37c26bba 100644 --- a/hw/ppc/ppce500_spin.c +++ b/hw/ppc/ppce500_spin.c @@ -48,7 +48,8 @@ typedef struct spin_info { #define TYPE_E500_SPIN "e500-spin" typedef struct SpinState SpinState; -#define E500_SPIN(obj) OBJECT_CHECK(SpinState, (obj), TYPE_E500_SPIN) +DECLARE_INSTANCE_CHECKER(SpinState, E500_SPIN, + TYPE_E500_SPIN) struct SpinState { SysBusDevice parent_obj; diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c index 338de2209d..41c0f8d924 100644 --- a/hw/ppc/prep_systemio.c +++ b/hw/ppc/prep_systemio.c @@ -37,8 +37,8 @@ #define TYPE_PREP_SYSTEMIO "prep-systemio" typedef struct PrepSystemIoState PrepSystemIoState; -#define PREP_SYSTEMIO(obj) \ - OBJECT_CHECK(PrepSystemIoState, (obj), TYPE_PREP_SYSTEMIO) +DECLARE_INSTANCE_CHECKER(PrepSystemIoState, PREP_SYSTEMIO, + TYPE_PREP_SYSTEMIO) /* Bit as defined in PowerPC Reference Plaform v1.1, sect. 6.1.5, p. 132 */ #define PREP_BIT(n) (1 << (7 - (n))) diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c index 5ca15d8116..b3ee282de9 100644 --- a/hw/ppc/rs6000_mc.c +++ b/hw/ppc/rs6000_mc.c @@ -30,8 +30,8 @@ #define TYPE_RS6000MC "rs6000-mc" typedef struct RS6000MCState RS6000MCState; -#define RS6000MC_DEVICE(obj) \ - OBJECT_CHECK(RS6000MCState, (obj), TYPE_RS6000MC) +DECLARE_INSTANCE_CHECKER(RS6000MCState, RS6000MC_DEVICE, + TYPE_RS6000MC) struct RS6000MCState { ISADevice parent_obj; diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c index fb19e6c65d..4b4f23ee2c 100644 --- a/hw/ppc/spapr_rng.c +++ b/hw/ppc/spapr_rng.c @@ -31,8 +31,8 @@ #include "qom/object.h" typedef struct SpaprRngState SpaprRngState; -#define SPAPR_RNG(obj) \ - OBJECT_CHECK(SpaprRngState, (obj), TYPE_SPAPR_RNG) +DECLARE_INSTANCE_CHECKER(SpaprRngState, SPAPR_RNG, + TYPE_SPAPR_RNG) struct SpaprRngState { /*< private >*/ diff --git a/hw/rtc/ds1338.c b/hw/rtc/ds1338.c index 3f0b5f0bfd..09719d276b 100644 --- a/hw/rtc/ds1338.c +++ b/hw/rtc/ds1338.c @@ -31,7 +31,8 @@ #define TYPE_DS1338 "ds1338" typedef struct DS1338State DS1338State; -#define DS1338(obj) OBJECT_CHECK(DS1338State, (obj), TYPE_DS1338) +DECLARE_INSTANCE_CHECKER(DS1338State, DS1338, + TYPE_DS1338) struct DS1338State { I2CSlave parent_obj; diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c index 7aa29740fe..dbad93ce8d 100644 --- a/hw/rtc/exynos4210_rtc.c +++ b/hw/rtc/exynos4210_rtc.c @@ -86,8 +86,8 @@ #define TYPE_EXYNOS4210_RTC "exynos4210.rtc" typedef struct Exynos4210RTCState Exynos4210RTCState; -#define EXYNOS4210_RTC(obj) \ - OBJECT_CHECK(Exynos4210RTCState, (obj), TYPE_EXYNOS4210_RTC) +DECLARE_INSTANCE_CHECKER(Exynos4210RTCState, EXYNOS4210_RTC, + TYPE_EXYNOS4210_RTC) struct Exynos4210RTCState { SysBusDevice parent_obj; diff --git a/hw/rtc/m41t80.c b/hw/rtc/m41t80.c index 10b501194a..5b3c32d454 100644 --- a/hw/rtc/m41t80.c +++ b/hw/rtc/m41t80.c @@ -18,7 +18,8 @@ #define TYPE_M41T80 "m41t80" typedef struct M41t80State M41t80State; -#define M41T80(obj) OBJECT_CHECK(M41t80State, (obj), TYPE_M41T80) +DECLARE_INSTANCE_CHECKER(M41t80State, M41T80, + TYPE_M41T80) struct M41t80State { I2CSlave parent_obj; diff --git a/hw/rtc/m48t59-isa.c b/hw/rtc/m48t59-isa.c index 13ceed424a..d9cac64d4b 100644 --- a/hw/rtc/m48t59-isa.c +++ b/hw/rtc/m48t59-isa.c @@ -35,12 +35,8 @@ #define TYPE_M48TXX_ISA "isa-m48txx" typedef struct M48txxISADeviceClass M48txxISADeviceClass; typedef struct M48txxISAState M48txxISAState; -#define M48TXX_ISA_GET_CLASS(obj) \ - OBJECT_GET_CLASS(M48txxISADeviceClass, (obj), TYPE_M48TXX_ISA) -#define M48TXX_ISA_CLASS(klass) \ - OBJECT_CLASS_CHECK(M48txxISADeviceClass, (klass), TYPE_M48TXX_ISA) -#define M48TXX_ISA(obj) \ - OBJECT_CHECK(M48txxISAState, (obj), TYPE_M48TXX_ISA) +DECLARE_OBJ_CHECKERS(M48txxISAState, M48txxISADeviceClass, + M48TXX_ISA, TYPE_M48TXX_ISA) struct M48txxISAState { ISADevice parent_obj; diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c index ad305e0825..ae556bca03 100644 --- a/hw/rtc/m48t59.c +++ b/hw/rtc/m48t59.c @@ -45,12 +45,8 @@ #define TYPE_M48TXX_SYS_BUS "sysbus-m48txx" typedef struct M48txxSysBusDeviceClass M48txxSysBusDeviceClass; typedef struct M48txxSysBusState M48txxSysBusState; -#define M48TXX_SYS_BUS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(M48txxSysBusDeviceClass, (obj), TYPE_M48TXX_SYS_BUS) -#define M48TXX_SYS_BUS_CLASS(klass) \ - OBJECT_CLASS_CHECK(M48txxSysBusDeviceClass, (klass), TYPE_M48TXX_SYS_BUS) -#define M48TXX_SYS_BUS(obj) \ - OBJECT_CHECK(M48txxSysBusState, (obj), TYPE_M48TXX_SYS_BUS) +DECLARE_OBJ_CHECKERS(M48txxSysBusState, M48txxSysBusDeviceClass, + M48TXX_SYS_BUS, TYPE_M48TXX_SYS_BUS) /* * Chipset docs: diff --git a/hw/rtc/sun4v-rtc.c b/hw/rtc/sun4v-rtc.c index 486a16d0cf..f457fd714d 100644 --- a/hw/rtc/sun4v-rtc.c +++ b/hw/rtc/sun4v-rtc.c @@ -21,7 +21,8 @@ #define TYPE_SUN4V_RTC "sun4v_rtc" typedef struct Sun4vRtc Sun4vRtc; -#define SUN4V_RTC(obj) OBJECT_CHECK(Sun4vRtc, (obj), TYPE_SUN4V_RTC) +DECLARE_INSTANCE_CHECKER(Sun4vRtc, SUN4V_RTC, + TYPE_SUN4V_RTC) struct Sun4vRtc { SysBusDevice parent_obj; diff --git a/hw/rtc/twl92230.c b/hw/rtc/twl92230.c index 9a3b8c3411..339e2ede14 100644 --- a/hw/rtc/twl92230.c +++ b/hw/rtc/twl92230.c @@ -35,7 +35,8 @@ #define TYPE_TWL92230 "twl92230" typedef struct MenelausState MenelausState; -#define TWL92230(obj) OBJECT_CHECK(MenelausState, (obj), TYPE_TWL92230) +DECLARE_INSTANCE_CHECKER(MenelausState, TWL92230, + TYPE_TWL92230) struct MenelausState { I2CSlave parent_obj; diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c index d1d163d02e..4672a7ea58 100644 --- a/hw/rx/rx-gdbsim.c +++ b/hw/rx/rx-gdbsim.c @@ -54,13 +54,9 @@ typedef struct RxGdbSimMachineState RxGdbSimMachineState; #define TYPE_RX_GDBSIM_MACHINE MACHINE_TYPE_NAME("rx62n-common") -#define RX_GDBSIM_MACHINE(obj) \ - OBJECT_CHECK(RxGdbSimMachineState, (obj), TYPE_RX_GDBSIM_MACHINE) +DECLARE_OBJ_CHECKERS(RxGdbSimMachineState, RxGdbSimMachineClass, + RX_GDBSIM_MACHINE, TYPE_RX_GDBSIM_MACHINE) -#define RX_GDBSIM_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(RxGdbSimMachineClass, (klass), TYPE_RX_GDBSIM_MACHINE) -#define RX_GDBSIM_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(RxGdbSimMachineClass, (obj), TYPE_RX_GDBSIM_MACHINE) static void rx_load_image(RXCPU *cpu, const char *filename, uint32_t start, uint32_t size) diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c index d2935c5429..6eb4eea700 100644 --- a/hw/rx/rx62n.c +++ b/hw/rx/rx62n.c @@ -72,10 +72,8 @@ struct RX62NClass { }; typedef struct RX62NClass RX62NClass; -#define RX62N_MCU_CLASS(klass) \ - OBJECT_CLASS_CHECK(RX62NClass, (klass), TYPE_RX62N_MCU) -#define RX62N_MCU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(RX62NClass, (obj), TYPE_RX62N_MCU) +DECLARE_CLASS_CHECKERS(RX62NClass, RX62N_MCU, + TYPE_RX62N_MCU) /* * IRQ -> IPR mapping table diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index 652b750f5e..b69d70e8f8 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -38,8 +38,8 @@ #define TYPE_AM53C974_DEVICE "am53c974" typedef struct PCIESPState PCIESPState; -#define PCI_ESP(obj) \ - OBJECT_CHECK(PCIESPState, (obj), TYPE_AM53C974_DEVICE) +DECLARE_INSTANCE_CHECKER(PCIESPState, PCI_ESP, + TYPE_AM53C974_DEVICE) #define DMA_CMD 0x0 #define DMA_STC 0x1 @@ -418,8 +418,8 @@ struct DC390State { typedef struct DC390State DC390State; #define TYPE_DC390_DEVICE "dc390" -#define DC390(obj) \ - OBJECT_CHECK(DC390State, obj, TYPE_DC390_DEVICE) +DECLARE_INSTANCE_CHECKER(DC390State, DC390, + TYPE_DC390_DEVICE) #define EE_ADAPT_SCSI_ID 64 #define EE_MODE2 65 diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 3651ef2e95..976cea4d50 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -310,8 +310,8 @@ typedef struct LSIState LSIState; #define TYPE_LSI53C810 "lsi53c810" #define TYPE_LSI53C895A "lsi53c895a" -#define LSI53C895A(obj) \ - OBJECT_CHECK(LSIState, (obj), TYPE_LSI53C895A) +DECLARE_INSTANCE_CHECKER(LSIState, LSI53C895A, + TYPE_LSI53C895A) static const char *scsi_phases[] = { "DOUT", diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 6f0d21804d..148da6891c 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -134,13 +134,9 @@ typedef struct MegasasBaseClass MegasasBaseClass; #define TYPE_MEGASAS_GEN1 "megasas" #define TYPE_MEGASAS_GEN2 "megasas-gen2" -#define MEGASAS(obj) \ - OBJECT_CHECK(MegasasState, (obj), TYPE_MEGASAS_BASE) +DECLARE_OBJ_CHECKERS(MegasasState, MegasasBaseClass, + MEGASAS, TYPE_MEGASAS_BASE) -#define MEGASAS_CLASS(oc) \ - OBJECT_CLASS_CHECK(MegasasBaseClass, (oc), TYPE_MEGASAS_BASE) -#define MEGASAS_GET_CLASS(oc) \ - OBJECT_GET_CLASS(MegasasBaseClass, (oc), TYPE_MEGASAS_BASE) #define MEGASAS_INTR_DISABLED_MASK 0xFFFFFFFF diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 3a2978d6d3..767d688e1b 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -57,12 +57,8 @@ typedef struct SCSIDiskClass SCSIDiskClass; typedef struct SCSIDiskState SCSIDiskState; -#define SCSI_DISK_BASE(obj) \ - OBJECT_CHECK(SCSIDiskState, (obj), TYPE_SCSI_DISK_BASE) -#define SCSI_DISK_BASE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SCSIDiskClass, (klass), TYPE_SCSI_DISK_BASE) -#define SCSI_DISK_BASE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SCSIDiskClass, (obj), TYPE_SCSI_DISK_BASE) +DECLARE_OBJ_CHECKERS(SCSIDiskState, SCSIDiskClass, + SCSI_DISK_BASE, TYPE_SCSI_DISK_BASE) struct SCSIDiskClass { SCSIDeviceClass parent_class; diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index 65b84395df..b11cbd285e 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -92,8 +92,8 @@ typedef struct vscsi_req { #define TYPE_VIO_SPAPR_VSCSI_DEVICE "spapr-vscsi" typedef struct VSCSIState VSCSIState; -#define VIO_SPAPR_VSCSI_DEVICE(obj) \ - OBJECT_CHECK(VSCSIState, (obj), TYPE_VIO_SPAPR_VSCSI_DEVICE) +DECLARE_INSTANCE_CHECKER(VSCSIState, VIO_SPAPR_VSCSI_DEVICE, + TYPE_VIO_SPAPR_VSCSI_DEVICE) struct VSCSIState { SpaprVioDevice vdev; diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index 6afe5d1a5f..8f742fedd7 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -65,12 +65,9 @@ typedef struct PVSCSIClass PVSCSIClass; #define TYPE_PVSCSI "pvscsi" typedef struct PVSCSIState PVSCSIState; -#define PVSCSI(obj) OBJECT_CHECK(PVSCSIState, (obj), TYPE_PVSCSI) +DECLARE_OBJ_CHECKERS(PVSCSIState, PVSCSIClass, + PVSCSI, TYPE_PVSCSI) -#define PVSCSI_CLASS(klass) \ - OBJECT_CLASS_CHECK(PVSCSIClass, (klass), TYPE_PVSCSI) -#define PVSCSI_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PVSCSIClass, (obj), TYPE_PVSCSI) /* Compatibility flags for migration */ #define PVSCSI_COMPAT_OLD_PCI_CONFIGURATION_BIT 0 diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 3039a5941e..93c88fd3ec 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -65,8 +65,8 @@ enum { #define TYPE_MILKYMIST_MEMCARD "milkymist-memcard" typedef struct MilkymistMemcardState MilkymistMemcardState; -#define MILKYMIST_MEMCARD(obj) \ - OBJECT_CHECK(MilkymistMemcardState, (obj), TYPE_MILKYMIST_MEMCARD) +DECLARE_INSTANCE_CHECKER(MilkymistMemcardState, MILKYMIST_MEMCARD, + TYPE_MILKYMIST_MEMCARD) struct MilkymistMemcardState { SysBusDevice parent_obj; diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 5ec08414c2..c64efce44c 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -31,7 +31,8 @@ do { printf("pl181: " fmt , ## __VA_ARGS__); } while (0) #define TYPE_PL181 "pl181" typedef struct PL181State PL181State; -#define PL181(obj) OBJECT_CHECK(PL181State, (obj), TYPE_PL181) +DECLARE_INSTANCE_CHECKER(PL181State, PL181, + TYPE_PL181) struct PL181State { SysBusDevice parent_obj; diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index b9e9e916c9..a4d6ac02e3 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -55,7 +55,8 @@ struct ssi_sd_state { typedef struct ssi_sd_state ssi_sd_state; #define TYPE_SSI_SD "ssi-sd" -#define SSI_SD(obj) OBJECT_CHECK(ssi_sd_state, (obj), TYPE_SSI_SD) +DECLARE_INSTANCE_CHECKER(ssi_sd_state, SSI_SD, + TYPE_SSI_SD) /* State word bits. */ #define SSI_SDR_LOCKED 0x0001 diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c index e3d11f7fad..09e0e6d0dd 100644 --- a/hw/sh4/sh_pci.c +++ b/hw/sh4/sh_pci.c @@ -36,8 +36,8 @@ #define TYPE_SH_PCI_HOST_BRIDGE "sh_pci" typedef struct SHPCIState SHPCIState; -#define SH_PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(SHPCIState, (obj), TYPE_SH_PCI_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(SHPCIState, SH_PCI_HOST_BRIDGE, + TYPE_SH_PCI_HOST_BRIDGE) struct SHPCIState { PCIHostState parent_obj; diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 4c2fa270c8..e7b484c7a4 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -593,8 +593,8 @@ static void idreg_init(hwaddr addr) } typedef struct IDRegState IDRegState; -#define MACIO_ID_REGISTER(obj) \ - OBJECT_CHECK(IDRegState, (obj), TYPE_MACIO_ID_REGISTER) +DECLARE_INSTANCE_CHECKER(IDRegState, MACIO_ID_REGISTER, + TYPE_MACIO_ID_REGISTER) struct IDRegState { SysBusDevice parent_obj; @@ -637,7 +637,8 @@ TYPE_INFO(idreg_info) #define TYPE_TCX_AFX "tcx_afx" typedef struct AFXState AFXState; -#define TCX_AFX(obj) OBJECT_CHECK(AFXState, (obj), TYPE_TCX_AFX) +DECLARE_INSTANCE_CHECKER(AFXState, TCX_AFX, + TYPE_TCX_AFX) struct AFXState { SysBusDevice parent_obj; @@ -692,7 +693,8 @@ TYPE_INFO(afx_info) #define TYPE_OPENPROM "openprom" typedef struct PROMState PROMState; -#define OPENPROM(obj) OBJECT_CHECK(PROMState, (obj), TYPE_OPENPROM) +DECLARE_INSTANCE_CHECKER(PROMState, OPENPROM, + TYPE_OPENPROM) struct PROMState { SysBusDevice parent_obj; @@ -782,7 +784,8 @@ TYPE_INFO(prom_info) #define TYPE_SUN4M_MEMORY "memory" typedef struct RamDevice RamDevice; -#define SUN4M_RAM(obj) OBJECT_CHECK(RamDevice, (obj), TYPE_SUN4M_MEMORY) +DECLARE_INSTANCE_CHECKER(RamDevice, SUN4M_RAM, + TYPE_SUN4M_MEMORY) struct RamDevice { SysBusDevice parent_obj; diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 006c7b4578..041c135cc7 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -93,7 +93,8 @@ struct EbusState { typedef struct EbusState EbusState; #define TYPE_EBUS "ebus" -#define EBUS(obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) +DECLARE_INSTANCE_CHECKER(EbusState, EBUS, + TYPE_EBUS) const char *fw_cfg_arch_key_name(uint16_t key) { @@ -229,7 +230,8 @@ typedef struct ResetData { #define TYPE_SUN4U_POWER "power" typedef struct PowerDevice PowerDevice; -#define SUN4U_POWER(obj) OBJECT_CHECK(PowerDevice, (obj), TYPE_SUN4U_POWER) +DECLARE_INSTANCE_CHECKER(PowerDevice, SUN4U_POWER, + TYPE_SUN4U_POWER) struct PowerDevice { SysBusDevice parent_obj; @@ -405,7 +407,8 @@ TYPE_INFO(ebus_info) #define TYPE_OPENPROM "openprom" typedef struct PROMState PROMState; -#define OPENPROM(obj) OBJECT_CHECK(PROMState, (obj), TYPE_OPENPROM) +DECLARE_INSTANCE_CHECKER(PROMState, OPENPROM, + TYPE_OPENPROM) struct PROMState { SysBusDevice parent_obj; @@ -495,7 +498,8 @@ TYPE_INFO(prom_info) #define TYPE_SUN4U_MEMORY "memory" typedef struct RamDevice RamDevice; -#define SUN4U_RAM(obj) OBJECT_CHECK(RamDevice, (obj), TYPE_SUN4U_MEMORY) +DECLARE_INSTANCE_CHECKER(RamDevice, SUN4U_RAM, + TYPE_SUN4U_MEMORY) struct RamDevice { SysBusDevice parent_obj; diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c index a895621ff1..3be0b0c385 100644 --- a/hw/ssi/xilinx_spi.c +++ b/hw/ssi/xilinx_spi.c @@ -80,7 +80,8 @@ #define TYPE_XILINX_SPI "xlnx.xps-spi" typedef struct XilinxSPI XilinxSPI; -#define XILINX_SPI(obj) OBJECT_CHECK(XilinxSPI, (obj), TYPE_XILINX_SPI) +DECLARE_INSTANCE_CHECKER(XilinxSPI, XILINX_SPI, + TYPE_XILINX_SPI) struct XilinxSPI { SysBusDevice parent_obj; diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c index f22729261f..22c3ff1e82 100644 --- a/hw/timer/altera_timer.c +++ b/hw/timer/altera_timer.c @@ -46,8 +46,8 @@ #define TYPE_ALTERA_TIMER "ALTR.timer" typedef struct AlteraTimer AlteraTimer; -#define ALTERA_TIMER(obj) \ - OBJECT_CHECK(AlteraTimer, (obj), TYPE_ALTERA_TIMER) +DECLARE_INSTANCE_CHECKER(AlteraTimer, ALTERA_TIMER, + TYPE_ALTERA_TIMER) struct AlteraTimer { SysBusDevice busdev; diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c index c9aa82fc09..fbd9494f7d 100644 --- a/hw/timer/arm_timer.c +++ b/hw/timer/arm_timer.c @@ -192,7 +192,8 @@ static arm_timer_state *arm_timer_init(uint32_t freq) #define TYPE_SP804 "sp804" typedef struct SP804State SP804State; -#define SP804(obj) OBJECT_CHECK(SP804State, (obj), TYPE_SP804) +DECLARE_INSTANCE_CHECKER(SP804State, SP804, + TYPE_SP804) struct SP804State { SysBusDevice parent_obj; @@ -313,8 +314,8 @@ static void sp804_realize(DeviceState *dev, Error **errp) #define TYPE_INTEGRATOR_PIT "integrator_pit" typedef struct icp_pit_state icp_pit_state; -#define INTEGRATOR_PIT(obj) \ - OBJECT_CHECK(icp_pit_state, (obj), TYPE_INTEGRATOR_PIT) +DECLARE_INSTANCE_CHECKER(icp_pit_state, INTEGRATOR_PIT, + TYPE_INTEGRATOR_PIT) struct icp_pit_state { SysBusDevice parent_obj; diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c index 35a9887fea..847c166c5d 100644 --- a/hw/timer/cadence_ttc.c +++ b/hw/timer/cadence_ttc.c @@ -71,8 +71,8 @@ typedef struct { #define TYPE_CADENCE_TTC "cadence_ttc" typedef struct CadenceTTCState CadenceTTCState; -#define CADENCE_TTC(obj) \ - OBJECT_CHECK(CadenceTTCState, (obj), TYPE_CADENCE_TTC) +DECLARE_INSTANCE_CHECKER(CadenceTTCState, CADENCE_TTC, + TYPE_CADENCE_TTC) struct CadenceTTCState { SysBusDevice parent_obj; diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index a16c9c6f62..5d1499fb9d 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -50,8 +50,8 @@ #define TYPE_ETRAX_FS_TIMER "etraxfs,timer" typedef struct ETRAXTimerState ETRAXTimerState; -#define ETRAX_TIMER(obj) \ - OBJECT_CHECK(ETRAXTimerState, (obj), TYPE_ETRAX_FS_TIMER) +DECLARE_INSTANCE_CHECKER(ETRAXTimerState, ETRAX_TIMER, + TYPE_ETRAX_FS_TIMER) struct ETRAXTimerState { SysBusDevice parent_obj; diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 2848b6fcbd..d321a96e01 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -244,8 +244,8 @@ typedef struct { #define TYPE_EXYNOS4210_MCT "exynos4210.mct" typedef struct Exynos4210MCTState Exynos4210MCTState; -#define EXYNOS4210_MCT(obj) \ - OBJECT_CHECK(Exynos4210MCTState, (obj), TYPE_EXYNOS4210_MCT) +DECLARE_INSTANCE_CHECKER(Exynos4210MCTState, EXYNOS4210_MCT, + TYPE_EXYNOS4210_MCT) struct Exynos4210MCTState { SysBusDevice parent_obj; diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c index 25970c3182..150e2bf603 100644 --- a/hw/timer/exynos4210_pwm.c +++ b/hw/timer/exynos4210_pwm.c @@ -104,8 +104,8 @@ typedef struct { #define TYPE_EXYNOS4210_PWM "exynos4210.pwm" typedef struct Exynos4210PWMState Exynos4210PWMState; -#define EXYNOS4210_PWM(obj) \ - OBJECT_CHECK(Exynos4210PWMState, (obj), TYPE_EXYNOS4210_PWM) +DECLARE_INSTANCE_CHECKER(Exynos4210PWMState, EXYNOS4210_PWM, + TYPE_EXYNOS4210_PWM) struct Exynos4210PWMState { SysBusDevice parent_obj; diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c index c05f94ec3b..a20c716840 100644 --- a/hw/timer/grlib_gptimer.c +++ b/hw/timer/grlib_gptimer.c @@ -57,8 +57,8 @@ #define TIMER_BASE 0x10 typedef struct GPTimerUnit GPTimerUnit; -#define GRLIB_GPTIMER(obj) \ - OBJECT_CHECK(GPTimerUnit, (obj), TYPE_GRLIB_GPTIMER) +DECLARE_INSTANCE_CHECKER(GPTimerUnit, GRLIB_GPTIMER, + TYPE_GRLIB_GPTIMER) typedef struct GPTimer GPTimer; diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 5f469e726f..d087d01ff3 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -49,7 +49,8 @@ #define HPET_MSI_SUPPORT 0 typedef struct HPETState HPETState; -#define HPET(obj) OBJECT_CHECK(HPETState, (obj), TYPE_HPET) +DECLARE_INSTANCE_CHECKER(HPETState, HPET, + TYPE_HPET) struct HPETState; typedef struct HPETTimer { /* timers */ diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c index 7e5abd7fc7..648a09ce68 100644 --- a/hw/timer/i8254.c +++ b/hw/timer/i8254.c @@ -38,8 +38,8 @@ #define RW_STATE_WORD1 4 typedef struct PITClass PITClass; -#define PIT_CLASS(class) OBJECT_CLASS_CHECK(PITClass, (class), TYPE_I8254) -#define PIT_GET_CLASS(obj) OBJECT_GET_CLASS(PITClass, (obj), TYPE_I8254) +DECLARE_CLASS_CHECKERS(PITClass, PIT, + TYPE_I8254) struct PITClass { PITCommonClass parent_class; diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c index ccbbdaa102..fdf05a423b 100644 --- a/hw/timer/lm32_timer.c +++ b/hw/timer/lm32_timer.c @@ -57,7 +57,8 @@ enum { #define TYPE_LM32_TIMER "lm32-timer" typedef struct LM32TimerState LM32TimerState; -#define LM32_TIMER(obj) OBJECT_CHECK(LM32TimerState, (obj), TYPE_LM32_TIMER) +DECLARE_INSTANCE_CHECKER(LM32TimerState, LM32_TIMER, + TYPE_LM32_TIMER) struct LM32TimerState { SysBusDevice parent_obj; diff --git a/hw/timer/milkymist-sysctl.c b/hw/timer/milkymist-sysctl.c index cbbb3c991c..29fde7f9da 100644 --- a/hw/timer/milkymist-sysctl.c +++ b/hw/timer/milkymist-sysctl.c @@ -64,8 +64,8 @@ enum { #define TYPE_MILKYMIST_SYSCTL "milkymist-sysctl" typedef struct MilkymistSysctlState MilkymistSysctlState; -#define MILKYMIST_SYSCTL(obj) \ - OBJECT_CHECK(MilkymistSysctlState, (obj), TYPE_MILKYMIST_SYSCTL) +DECLARE_INSTANCE_CHECKER(MilkymistSysctlState, MILKYMIST_SYSCTL, + TYPE_MILKYMIST_SYSCTL) struct MilkymistSysctlState { SysBusDevice parent_obj; diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c index 86143380d5..709134a68a 100644 --- a/hw/timer/puv3_ost.c +++ b/hw/timer/puv3_ost.c @@ -22,7 +22,8 @@ #define TYPE_PUV3_OST "puv3_ost" typedef struct PUV3OSTState PUV3OSTState; -#define PUV3_OST(obj) OBJECT_CHECK(PUV3OSTState, (obj), TYPE_PUV3_OST) +DECLARE_INSTANCE_CHECKER(PUV3OSTState, PUV3_OST, + TYPE_PUV3_OST) /* puv3 ostimer implementation. */ struct PUV3OSTState { diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c index e2b161d2b5..2d783de4dd 100644 --- a/hw/timer/pxa2xx_timer.c +++ b/hw/timer/pxa2xx_timer.c @@ -68,8 +68,8 @@ static int pxa2xx_timer4_freq[8] = { #define TYPE_PXA2XX_TIMER "pxa2xx-timer" typedef struct PXA2xxTimerInfo PXA2xxTimerInfo; -#define PXA2XX_TIMER(obj) \ - OBJECT_CHECK(PXA2xxTimerInfo, (obj), TYPE_PXA2XX_TIMER) +DECLARE_INSTANCE_CHECKER(PXA2xxTimerInfo, PXA2XX_TIMER, + TYPE_PXA2XX_TIMER) typedef struct { diff --git a/hw/timer/slavio_timer.c b/hw/timer/slavio_timer.c index 1c6c7b96a7..d7654fce8b 100644 --- a/hw/timer/slavio_timer.c +++ b/hw/timer/slavio_timer.c @@ -61,8 +61,8 @@ typedef struct CPUTimerState { #define TYPE_SLAVIO_TIMER "slavio_timer" typedef struct SLAVIO_TIMERState SLAVIO_TIMERState; -#define SLAVIO_TIMER(obj) \ - OBJECT_CHECK(SLAVIO_TIMERState, (obj), TYPE_SLAVIO_TIMER) +DECLARE_INSTANCE_CHECKER(SLAVIO_TIMERState, SLAVIO_TIMER, + TYPE_SLAVIO_TIMER) struct SLAVIO_TIMERState { SysBusDevice parent_obj; diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c index a1e239813e..8a77718fb1 100644 --- a/hw/tpm/tpm_crb.c +++ b/hw/tpm/tpm_crb.c @@ -47,7 +47,8 @@ struct CRBState { }; typedef struct CRBState CRBState; -#define CRB(obj) OBJECT_CHECK(CRBState, (obj), TYPE_TPM_CRB) +DECLARE_INSTANCE_CHECKER(CRBState, CRB, + TYPE_TPM_CRB) #define CRB_INTF_TYPE_CRB_ACTIVE 0b1 #define CRB_INTF_VERSION_CRB 0b1 diff --git a/hw/tpm/tpm_spapr.c b/hw/tpm/tpm_spapr.c index c96f869ebf..69da4e518f 100644 --- a/hw/tpm/tpm_spapr.c +++ b/hw/tpm/tpm_spapr.c @@ -31,8 +31,8 @@ #define DEBUG_SPAPR 0 typedef struct SpaprTpmState SpaprTpmState; -#define VIO_SPAPR_VTPM(obj) \ - OBJECT_CHECK(SpaprTpmState, (obj), TYPE_TPM_SPAPR) +DECLARE_INSTANCE_CHECKER(SpaprTpmState, VIO_SPAPR_VTPM, + TYPE_TPM_SPAPR) typedef struct TpmCrq { uint8_t valid; /* 0x80: cmd; 0xc0: init crq */ diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c index 2daef11cde..643d03d5ee 100644 --- a/hw/tpm/tpm_tis_isa.c +++ b/hw/tpm/tpm_tis_isa.c @@ -40,7 +40,8 @@ struct TPMStateISA { }; typedef struct TPMStateISA TPMStateISA; -#define TPM_TIS_ISA(obj) OBJECT_CHECK(TPMStateISA, (obj), TYPE_TPM_TIS_ISA) +DECLARE_INSTANCE_CHECKER(TPMStateISA, TPM_TIS_ISA, + TYPE_TPM_TIS_ISA) static int tpm_tis_pre_save_isa(void *opaque) { diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c index 4a05f1cfa3..e378b864ef 100644 --- a/hw/tpm/tpm_tis_sysbus.c +++ b/hw/tpm/tpm_tis_sysbus.c @@ -40,7 +40,8 @@ struct TPMStateSysBus { }; typedef struct TPMStateSysBus TPMStateSysBus; -#define TPM_TIS_SYSBUS(obj) OBJECT_CHECK(TPMStateSysBus, (obj), TYPE_TPM_TIS_SYSBUS) +DECLARE_INSTANCE_CHECKER(TPMStateSysBus, TPM_TIS_SYSBUS, + TYPE_TPM_TIS_SYSBUS) static int tpm_tis_pre_save_sysbus(void *opaque) { diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 50f60f656f..99df197d97 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -47,8 +47,8 @@ do {\ #define TYPE_EMULATED_CCID "ccid-card-emulated" typedef struct EmulatedState EmulatedState; -#define EMULATED_CCID_CARD(obj) \ - OBJECT_CHECK(EmulatedState, (obj), TYPE_EMULATED_CCID) +DECLARE_INSTANCE_CHECKER(EmulatedState, EMULATED_CCID_CARD, + TYPE_EMULATED_CCID) #define BACKEND_NSS_EMULATED_NAME "nss-emulated" #define BACKEND_CERTIFICATES_NAME "certificates" diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index a8a241f4d3..98c5516b6e 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -65,8 +65,8 @@ struct PassthruState { }; #define TYPE_CCID_PASSTHRU "ccid-card-passthru" -#define PASSTHRU_CCID_CARD(obj) \ - OBJECT_CHECK(PassthruState, (obj), TYPE_CCID_PASSTHRU) +DECLARE_INSTANCE_CHECKER(PassthruState, PASSTHRU_CCID_CARD, + TYPE_CCID_PASSTHRU) /* * VSCard protocol over chardev diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 74215edd04..11799d3fa2 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -657,7 +657,8 @@ struct USBAudioState { typedef struct USBAudioState USBAudioState; #define TYPE_USB_AUDIO "usb-audio" -#define USB_AUDIO(obj) OBJECT_CHECK(USBAudioState, (obj), TYPE_USB_AUDIO) +DECLARE_INSTANCE_CHECKER(USBAudioState, USB_AUDIO, + TYPE_USB_AUDIO) static void output_callback(void *opaque, int avail) { diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index 7872ba25a3..3ec8852c1a 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -59,7 +59,8 @@ struct USBHIDState { typedef struct USBHIDState USBHIDState; #define TYPE_USB_HID "usb-hid" -#define USB_HID(obj) OBJECT_CHECK(USBHIDState, (obj), TYPE_USB_HID) +DECLARE_INSTANCE_CHECKER(USBHIDState, USB_HID, + TYPE_USB_HID) enum { STR_MANUFACTURER = 1, diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index ceeda6b464..af57cc1977 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -53,7 +53,8 @@ struct USBHubState { typedef struct USBHubState USBHubState; #define TYPE_USB_HUB "usb-hub" -#define USB_HUB(obj) OBJECT_CHECK(USBHubState, (obj), TYPE_USB_HUB) +DECLARE_INSTANCE_CHECKER(USBHubState, USB_HUB, + TYPE_USB_HUB) #define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE) #define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index eff0247d85..d777ab7178 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -238,7 +238,8 @@ typedef struct { } QEMU_PACKED ObjectInfo; #define TYPE_USB_MTP "usb-mtp" -#define USB_MTP(obj) OBJECT_CHECK(MTPState, (obj), TYPE_USB_MTP) +DECLARE_INSTANCE_CHECKER(MTPState, USB_MTP, + TYPE_USB_MTP) #define QEMU_STORAGE_ID 0x00010001 diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 59b637e398..574ee9e203 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -656,7 +656,8 @@ struct USBNetState { typedef struct USBNetState USBNetState; #define TYPE_USB_NET "usb-net" -#define USB_NET(obj) OBJECT_CHECK(USBNetState, (obj), TYPE_USB_NET) +DECLARE_INSTANCE_CHECKER(USBNetState, USB_NET, + TYPE_USB_NET) static int is_rndis(USBNetState *s) { diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 4b2d59f740..163cf86285 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -113,7 +113,8 @@ struct USBSerialState { typedef struct USBSerialState USBSerialState; #define TYPE_USB_SERIAL "usb-serial-dev" -#define USB_SERIAL_DEV(obj) OBJECT_CHECK(USBSerialState, (obj), TYPE_USB_SERIAL) +DECLARE_INSTANCE_CHECKER(USBSerialState, USB_SERIAL_DEV, + TYPE_USB_SERIAL) enum { STR_MANUFACTURER = 1, diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 399de75fe4..2238a4a531 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -62,7 +62,8 @@ do { \ #define CCID_DEV_NAME "usb-ccid" typedef struct USBCCIDState USBCCIDState; -#define USB_CCID_DEV(obj) OBJECT_CHECK(USBCCIDState, (obj), CCID_DEV_NAME) +DECLARE_INSTANCE_CHECKER(USBCCIDState, USB_CCID_DEV, + CCID_DEV_NAME) /* * The two options for variable sized buffers: * make them constant size, for large enough constant, @@ -1176,7 +1177,8 @@ static Property ccid_props[] = { }; #define TYPE_CCID_BUS "ccid-bus" -#define CCID_BUS(obj) OBJECT_CHECK(CCIDBus, (obj), TYPE_CCID_BUS) +DECLARE_INSTANCE_CHECKER(CCIDBus, CCID_BUS, + TYPE_CCID_BUS) static const TypeInfo ccid_bus_info = { .name = TYPE_CCID_BUS, diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index d6c694e77f..207044300a 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -70,7 +70,8 @@ struct MSDState { typedef struct MSDState MSDState; #define TYPE_USB_STORAGE "usb-storage-dev" -#define USB_STORAGE_DEV(obj) OBJECT_CHECK(MSDState, (obj), TYPE_USB_STORAGE) +DECLARE_INSTANCE_CHECKER(MSDState, USB_STORAGE_DEV, + TYPE_USB_STORAGE) struct usb_msd_cbw { uint32_t sig; diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index 8bc6045267..2e74efb1a2 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -133,7 +133,8 @@ struct UASDevice { }; #define TYPE_USB_UAS "usb-uas" -#define USB_UAS(obj) OBJECT_CHECK(UASDevice, (obj), TYPE_USB_UAS) +DECLARE_INSTANCE_CHECKER(UASDevice, USB_UAS, + TYPE_USB_UAS) struct UASRequest { uint16_t tag; diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c index e6833a2a45..37374cde41 100644 --- a/hw/usb/dev-wacom.c +++ b/hw/usb/dev-wacom.c @@ -62,7 +62,8 @@ struct USBWacomState { typedef struct USBWacomState USBWacomState; #define TYPE_USB_WACOM "usb-wacom-tablet" -#define USB_WACOM(obj) OBJECT_CHECK(USBWacomState, (obj), TYPE_USB_WACOM) +DECLARE_INSTANCE_CHECKER(USBWacomState, USB_WACOM, + TYPE_USB_WACOM) enum { STR_MANUFACTURER = 1, diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c index a66379ef13..0a099bbaa7 100644 --- a/hw/usb/hcd-ohci-pci.c +++ b/hw/usb/hcd-ohci-pci.c @@ -33,7 +33,8 @@ #define TYPE_PCI_OHCI "pci-ohci" typedef struct OHCIPCIState OHCIPCIState; -#define PCI_OHCI(obj) OBJECT_CHECK(OHCIPCIState, (obj), TYPE_PCI_OHCI) +DECLARE_INSTANCE_CHECKER(OHCIPCIState, PCI_OHCI, + TYPE_PCI_OHCI) struct OHCIPCIState { /*< private >*/ diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 7540206b93..2ad2f0f061 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -161,7 +161,8 @@ static void uhci_queue_fill(UHCIQueue *q, UHCI_TD *td); static void uhci_resume(void *opaque); #define TYPE_UHCI "pci-uhci-usb" -#define UHCI(obj) OBJECT_CHECK(UHCIState, (obj), TYPE_UHCI) +DECLARE_INSTANCE_CHECKER(UHCIState, UHCI, + TYPE_UHCI) static inline int32_t uhci_queue_token(UHCI_TD *td) { diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 71a03ff0f3..322e6b68e5 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -57,8 +57,8 @@ #define TYPE_USB_HOST_DEVICE "usb-host" typedef struct USBHostDevice USBHostDevice; -#define USB_HOST_DEVICE(obj) \ - OBJECT_CHECK(USBHostDevice, (obj), TYPE_USB_HOST_DEVICE) +DECLARE_INSTANCE_CHECKER(USBHostDevice, USB_HOST_DEVICE, + TYPE_USB_HOST_DEVICE) typedef struct USBHostRequest USBHostRequest; typedef struct USBHostIsoXfer USBHostIsoXfer; diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 16e8b06198..94a25ef81a 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -145,7 +145,8 @@ struct USBRedirDevice { }; #define TYPE_USB_REDIR "usb-redir" -#define USB_REDIRECT(obj) OBJECT_CHECK(USBRedirDevice, (obj), TYPE_USB_REDIR) +DECLARE_INSTANCE_CHECKER(USBRedirDevice, USB_REDIRECT, + TYPE_USB_REDIR) static void usbredir_hello(void *priv, struct usb_redir_hello_header *h); static void usbredir_device_connect(void *priv, diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c index 55e6aca3a1..daa54bebab 100644 --- a/hw/usb/tusb6010.c +++ b/hw/usb/tusb6010.c @@ -32,7 +32,8 @@ #define TYPE_TUSB6010 "tusb6010" typedef struct TUSBState TUSBState; -#define TUSB(obj) OBJECT_CHECK(TUSBState, (obj), TYPE_TUSB6010) +DECLARE_INSTANCE_CHECKER(TUSBState, TUSB, + TYPE_TUSB6010) struct TUSBState { SysBusDevice parent_obj; diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 22ee36404c..7da49caf69 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -38,8 +38,8 @@ struct VFIOAPDevice { }; typedef struct VFIOAPDevice VFIOAPDevice; -#define VFIO_AP_DEVICE(obj) \ - OBJECT_CHECK(VFIOAPDevice, (obj), VFIO_AP_DEVICE_TYPE) +DECLARE_INSTANCE_CHECKER(VFIOAPDevice, VFIO_AP_DEVICE, + VFIO_AP_DEVICE_TYPE) static void vfio_ap_compute_needs_reset(VFIODevice *vdev) { diff --git a/hw/virtio/vhost-scsi-pci.c b/hw/virtio/vhost-scsi-pci.c index 2e836c3529..1fbc76b7c5 100644 --- a/hw/virtio/vhost-scsi-pci.c +++ b/hw/virtio/vhost-scsi-pci.c @@ -30,8 +30,8 @@ typedef struct VHostSCSIPCI VHostSCSIPCI; * vhost-scsi-pci: This extends VirtioPCIProxy. */ #define TYPE_VHOST_SCSI_PCI "vhost-scsi-pci-base" -#define VHOST_SCSI_PCI(obj) \ - OBJECT_CHECK(VHostSCSIPCI, (obj), TYPE_VHOST_SCSI_PCI) +DECLARE_INSTANCE_CHECKER(VHostSCSIPCI, VHOST_SCSI_PCI, + TYPE_VHOST_SCSI_PCI) struct VHostSCSIPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/vhost-user-blk-pci.c b/hw/virtio/vhost-user-blk-pci.c index 72ae695d24..42b0b5485b 100644 --- a/hw/virtio/vhost-user-blk-pci.c +++ b/hw/virtio/vhost-user-blk-pci.c @@ -35,8 +35,8 @@ typedef struct VHostUserBlkPCI VHostUserBlkPCI; * vhost-user-blk-pci: This extends VirtioPCIProxy. */ #define TYPE_VHOST_USER_BLK_PCI "vhost-user-blk-pci-base" -#define VHOST_USER_BLK_PCI(obj) \ - OBJECT_CHECK(VHostUserBlkPCI, (obj), TYPE_VHOST_USER_BLK_PCI) +DECLARE_INSTANCE_CHECKER(VHostUserBlkPCI, VHOST_USER_BLK_PCI, + TYPE_VHOST_USER_BLK_PCI) struct VHostUserBlkPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/vhost-user-fs-pci.c b/hw/virtio/vhost-user-fs-pci.c index 6b01561c2f..8bb389bd28 100644 --- a/hw/virtio/vhost-user-fs-pci.c +++ b/hw/virtio/vhost-user-fs-pci.c @@ -26,8 +26,8 @@ typedef struct VHostUserFSPCI VHostUserFSPCI; #define TYPE_VHOST_USER_FS_PCI "vhost-user-fs-pci-base" -#define VHOST_USER_FS_PCI(obj) \ - OBJECT_CHECK(VHostUserFSPCI, (obj), TYPE_VHOST_USER_FS_PCI) +DECLARE_INSTANCE_CHECKER(VHostUserFSPCI, VHOST_USER_FS_PCI, + TYPE_VHOST_USER_FS_PCI) static Property vhost_user_fs_pci_properties[] = { DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, diff --git a/hw/virtio/vhost-user-input-pci.c b/hw/virtio/vhost-user-input-pci.c index b072fb576a..c9d3e9113a 100644 --- a/hw/virtio/vhost-user-input-pci.c +++ b/hw/virtio/vhost-user-input-pci.c @@ -16,8 +16,8 @@ typedef struct VHostUserInputPCI VHostUserInputPCI; #define TYPE_VHOST_USER_INPUT_PCI "vhost-user-input-pci" -#define VHOST_USER_INPUT_PCI(obj) \ - OBJECT_CHECK(VHostUserInputPCI, (obj), TYPE_VHOST_USER_INPUT_PCI) +DECLARE_INSTANCE_CHECKER(VHostUserInputPCI, VHOST_USER_INPUT_PCI, + TYPE_VHOST_USER_INPUT_PCI) struct VHostUserInputPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/vhost-user-scsi-pci.c b/hw/virtio/vhost-user-scsi-pci.c index 331f3e4346..d4a600d8dc 100644 --- a/hw/virtio/vhost-user-scsi-pci.c +++ b/hw/virtio/vhost-user-scsi-pci.c @@ -36,8 +36,8 @@ typedef struct VHostUserSCSIPCI VHostUserSCSIPCI; #define TYPE_VHOST_USER_SCSI_PCI "vhost-user-scsi-pci-base" -#define VHOST_USER_SCSI_PCI(obj) \ - OBJECT_CHECK(VHostUserSCSIPCI, (obj), TYPE_VHOST_USER_SCSI_PCI) +DECLARE_INSTANCE_CHECKER(VHostUserSCSIPCI, VHOST_USER_SCSI_PCI, + TYPE_VHOST_USER_SCSI_PCI) struct VHostUserSCSIPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/vhost-user-vsock-pci.c b/hw/virtio/vhost-user-vsock-pci.c index 65bfc91d2d..763f89984e 100644 --- a/hw/virtio/vhost-user-vsock-pci.c +++ b/hw/virtio/vhost-user-vsock-pci.c @@ -21,8 +21,8 @@ typedef struct VHostUserVSockPCI VHostUserVSockPCI; * vhost-user-vsock-pci: This extends VirtioPCIProxy. */ #define TYPE_VHOST_USER_VSOCK_PCI "vhost-user-vsock-pci-base" -#define VHOST_USER_VSOCK_PCI(obj) \ - OBJECT_CHECK(VHostUserVSockPCI, (obj), TYPE_VHOST_USER_VSOCK_PCI) +DECLARE_INSTANCE_CHECKER(VHostUserVSockPCI, VHOST_USER_VSOCK_PCI, + TYPE_VHOST_USER_VSOCK_PCI) struct VHostUserVSockPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/vhost-vsock-pci.c b/hw/virtio/vhost-vsock-pci.c index 49fcddcb5a..e56067b427 100644 --- a/hw/virtio/vhost-vsock-pci.c +++ b/hw/virtio/vhost-vsock-pci.c @@ -25,8 +25,8 @@ typedef struct VHostVSockPCI VHostVSockPCI; * vhost-vsock-pci: This extends VirtioPCIProxy. */ #define TYPE_VHOST_VSOCK_PCI "vhost-vsock-pci-base" -#define VHOST_VSOCK_PCI(obj) \ - OBJECT_CHECK(VHostVSockPCI, (obj), TYPE_VHOST_VSOCK_PCI) +DECLARE_INSTANCE_CHECKER(VHostVSockPCI, VHOST_VSOCK_PCI, + TYPE_VHOST_VSOCK_PCI) struct VHostVSockPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-9p-pci.c b/hw/virtio/virtio-9p-pci.c index 8ea357b868..e07adcd9ea 100644 --- a/hw/virtio/virtio-9p-pci.c +++ b/hw/virtio/virtio-9p-pci.c @@ -27,8 +27,8 @@ #define TYPE_VIRTIO_9P_PCI "virtio-9p-pci-base" typedef struct V9fsPCIState V9fsPCIState; -#define VIRTIO_9P_PCI(obj) \ - OBJECT_CHECK(V9fsPCIState, (obj), TYPE_VIRTIO_9P_PCI) +DECLARE_INSTANCE_CHECKER(V9fsPCIState, VIRTIO_9P_PCI, + TYPE_VIRTIO_9P_PCI) struct V9fsPCIState { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-balloon-pci.c b/hw/virtio/virtio-balloon-pci.c index 35378c7309..a2c5cc7207 100644 --- a/hw/virtio/virtio-balloon-pci.c +++ b/hw/virtio/virtio-balloon-pci.c @@ -27,8 +27,8 @@ typedef struct VirtIOBalloonPCI VirtIOBalloonPCI; * virtio-balloon-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_BALLOON_PCI "virtio-balloon-pci-base" -#define VIRTIO_BALLOON_PCI(obj) \ - OBJECT_CHECK(VirtIOBalloonPCI, (obj), TYPE_VIRTIO_BALLOON_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOBalloonPCI, VIRTIO_BALLOON_PCI, + TYPE_VIRTIO_BALLOON_PCI) struct VirtIOBalloonPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-blk-pci.c b/hw/virtio/virtio-blk-pci.c index 80771954ee..4591dc53c8 100644 --- a/hw/virtio/virtio-blk-pci.c +++ b/hw/virtio/virtio-blk-pci.c @@ -30,8 +30,8 @@ typedef struct VirtIOBlkPCI VirtIOBlkPCI; * virtio-blk-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci-base" -#define VIRTIO_BLK_PCI(obj) \ - OBJECT_CHECK(VirtIOBlkPCI, (obj), TYPE_VIRTIO_BLK_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOBlkPCI, VIRTIO_BLK_PCI, + TYPE_VIRTIO_BLK_PCI) struct VirtIOBlkPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-crypto-pci.c b/hw/virtio/virtio-crypto-pci.c index 518a87a36e..0783dc2f7e 100644 --- a/hw/virtio/virtio-crypto-pci.c +++ b/hw/virtio/virtio-crypto-pci.c @@ -29,8 +29,8 @@ typedef struct VirtIOCryptoPCI VirtIOCryptoPCI; * virtio-crypto-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_CRYPTO_PCI "virtio-crypto-pci" -#define VIRTIO_CRYPTO_PCI(obj) \ - OBJECT_CHECK(VirtIOCryptoPCI, (obj), TYPE_VIRTIO_CRYPTO_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOCryptoPCI, VIRTIO_CRYPTO_PCI, + TYPE_VIRTIO_CRYPTO_PCI) struct VirtIOCryptoPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-input-host-pci.c b/hw/virtio/virtio-input-host-pci.c index 4d8479c92e..0ac360de4f 100644 --- a/hw/virtio/virtio-input-host-pci.c +++ b/hw/virtio/virtio-input-host-pci.c @@ -16,8 +16,8 @@ typedef struct VirtIOInputHostPCI VirtIOInputHostPCI; #define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci" -#define VIRTIO_INPUT_HOST_PCI(obj) \ - OBJECT_CHECK(VirtIOInputHostPCI, (obj), TYPE_VIRTIO_INPUT_HOST_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOInputHostPCI, VIRTIO_INPUT_HOST_PCI, + TYPE_VIRTIO_INPUT_HOST_PCI) struct VirtIOInputHostPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-input-pci.c b/hw/virtio/virtio-input-pci.c index 205ed7bec9..03df5387d1 100644 --- a/hw/virtio/virtio-input-pci.c +++ b/hw/virtio/virtio-input-pci.c @@ -20,8 +20,8 @@ typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI; /* * virtio-input-pci: This extends VirtioPCIProxy. */ -#define VIRTIO_INPUT_PCI(obj) \ - OBJECT_CHECK(VirtIOInputPCI, (obj), TYPE_VIRTIO_INPUT_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOInputPCI, VIRTIO_INPUT_PCI, + TYPE_VIRTIO_INPUT_PCI) struct VirtIOInputPCI { VirtIOPCIProxy parent_obj; @@ -32,8 +32,8 @@ struct VirtIOInputPCI { #define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci" #define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci" #define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci" -#define VIRTIO_INPUT_HID_PCI(obj) \ - OBJECT_CHECK(VirtIOInputHIDPCI, (obj), TYPE_VIRTIO_INPUT_HID_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOInputHIDPCI, VIRTIO_INPUT_HID_PCI, + TYPE_VIRTIO_INPUT_HID_PCI) struct VirtIOInputHIDPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 17451f5a78..76540e57b1 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -24,8 +24,8 @@ typedef struct VirtIOIOMMUPCI VirtIOIOMMUPCI; * virtio-iommu-pci: This extends VirtioPCIProxy. * */ -#define VIRTIO_IOMMU_PCI(obj) \ - OBJECT_CHECK(VirtIOIOMMUPCI, (obj), TYPE_VIRTIO_IOMMU_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOIOMMUPCI, VIRTIO_IOMMU_PCI, + TYPE_VIRTIO_IOMMU_PCI) struct VirtIOIOMMUPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-net-pci.c b/hw/virtio/virtio-net-pci.c index 498fc02d8f..292d13d278 100644 --- a/hw/virtio/virtio-net-pci.c +++ b/hw/virtio/virtio-net-pci.c @@ -30,8 +30,8 @@ typedef struct VirtIONetPCI VirtIONetPCI; * virtio-net-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_NET_PCI "virtio-net-pci-base" -#define VIRTIO_NET_PCI(obj) \ - OBJECT_CHECK(VirtIONetPCI, (obj), TYPE_VIRTIO_NET_PCI) +DECLARE_INSTANCE_CHECKER(VirtIONetPCI, VIRTIO_NET_PCI, + TYPE_VIRTIO_NET_PCI) struct VirtIONetPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-rng-pci.c b/hw/virtio/virtio-rng-pci.c index 8f953dff83..c1f916268b 100644 --- a/hw/virtio/virtio-rng-pci.c +++ b/hw/virtio/virtio-rng-pci.c @@ -23,8 +23,8 @@ typedef struct VirtIORngPCI VirtIORngPCI; * virtio-rng-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_RNG_PCI "virtio-rng-pci-base" -#define VIRTIO_RNG_PCI(obj) \ - OBJECT_CHECK(VirtIORngPCI, (obj), TYPE_VIRTIO_RNG_PCI) +DECLARE_INSTANCE_CHECKER(VirtIORngPCI, VIRTIO_RNG_PCI, + TYPE_VIRTIO_RNG_PCI) struct VirtIORngPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-scsi-pci.c b/hw/virtio/virtio-scsi-pci.c index 6106bb38ae..20ae6f1cc3 100644 --- a/hw/virtio/virtio-scsi-pci.c +++ b/hw/virtio/virtio-scsi-pci.c @@ -27,8 +27,8 @@ typedef struct VirtIOSCSIPCI VirtIOSCSIPCI; * virtio-scsi-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_SCSI_PCI "virtio-scsi-pci-base" -#define VIRTIO_SCSI_PCI(obj) \ - OBJECT_CHECK(VirtIOSCSIPCI, (obj), TYPE_VIRTIO_SCSI_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOSCSIPCI, VIRTIO_SCSI_PCI, + TYPE_VIRTIO_SCSI_PCI) struct VirtIOSCSIPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/virtio/virtio-serial-pci.c b/hw/virtio/virtio-serial-pci.c index 1bd769e88d..35bcd961c9 100644 --- a/hw/virtio/virtio-serial-pci.c +++ b/hw/virtio/virtio-serial-pci.c @@ -29,8 +29,8 @@ typedef struct VirtIOSerialPCI VirtIOSerialPCI; * virtio-serial-pci: This extends VirtioPCIProxy. */ #define TYPE_VIRTIO_SERIAL_PCI "virtio-serial-pci-base" -#define VIRTIO_SERIAL_PCI(obj) \ - OBJECT_CHECK(VirtIOSerialPCI, (obj), TYPE_VIRTIO_SERIAL_PCI) +DECLARE_INSTANCE_CHECKER(VirtIOSerialPCI, VIRTIO_SERIAL_PCI, + TYPE_VIRTIO_SERIAL_PCI) struct VirtIOSerialPCI { VirtIOPCIProxy parent_obj; diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 219c628f66..0212d0c4f5 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -105,8 +105,8 @@ struct I6300State { typedef struct I6300State I6300State; #define TYPE_WATCHDOG_I6300ESB_DEVICE "i6300esb" -#define WATCHDOG_I6300ESB_DEVICE(obj) \ - OBJECT_CHECK(I6300State, (obj), TYPE_WATCHDOG_I6300ESB_DEVICE) +DECLARE_INSTANCE_CHECKER(I6300State, WATCHDOG_I6300ESB_DEVICE, + TYPE_WATCHDOG_I6300ESB_DEVICE) /* This function is called when the watchdog has either been enabled * (hence it starts counting down) or has been keep-alived. diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c index 61d80c0913..4c92369669 100644 --- a/hw/watchdog/wdt_ib700.c +++ b/hw/watchdog/wdt_ib700.c @@ -38,7 +38,8 @@ #define TYPE_IB700 "ib700" typedef struct IB700state IB700State; -#define IB700(obj) OBJECT_CHECK(IB700State, (obj), TYPE_IB700) +DECLARE_INSTANCE_CHECKER(IB700State, IB700, + TYPE_IB700) struct IB700state { ISADevice parent_obj; diff --git a/iothread.c b/iothread.c index c94d139e16..c911e0498c 100644 --- a/iothread.c +++ b/iothread.c @@ -26,10 +26,8 @@ typedef ObjectClass IOThreadClass; -#define IOTHREAD_GET_CLASS(obj) \ - OBJECT_GET_CLASS(IOThreadClass, obj, TYPE_IOTHREAD) -#define IOTHREAD_CLASS(klass) \ - OBJECT_CLASS_CHECK(IOThreadClass, klass, TYPE_IOTHREAD) +DECLARE_CLASS_CHECKERS(IOThreadClass, IOTHREAD, + TYPE_IOTHREAD) #ifdef CONFIG_POSIX /* Benchmark results from 2016 on NVMe SSD drives show max polling times around diff --git a/migration/rdma.c b/migration/rdma.c index e3eac913bc..87cb277d05 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -399,8 +399,8 @@ typedef struct RDMAContext { #define TYPE_QIO_CHANNEL_RDMA "qio-channel-rdma" typedef struct QIOChannelRDMA QIOChannelRDMA; -#define QIO_CHANNEL_RDMA(obj) \ - OBJECT_CHECK(QIOChannelRDMA, (obj), TYPE_QIO_CHANNEL_RDMA) +DECLARE_INSTANCE_CHECKER(QIOChannelRDMA, QIO_CHANNEL_RDMA, + TYPE_QIO_CHANNEL_RDMA) diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c index b6fc55dc44..ff96bf32c9 100644 --- a/net/can/can_socketcan.c +++ b/net/can/can_socketcan.c @@ -48,8 +48,8 @@ #define TYPE_CAN_HOST_SOCKETCAN "can-host-socketcan" typedef struct CanHostSocketCAN CanHostSocketCAN; -#define CAN_HOST_SOCKETCAN(obj) \ - OBJECT_CHECK(CanHostSocketCAN, (obj), TYPE_CAN_HOST_SOCKETCAN) +DECLARE_INSTANCE_CHECKER(CanHostSocketCAN, CAN_HOST_SOCKETCAN, + TYPE_CAN_HOST_SOCKETCAN) #define CAN_READ_BUF_LEN 5 struct CanHostSocketCAN { diff --git a/net/colo-compare.c b/net/colo-compare.c index 01fc7027ae..86d55497d2 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -37,8 +37,8 @@ #define TYPE_COLO_COMPARE "colo-compare" typedef struct CompareState CompareState; -#define COLO_COMPARE(obj) \ - OBJECT_CHECK(CompareState, (obj), TYPE_COLO_COMPARE) +DECLARE_INSTANCE_CHECKER(CompareState, COLO_COMPARE, + TYPE_COLO_COMPARE) static QTAILQ_HEAD(, CompareState) net_compares = QTAILQ_HEAD_INITIALIZER(net_compares); diff --git a/net/dump.c b/net/dump.c index b3d69ece8f..94845d2bb1 100644 --- a/net/dump.c +++ b/net/dump.c @@ -141,8 +141,8 @@ static int net_dump_state_init(DumpState *s, const char *filename, #define TYPE_FILTER_DUMP "filter-dump" typedef struct NetFilterDumpState NetFilterDumpState; -#define FILTER_DUMP(obj) \ - OBJECT_CHECK(NetFilterDumpState, (obj), TYPE_FILTER_DUMP) +DECLARE_INSTANCE_CHECKER(NetFilterDumpState, FILTER_DUMP, + TYPE_FILTER_DUMP) struct NetFilterDumpState { NetFilterState nfs; diff --git a/net/filter-buffer.c b/net/filter-buffer.c index c6b87f6b5f..ae31c98c34 100644 --- a/net/filter-buffer.c +++ b/net/filter-buffer.c @@ -19,8 +19,8 @@ #define TYPE_FILTER_BUFFER "filter-buffer" typedef struct FilterBufferState FilterBufferState; -#define FILTER_BUFFER(obj) \ - OBJECT_CHECK(FilterBufferState, (obj), TYPE_FILTER_BUFFER) +DECLARE_INSTANCE_CHECKER(FilterBufferState, FILTER_BUFFER, + TYPE_FILTER_BUFFER) struct FilterBufferState { NetFilterState parent_obj; diff --git a/net/filter-mirror.c b/net/filter-mirror.c index e34542db42..f31eb6ad4c 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -23,12 +23,12 @@ #define TYPE_FILTER_MIRROR "filter-mirror" typedef struct MirrorState MirrorState; -#define FILTER_MIRROR(obj) \ - OBJECT_CHECK(MirrorState, (obj), TYPE_FILTER_MIRROR) +DECLARE_INSTANCE_CHECKER(MirrorState, FILTER_MIRROR, + TYPE_FILTER_MIRROR) #define TYPE_FILTER_REDIRECTOR "filter-redirector" -#define FILTER_REDIRECTOR(obj) \ - OBJECT_CHECK(MirrorState, (obj), TYPE_FILTER_REDIRECTOR) +DECLARE_INSTANCE_CHECKER(MirrorState, FILTER_REDIRECTOR, + TYPE_FILTER_REDIRECTOR) #define REDIRECTOR_MAX_LEN NET_BUFSIZE diff --git a/net/filter-replay.c b/net/filter-replay.c index bc8e641dda..52ba08ca63 100644 --- a/net/filter-replay.c +++ b/net/filter-replay.c @@ -24,8 +24,8 @@ #define TYPE_FILTER_REPLAY "filter-replay" typedef struct NetFilterReplayState NetFilterReplayState; -#define FILTER_REPLAY(obj) \ - OBJECT_CHECK(NetFilterReplayState, (obj), TYPE_FILTER_REPLAY) +DECLARE_INSTANCE_CHECKER(NetFilterReplayState, FILTER_REPLAY, + TYPE_FILTER_REPLAY) struct NetFilterReplayState { NetFilterState nfs; diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index 8538942c1c..8c42b78631 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -25,8 +25,8 @@ #define TYPE_FILTER_REWRITER "filter-rewriter" typedef struct RewriterState RewriterState; -#define FILTER_COLO_REWRITER(obj) \ - OBJECT_CHECK(RewriterState, (obj), TYPE_FILTER_REWRITER) +DECLARE_INSTANCE_CHECKER(RewriterState, FILTER_COLO_REWRITER, + TYPE_FILTER_REWRITER) #define FAILOVER_MODE_ON true #define FAILOVER_MODE_OFF false diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c index 4fb64e387d..78ea5cceb9 100644 --- a/scsi/pr-manager-helper.c +++ b/scsi/pr-manager-helper.c @@ -28,9 +28,8 @@ #define TYPE_PR_MANAGER_HELPER "pr-manager-helper" typedef struct PRManagerHelper PRManagerHelper; -#define PR_MANAGER_HELPER(obj) \ - OBJECT_CHECK(PRManagerHelper, (obj), \ - TYPE_PR_MANAGER_HELPER) +DECLARE_INSTANCE_CHECKER(PRManagerHelper, PR_MANAGER_HELPER, + TYPE_PR_MANAGER_HELPER) struct PRManagerHelper { /* */ diff --git a/target/i386/sev.c b/target/i386/sev.c index 8f9afa5aa1..097b4585cc 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -32,8 +32,8 @@ #define TYPE_SEV_GUEST "sev-guest" typedef struct SevGuestState SevGuestState; -#define SEV_GUEST(obj) \ - OBJECT_CHECK(SevGuestState, (obj), TYPE_SEV_GUEST) +DECLARE_INSTANCE_CHECKER(SevGuestState, SEV_GUEST, + TYPE_SEV_GUEST) /** diff --git a/tests/check-qom-interface.c b/tests/check-qom-interface.c index bfa9ad5d19..c99be97ed8 100644 --- a/tests/check-qom-interface.c +++ b/tests/check-qom-interface.c @@ -17,10 +17,8 @@ #define TYPE_TEST_IF "test-interface" typedef struct TestIfClass TestIfClass; -#define TEST_IF_CLASS(klass) \ - OBJECT_CLASS_CHECK(TestIfClass, (klass), TYPE_TEST_IF) -#define TEST_IF_GET_CLASS(obj) \ - OBJECT_GET_CLASS(TestIfClass, (obj), TYPE_TEST_IF) +DECLARE_CLASS_CHECKERS(TestIfClass, TEST_IF, + TYPE_TEST_IF) #define TEST_IF(obj) \ INTERFACE_CHECK(TestIf, (obj), TYPE_TEST_IF) diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index e1e0a96661..1571606c1c 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -33,8 +33,8 @@ typedef struct DummyObject DummyObject; typedef struct DummyObjectClass DummyObjectClass; -#define DUMMY_OBJECT(obj) \ - OBJECT_CHECK(DummyObject, (obj), TYPE_DUMMY) +DECLARE_INSTANCE_CHECKER(DummyObject, DUMMY_OBJECT, + TYPE_DUMMY) typedef enum DummyAnimal DummyAnimal; @@ -196,12 +196,12 @@ typedef struct DummyBackendClass DummyBackendClass; #define TYPE_DUMMY_BUS "qemu-dummy-bus" #define TYPE_DUMMY_BACKEND "qemu-dummy-backend" -#define DUMMY_DEV(obj) \ - OBJECT_CHECK(DummyDev, (obj), TYPE_DUMMY_DEV) -#define DUMMY_BUS(obj) \ - OBJECT_CHECK(DummyBus, (obj), TYPE_DUMMY_BUS) -#define DUMMY_BACKEND(obj) \ - OBJECT_CHECK(DummyBackend, (obj), TYPE_DUMMY_BACKEND) +DECLARE_INSTANCE_CHECKER(DummyDev, DUMMY_DEV, + TYPE_DUMMY_DEV) +DECLARE_INSTANCE_CHECKER(DummyBus, DUMMY_BUS, + TYPE_DUMMY_BUS) +DECLARE_INSTANCE_CHECKER(DummyBackend, DUMMY_BACKEND, + TYPE_DUMMY_BACKEND) struct DummyDev { Object parent_obj; diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index c3e210a9ef..8a3c14d92c 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -32,8 +32,8 @@ #define TYPE_STATIC_PROPS "static_prop_type" typedef struct MyType MyType; -#define STATIC_TYPE(obj) \ - OBJECT_CHECK(MyType, (obj), TYPE_STATIC_PROPS) +DECLARE_INSTANCE_CHECKER(MyType, STATIC_TYPE, + TYPE_STATIC_PROPS) #define TYPE_SUBCLASS "static_prop_subtype" @@ -128,8 +128,8 @@ static void test_static_globalprop(void) } #define TYPE_DYNAMIC_PROPS "dynamic-prop-type" -#define DYNAMIC_TYPE(obj) \ - OBJECT_CHECK(MyType, (obj), TYPE_DYNAMIC_PROPS) +DECLARE_INSTANCE_CHECKER(MyType, DYNAMIC_TYPE, + TYPE_DYNAMIC_PROPS) #define TYPE_UNUSED_HOTPLUG "hotplug-type" #define TYPE_UNUSED_NOHOTPLUG "nohotplug-type" diff --git a/ui/console.c b/ui/console.c index b9072bdaf9..8b90b9c378 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1090,7 +1090,8 @@ struct VCChardev { typedef struct VCChardev VCChardev; #define TYPE_CHARDEV_VC "chardev-vc" -#define VC_CHARDEV(obj) OBJECT_CHECK(VCChardev, (obj), TYPE_CHARDEV_VC) +DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, + TYPE_CHARDEV_VC) static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len) { diff --git a/ui/gtk.c b/ui/gtk.c index 558c63dc22..d28d7545d3 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -179,7 +179,8 @@ struct VCChardev { typedef struct VCChardev VCChardev; #define TYPE_CHARDEV_VC "chardev-vc" -#define VC_CHARDEV(obj) OBJECT_CHECK(VCChardev, (obj), TYPE_CHARDEV_VC) +DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, + TYPE_CHARDEV_VC) bool gtk_use_gl_area; diff --git a/ui/input-barrier.c b/ui/input-barrier.c index 52208e5658..ece32a56e6 100644 --- a/ui/input-barrier.c +++ b/ui/input-barrier.c @@ -22,12 +22,8 @@ #define TYPE_INPUT_BARRIER "input-barrier" typedef struct InputBarrier InputBarrier; typedef struct InputBarrierClass InputBarrierClass; -#define INPUT_BARRIER(obj) \ - OBJECT_CHECK(InputBarrier, (obj), TYPE_INPUT_BARRIER) -#define INPUT_BARRIER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(InputBarrierClass, (obj), TYPE_INPUT_BARRIER) -#define INPUT_BARRIER_CLASS(klass) \ - OBJECT_CLASS_CHECK(InputBarrierClass, (klass), TYPE_INPUT_BARRIER) +DECLARE_OBJ_CHECKERS(InputBarrier, InputBarrierClass, + INPUT_BARRIER, TYPE_INPUT_BARRIER) #define MAX_HELLO_LENGTH 1024 diff --git a/ui/input-linux.c b/ui/input-linux.c index 9e5688e3f6..77988e8c71 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -33,12 +33,8 @@ static bool linux_is_button(unsigned int lnx) #define TYPE_INPUT_LINUX "input-linux" typedef struct InputLinux InputLinux; typedef struct InputLinuxClass InputLinuxClass; -#define INPUT_LINUX(obj) \ - OBJECT_CHECK(InputLinux, (obj), TYPE_INPUT_LINUX) -#define INPUT_LINUX_GET_CLASS(obj) \ - OBJECT_GET_CLASS(InputLinuxClass, (obj), TYPE_INPUT_LINUX) -#define INPUT_LINUX_CLASS(klass) \ - OBJECT_CLASS_CHECK(InputLinuxClass, (klass), TYPE_INPUT_LINUX) +DECLARE_OBJ_CHECKERS(InputLinux, InputLinuxClass, + INPUT_LINUX, TYPE_INPUT_LINUX) struct InputLinux { diff --git a/ui/spice-app.c b/ui/spice-app.c index d68a35c3b1..93e105c6ee 100644 --- a/ui/spice-app.c +++ b/ui/spice-app.c @@ -47,7 +47,8 @@ struct VCChardev { typedef struct VCChardev VCChardev; #define TYPE_CHARDEV_VC "chardev-vc" -#define VC_CHARDEV(obj) OBJECT_CHECK(VCChardev, (obj), TYPE_CHARDEV_VC) +DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV, + TYPE_CHARDEV_VC) static ChardevBackend * chr_spice_backend_new(void) From patchwork Thu Aug 13 22:26:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28C95C433DF for ; Thu, 13 Aug 2020 22:35:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C6B77204EC for ; Thu, 13 Aug 2020 22:35:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RUTA9Iav" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6B77204EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6LoP-0001rk-1M for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:35:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Lh0-0006K1-7T for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:26 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34964 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgu-0002wO-O8 for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5/5I76+c9AbTaWqM5TBnD1xMmAoU+eswzvNFJIPRJzk=; b=RUTA9IavW7WIZDsXdyVghM8y2l3XB0nanri32Lvbs2of2krqQ8gpu+71+X7Q37t1+v1yN4 Hllb5j55QkcUaHkk4PMnvaQ3F6rDhkgExX7BaH+z5HmUZAUac5ilCLpZL8TgQg2PeAzrhn why7ND1O/w52sLyAm2nesZk+Yf3U/ow= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-76RfJPjjOkyYh1VBN4mS8g-1; Thu, 13 Aug 2020 18:27:18 -0400 X-MC-Unique: 76RfJPjjOkyYh1VBN4mS8g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F438100CA88 for ; Thu, 13 Aug 2020 22:27:17 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFA495C1A3; Thu, 13 Aug 2020 22:27:16 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 37/41] [automated] Use DECLARE_*CHECKER* when possible (--force mode) Date: Thu, 13 Aug 2020 18:26:21 -0400 Message-Id: <20200813222625.243136-38-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=ehabkost@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 18:26:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Separate run of the script using the --force flag, for the cases where the typedef wasn't found in the same header. Generated using: $ ./scripts/codeconverter/converter.py --force -i \ --pattern=TypeCheckMacro $(git grep -l '' -- '*.[ch]') This is being done as a separate commit because it has more potential to break the build because typedefs might be really unavailable. Signed-off-by: Eduardo Habkost --- hw/ide/ahci_internal.h | 7 ++++--- include/chardev/char.h | 7 ++----- include/exec/memory.h | 14 ++++---------- include/hw/arm/omap.h | 8 ++++---- include/hw/boards.h | 8 ++------ include/hw/i2c/i2c.h | 3 ++- include/hw/i386/pc.h | 8 ++------ include/hw/intc/arm_gic.h | 8 ++------ include/hw/intc/arm_gicv3.h | 7 ++----- include/hw/isa/isa.h | 11 ++++------- include/hw/nvram/fw_cfg.h | 9 ++++++--- include/hw/pci/pci.h | 13 ++++--------- include/hw/pci/pci_bridge.h | 3 ++- include/hw/pci/pci_host.h | 8 ++------ include/hw/pci/pcie_host.h | 4 ++-- include/hw/pci/pcie_port.h | 6 ++++-- include/hw/ppc/spapr.h | 12 ++++-------- include/hw/ppc/xics_spapr.h | 3 ++- include/hw/qdev-core.h | 10 ++++------ include/hw/s390x/event-facility.h | 10 ++-------- include/hw/sysbus.h | 3 ++- include/hw/virtio/virtio-mmio.h | 8 ++------ include/hw/virtio/virtio.h | 8 ++------ include/hw/xen/xen-legacy-backend.h | 4 ++-- include/net/filter.h | 8 ++------ include/sysemu/kvm_int.h | 4 ++-- include/ui/console.h | 8 ++------ hw/arm/pxa2xx.c | 7 ++++--- hw/char/virtio-serial-bus.c | 4 ++-- hw/core/irq.c | 3 ++- hw/display/vhost-user-gpu.c | 4 ++-- hw/display/vmware_vga.c | 4 ++-- hw/dma/i8257.c | 4 ++-- hw/hyperv/vmbus.c | 3 ++- hw/ide/ahci-allwinner.c | 4 ++-- hw/input/pckbd.c | 3 ++- hw/intc/apic.c | 4 ++-- hw/intc/arm_gic_kvm.c | 8 ++------ hw/intc/arm_gicv3_its_kvm.c | 7 ++----- hw/intc/arm_gicv3_kvm.c | 8 ++------ hw/intc/etraxfs_pic.c | 4 ++-- hw/intc/loongson_liointc.c | 4 ++-- hw/intc/xilinx_intc.c | 3 ++- hw/isa/piix3.c | 4 ++-- hw/misc/auxbus.c | 3 ++- hw/net/rocker/rocker.c | 4 ++-- hw/net/xilinx_ethlite.c | 4 ++-- hw/pci-host/pnv_phb3.c | 4 ++-- hw/pci-host/pnv_phb4.c | 4 ++-- hw/pci-host/versatile.c | 4 ++-- hw/pcmcia/pxa2xx.c | 4 ++-- hw/scsi/mptsas.c | 4 ++-- hw/sd/allwinner-sdhost.c | 4 ++-- hw/sd/bcm2835_sdhost.c | 4 ++-- hw/sd/pxa2xx_mmci.c | 6 ++++-- hw/sd/sdhci.c | 3 ++- hw/ssi/ssi.c | 3 ++- hw/timer/xilinx_timer.c | 4 ++-- hw/vfio/pci.c | 3 ++- 59 files changed, 142 insertions(+), 196 deletions(-) diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h index 8c1b86021b..9ac085dad2 100644 --- a/hw/ide/ahci_internal.h +++ b/hw/ide/ahci_internal.h @@ -333,8 +333,8 @@ struct AHCIPCIState { AHCIState ahci; }; -#define ICH_AHCI(obj) \ - OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI) +DECLARE_INSTANCE_CHECKER(AHCIPCIState, ICH_AHCI, + TYPE_ICH9_AHCI) extern const VMStateDescription vmstate_ahci; @@ -395,6 +395,7 @@ void ahci_uninit(AHCIState *s); void ahci_reset(AHCIState *s); -#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI) +DECLARE_INSTANCE_CHECKER(SysbusAHCIState, SYSBUS_AHCI, + TYPE_SYSBUS_AHCI) #endif /* HW_IDE_AHCI_INTERNAL_H */ diff --git a/include/chardev/char.h b/include/chardev/char.h index d91d851b33..5874de57ea 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -227,11 +227,8 @@ int qemu_chr_wait_connected(Chardev *chr, Error **errp); #define TYPE_CHARDEV "chardev" typedef struct ChardevClass ChardevClass; -#define CHARDEV(obj) OBJECT_CHECK(Chardev, (obj), TYPE_CHARDEV) -#define CHARDEV_CLASS(klass) \ - OBJECT_CLASS_CHECK(ChardevClass, (klass), TYPE_CHARDEV) -#define CHARDEV_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ChardevClass, (obj), TYPE_CHARDEV) +DECLARE_OBJ_CHECKERS(Chardev, ChardevClass, + CHARDEV, TYPE_CHARDEV) #define TYPE_CHARDEV_NULL "chardev-null" #define TYPE_CHARDEV_MUX "chardev-mux" diff --git a/include/exec/memory.h b/include/exec/memory.h index 6be7072ac5..96e33f700f 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -34,19 +34,13 @@ #define MAX_PHYS_ADDR (((hwaddr)1 << MAX_PHYS_ADDR_SPACE_BITS) - 1) #define TYPE_MEMORY_REGION "qemu:memory-region" -#define MEMORY_REGION(obj) \ - OBJECT_CHECK(MemoryRegion, (obj), TYPE_MEMORY_REGION) +DECLARE_INSTANCE_CHECKER(MemoryRegion, MEMORY_REGION, + TYPE_MEMORY_REGION) #define TYPE_IOMMU_MEMORY_REGION "qemu:iommu-memory-region" typedef struct IOMMUMemoryRegionClass IOMMUMemoryRegionClass; -#define IOMMU_MEMORY_REGION(obj) \ - OBJECT_CHECK(IOMMUMemoryRegion, (obj), TYPE_IOMMU_MEMORY_REGION) -#define IOMMU_MEMORY_REGION_CLASS(klass) \ - OBJECT_CLASS_CHECK(IOMMUMemoryRegionClass, (klass), \ - TYPE_IOMMU_MEMORY_REGION) -#define IOMMU_MEMORY_REGION_GET_CLASS(obj) \ - OBJECT_GET_CLASS(IOMMUMemoryRegionClass, (obj), \ - TYPE_IOMMU_MEMORY_REGION) +DECLARE_OBJ_CHECKERS(IOMMUMemoryRegion, IOMMUMemoryRegionClass, + IOMMU_MEMORY_REGION, TYPE_IOMMU_MEMORY_REGION) extern bool global_dirty_log; diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h index 5eb51df8e9..0dbf1712f4 100644 --- a/include/hw/arm/omap.h +++ b/include/hw/arm/omap.h @@ -105,12 +105,12 @@ void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk); /* omap_gpio.c */ #define TYPE_OMAP1_GPIO "omap-gpio" -#define OMAP1_GPIO(obj) \ - OBJECT_CHECK(struct omap_gpif_s, (obj), TYPE_OMAP1_GPIO) +DECLARE_INSTANCE_CHECKER(struct omap_gpif_s, OMAP1_GPIO, + TYPE_OMAP1_GPIO) #define TYPE_OMAP2_GPIO "omap2-gpio" -#define OMAP2_GPIO(obj) \ - OBJECT_CHECK(struct omap2_gpif_s, (obj), TYPE_OMAP2_GPIO) +DECLARE_INSTANCE_CHECKER(struct omap2_gpif_s, OMAP2_GPIO, + TYPE_OMAP2_GPIO) typedef struct omap_gpif_s omap_gpif; typedef struct omap2_gpif_s omap2_gpif; diff --git a/include/hw/boards.h b/include/hw/boards.h index 426ce5f625..df6c0fc5fc 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -21,12 +21,8 @@ #define TYPE_MACHINE "machine" #undef MACHINE /* BSD defines it and QEMU does not use it */ -#define MACHINE(obj) \ - OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE) -#define MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE) -#define MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE) +DECLARE_OBJ_CHECKERS(MachineState, MachineClass, + MACHINE, TYPE_MACHINE) extern MachineState *current_machine; diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h index 164e86ee83..8afa74f42e 100644 --- a/include/hw/i2c/i2c.h +++ b/include/hw/i2c/i2c.h @@ -51,7 +51,8 @@ struct I2CSlave { }; #define TYPE_I2C_BUS "i2c-bus" -#define I2C_BUS(obj) OBJECT_CHECK(I2CBus, (obj), TYPE_I2C_BUS) +DECLARE_INSTANCE_CHECKER(I2CBus, I2C_BUS, + TYPE_I2C_BUS) typedef struct I2CNode I2CNode; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 7c90730a0a..31503345d7 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -123,12 +123,8 @@ struct PCMachineClass { typedef struct PCMachineClass PCMachineClass; #define TYPE_PC_MACHINE "generic-pc-machine" -#define PC_MACHINE(obj) \ - OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE) -#define PC_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE) -#define PC_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) +DECLARE_OBJ_CHECKERS(PCMachineState, PCMachineClass, + PC_MACHINE, TYPE_PC_MACHINE) /* ioapic.c */ diff --git a/include/hw/intc/arm_gic.h b/include/hw/intc/arm_gic.h index 704ef2b751..d1c1d9a906 100644 --- a/include/hw/intc/arm_gic.h +++ b/include/hw/intc/arm_gic.h @@ -74,12 +74,8 @@ #define TYPE_ARM_GIC "arm_gic" typedef struct ARMGICClass ARMGICClass; -#define ARM_GIC(obj) \ - OBJECT_CHECK(GICState, (obj), TYPE_ARM_GIC) -#define ARM_GIC_CLASS(klass) \ - OBJECT_CLASS_CHECK(ARMGICClass, (klass), TYPE_ARM_GIC) -#define ARM_GIC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ARMGICClass, (obj), TYPE_ARM_GIC) +DECLARE_OBJ_CHECKERS(GICState, ARMGICClass, + ARM_GIC, TYPE_ARM_GIC) struct ARMGICClass { /*< private >*/ diff --git a/include/hw/intc/arm_gicv3.h b/include/hw/intc/arm_gicv3.h index 58e9131a33..d0c59ea5c4 100644 --- a/include/hw/intc/arm_gicv3.h +++ b/include/hw/intc/arm_gicv3.h @@ -17,11 +17,8 @@ #define TYPE_ARM_GICV3 "arm-gicv3" typedef struct ARMGICv3Class ARMGICv3Class; -#define ARM_GICV3(obj) OBJECT_CHECK(GICv3State, (obj), TYPE_ARM_GICV3) -#define ARM_GICV3_CLASS(klass) \ - OBJECT_CLASS_CHECK(ARMGICv3Class, (klass), TYPE_ARM_GICV3) -#define ARM_GICV3_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ARMGICv3Class, (obj), TYPE_ARM_GICV3) +DECLARE_OBJ_CHECKERS(GICv3State, ARMGICv3Class, + ARM_GICV3, TYPE_ARM_GICV3) struct ARMGICv3Class { /*< private >*/ diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index 491e67de99..ddb6a2d168 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -12,15 +12,12 @@ #define TYPE_ISA_DEVICE "isa-device" typedef struct ISADeviceClass ISADeviceClass; -#define ISA_DEVICE(obj) \ - OBJECT_CHECK(ISADevice, (obj), TYPE_ISA_DEVICE) -#define ISA_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(ISADeviceClass, (klass), TYPE_ISA_DEVICE) -#define ISA_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ISADeviceClass, (obj), TYPE_ISA_DEVICE) +DECLARE_OBJ_CHECKERS(ISADevice, ISADeviceClass, + ISA_DEVICE, TYPE_ISA_DEVICE) #define TYPE_ISA_BUS "ISA" -#define ISA_BUS(obj) OBJECT_CHECK(ISABus, (obj), TYPE_ISA_BUS) +DECLARE_INSTANCE_CHECKER(ISABus, ISA_BUS, + TYPE_ISA_BUS) #define TYPE_APPLE_SMC "isa-applesmc" #define APPLESMC_MAX_DATA_LENGTH 32 diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index f101ff7bab..f85393400c 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -12,9 +12,12 @@ #define TYPE_FW_CFG_MEM "fw_cfg_mem" #define TYPE_FW_CFG_DATA_GENERATOR_INTERFACE "fw_cfg-data-generator" -#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG) -#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO) -#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM) +DECLARE_INSTANCE_CHECKER(FWCfgState, FW_CFG, + TYPE_FW_CFG) +DECLARE_INSTANCE_CHECKER(FWCfgIoState, FW_CFG_IO, + TYPE_FW_CFG_IO) +DECLARE_INSTANCE_CHECKER(FWCfgMemState, FW_CFG_MEM, + TYPE_FW_CFG_MEM) typedef struct FWCfgDataGeneratorClass FWCfgDataGeneratorClass; DECLARE_CLASS_CHECKERS(FWCfgDataGeneratorClass, FW_CFG_DATA_GENERATOR, diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index be9e298dba..c13ae1f858 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -197,12 +197,8 @@ enum { #define TYPE_PCI_DEVICE "pci-device" typedef struct PCIDeviceClass PCIDeviceClass; -#define PCI_DEVICE(obj) \ - OBJECT_CHECK(PCIDevice, (obj), TYPE_PCI_DEVICE) -#define PCI_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PCIDeviceClass, (klass), TYPE_PCI_DEVICE) -#define PCI_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PCIDeviceClass, (obj), TYPE_PCI_DEVICE) +DECLARE_OBJ_CHECKERS(PCIDevice, PCIDeviceClass, + PCI_DEVICE, TYPE_PCI_DEVICE) /* Implemented by devices that can be plugged on PCI Express buses */ #define INTERFACE_PCIE_DEVICE "pci-express-device" @@ -399,9 +395,8 @@ typedef PCIINTxRoute (*pci_route_irq_fn)(void *opaque, int pin); #define TYPE_PCI_BUS "PCI" typedef struct PCIBusClass PCIBusClass; -#define PCI_BUS(obj) OBJECT_CHECK(PCIBus, (obj), TYPE_PCI_BUS) -#define PCI_BUS_CLASS(klass) OBJECT_CLASS_CHECK(PCIBusClass, (klass), TYPE_PCI_BUS) -#define PCI_BUS_GET_CLASS(obj) OBJECT_GET_CLASS(PCIBusClass, (obj), TYPE_PCI_BUS) +DECLARE_OBJ_CHECKERS(PCIBus, PCIBusClass, + PCI_BUS, TYPE_PCI_BUS) #define TYPE_PCIE_BUS "PCIE" bool pci_bus_is_express(PCIBus *bus); diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h index b46d37faa8..7ab145955a 100644 --- a/include/hw/pci/pci_bridge.h +++ b/include/hw/pci/pci_bridge.h @@ -51,7 +51,8 @@ struct PCIBridgeWindows { }; #define TYPE_PCI_BRIDGE "base-pci-bridge" -#define PCI_BRIDGE(obj) OBJECT_CHECK(PCIBridge, (obj), TYPE_PCI_BRIDGE) +DECLARE_INSTANCE_CHECKER(PCIBridge, PCI_BRIDGE, + TYPE_PCI_BRIDGE) struct PCIBridge { /*< private >*/ diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h index 51ea53908f..d1fc1c3604 100644 --- a/include/hw/pci/pci_host.h +++ b/include/hw/pci/pci_host.h @@ -33,12 +33,8 @@ #define TYPE_PCI_HOST_BRIDGE "pci-host-bridge" typedef struct PCIHostBridgeClass PCIHostBridgeClass; -#define PCI_HOST_BRIDGE(obj) \ - OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST_BRIDGE) -#define PCI_HOST_BRIDGE_CLASS(klass) \ - OBJECT_CLASS_CHECK(PCIHostBridgeClass, (klass), TYPE_PCI_HOST_BRIDGE) -#define PCI_HOST_BRIDGE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(PCIHostBridgeClass, (obj), TYPE_PCI_HOST_BRIDGE) +DECLARE_OBJ_CHECKERS(PCIHostState, PCIHostBridgeClass, + PCI_HOST_BRIDGE, TYPE_PCI_HOST_BRIDGE) struct PCIHostState { SysBusDevice busdev; diff --git a/include/hw/pci/pcie_host.h b/include/hw/pci/pcie_host.h index c7d2ae5bf4..f512646c0c 100644 --- a/include/hw/pci/pcie_host.h +++ b/include/hw/pci/pcie_host.h @@ -26,8 +26,8 @@ #include "qom/object.h" #define TYPE_PCIE_HOST_BRIDGE "pcie-host-bridge" -#define PCIE_HOST_BRIDGE(obj) \ - OBJECT_CHECK(PCIExpressHost, (obj), TYPE_PCIE_HOST_BRIDGE) +DECLARE_INSTANCE_CHECKER(PCIExpressHost, PCIE_HOST_BRIDGE, + TYPE_PCIE_HOST_BRIDGE) #define PCIE_HOST_MCFG_BASE "MCFG" #define PCIE_HOST_MCFG_SIZE "mcfg_size" diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h index 00ab398cb9..2463c07fa7 100644 --- a/include/hw/pci/pcie_port.h +++ b/include/hw/pci/pcie_port.h @@ -26,7 +26,8 @@ #include "qom/object.h" #define TYPE_PCIE_PORT "pcie-port" -#define PCIE_PORT(obj) OBJECT_CHECK(PCIEPort, (obj), TYPE_PCIE_PORT) +DECLARE_INSTANCE_CHECKER(PCIEPort, PCIE_PORT, + TYPE_PCIE_PORT) struct PCIEPort { /*< private >*/ @@ -40,7 +41,8 @@ struct PCIEPort { void pcie_port_init_reg(PCIDevice *d); #define TYPE_PCIE_SLOT "pcie-slot" -#define PCIE_SLOT(obj) OBJECT_CHECK(PCIESlot, (obj), TYPE_PCIE_SLOT) +DECLARE_INSTANCE_CHECKER(PCIESlot, PCIE_SLOT, + TYPE_PCIE_SLOT) struct PCIESlot { /*< private >*/ diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 3b20755999..389b81ea62 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -42,12 +42,8 @@ typedef struct SpaprDimmState SpaprDimmState; typedef struct SpaprMachineClass SpaprMachineClass; #define TYPE_SPAPR_MACHINE "spapr-machine" -#define SPAPR_MACHINE(obj) \ - OBJECT_CHECK(SpaprMachineState, (obj), TYPE_SPAPR_MACHINE) -#define SPAPR_MACHINE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SpaprMachineClass, obj, TYPE_SPAPR_MACHINE) -#define SPAPR_MACHINE_CLASS(klass) \ - OBJECT_CLASS_CHECK(SpaprMachineClass, klass, TYPE_SPAPR_MACHINE) +DECLARE_OBJ_CHECKERS(SpaprMachineState, SpaprMachineClass, + SPAPR_MACHINE, TYPE_SPAPR_MACHINE) typedef enum { SPAPR_RESIZE_HPT_DEFAULT = 0, @@ -777,8 +773,8 @@ DECLARE_INSTANCE_CHECKER(SpaprTceTable, SPAPR_TCE_TABLE, TYPE_SPAPR_TCE_TABLE) #define TYPE_SPAPR_IOMMU_MEMORY_REGION "spapr-iommu-memory-region" -#define SPAPR_IOMMU_MEMORY_REGION(obj) \ - OBJECT_CHECK(IOMMUMemoryRegion, (obj), TYPE_SPAPR_IOMMU_MEMORY_REGION) +DECLARE_INSTANCE_CHECKER(IOMMUMemoryRegion, SPAPR_IOMMU_MEMORY_REGION, + TYPE_SPAPR_IOMMU_MEMORY_REGION) struct SpaprTceTable { DeviceState parent; diff --git a/include/hw/ppc/xics_spapr.h b/include/hw/ppc/xics_spapr.h index 09e428de4e..ee3c525b33 100644 --- a/include/hw/ppc/xics_spapr.h +++ b/include/hw/ppc/xics_spapr.h @@ -31,7 +31,8 @@ #include "qom/object.h" #define TYPE_ICS_SPAPR "ics-spapr" -#define ICS_SPAPR(obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS_SPAPR) +DECLARE_INSTANCE_CHECKER(ICSState, ICS_SPAPR, + TYPE_ICS_SPAPR) int xics_kvm_connect(SpaprInterruptController *intc, uint32_t nr_servers, Error **errp); diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 479377f37b..e025ba9653 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -13,9 +13,8 @@ enum { #define TYPE_DEVICE "device" typedef struct DeviceClass DeviceClass; -#define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE) -#define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE) -#define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE) +DECLARE_OBJ_CHECKERS(DeviceState, DeviceClass, + DEVICE, TYPE_DEVICE) typedef enum DeviceCategory { DEVICE_CATEGORY_BRIDGE, @@ -204,9 +203,8 @@ struct DeviceListener { }; #define TYPE_BUS "bus" -#define BUS(obj) OBJECT_CHECK(BusState, (obj), TYPE_BUS) -#define BUS_CLASS(klass) OBJECT_CLASS_CHECK(BusClass, (klass), TYPE_BUS) -#define BUS_GET_CLASS(obj) OBJECT_GET_CLASS(BusClass, (obj), TYPE_BUS) +DECLARE_OBJ_CHECKERS(BusState, BusClass, + BUS, TYPE_BUS) struct BusClass { ObjectClass parent_class; diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h index 8fded9e599..034cd73d37 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -195,14 +195,8 @@ struct SCLPEventClass { #define TYPE_SCLP_EVENT_FACILITY "s390-sclp-event-facility" typedef struct SCLPEventFacilityClass SCLPEventFacilityClass; -#define EVENT_FACILITY(obj) \ - OBJECT_CHECK(SCLPEventFacility, (obj), TYPE_SCLP_EVENT_FACILITY) -#define EVENT_FACILITY_CLASS(klass) \ - OBJECT_CLASS_CHECK(SCLPEventFacilityClass, (klass), \ - TYPE_SCLP_EVENT_FACILITY) -#define EVENT_FACILITY_GET_CLASS(obj) \ - OBJECT_GET_CLASS(SCLPEventFacilityClass, (obj), \ - TYPE_SCLP_EVENT_FACILITY) +DECLARE_OBJ_CHECKERS(SCLPEventFacility, SCLPEventFacilityClass, + EVENT_FACILITY, TYPE_SCLP_EVENT_FACILITY) struct SCLPEventFacilityClass { SysBusDeviceClass parent_class; diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 459d5df041..77e21bba18 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -11,7 +11,8 @@ #define QDEV_MAX_PIO 32 #define TYPE_SYSTEM_BUS "System" -#define SYSTEM_BUS(obj) OBJECT_CHECK(BusState, (obj), TYPE_SYSTEM_BUS) +DECLARE_INSTANCE_CHECKER(BusState, SYSTEM_BUS, + TYPE_SYSTEM_BUS) typedef struct SysBusDevice SysBusDevice; diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h index dca651fd14..aaaba1117d 100644 --- a/include/hw/virtio/virtio-mmio.h +++ b/include/hw/virtio/virtio-mmio.h @@ -28,12 +28,8 @@ /* QOM macros */ /* virtio-mmio-bus */ #define TYPE_VIRTIO_MMIO_BUS "virtio-mmio-bus" -#define VIRTIO_MMIO_BUS(obj) \ - OBJECT_CHECK(VirtioBusState, (obj), TYPE_VIRTIO_MMIO_BUS) -#define VIRTIO_MMIO_BUS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtioBusClass, (obj), TYPE_VIRTIO_MMIO_BUS) -#define VIRTIO_MMIO_BUS_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtioBusClass, (klass), TYPE_VIRTIO_MMIO_BUS) +DECLARE_OBJ_CHECKERS(VirtioBusState, VirtioBusClass, + VIRTIO_MMIO_BUS, TYPE_VIRTIO_MMIO_BUS) /* virtio-mmio */ #define TYPE_VIRTIO_MMIO "virtio-mmio" diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 261d087de8..807280451b 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -69,12 +69,8 @@ typedef struct VirtQueueElement #define TYPE_VIRTIO_DEVICE "virtio-device" typedef struct VirtioDeviceClass VirtioDeviceClass; -#define VIRTIO_DEVICE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(VirtioDeviceClass, obj, TYPE_VIRTIO_DEVICE) -#define VIRTIO_DEVICE_CLASS(klass) \ - OBJECT_CLASS_CHECK(VirtioDeviceClass, klass, TYPE_VIRTIO_DEVICE) -#define VIRTIO_DEVICE(obj) \ - OBJECT_CHECK(VirtIODevice, (obj), TYPE_VIRTIO_DEVICE) +DECLARE_OBJ_CHECKERS(VirtIODevice, VirtioDeviceClass, + VIRTIO_DEVICE, TYPE_VIRTIO_DEVICE) enum virtio_device_endian { VIRTIO_DEVICE_ENDIAN_UNKNOWN, diff --git a/include/hw/xen/xen-legacy-backend.h b/include/hw/xen/xen-legacy-backend.h index ebef2bf4e4..746bd38b6e 100644 --- a/include/hw/xen/xen-legacy-backend.h +++ b/include/hw/xen/xen-legacy-backend.h @@ -10,8 +10,8 @@ #define TYPE_XENSYSBUS "xen-sysbus" #define TYPE_XENBACKEND "xen-backend" -#define XENBACKEND_DEVICE(obj) \ - OBJECT_CHECK(XenLegacyDevice, (obj), TYPE_XENBACKEND) +DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND_DEVICE, + TYPE_XENBACKEND) /* variables */ extern struct xs_handle *xenstore; diff --git a/include/net/filter.h b/include/net/filter.h index 0d4f011bc0..e7e593128a 100644 --- a/include/net/filter.h +++ b/include/net/filter.h @@ -16,12 +16,8 @@ #define TYPE_NETFILTER "netfilter" typedef struct NetFilterClass NetFilterClass; -#define NETFILTER(obj) \ - OBJECT_CHECK(NetFilterState, (obj), TYPE_NETFILTER) -#define NETFILTER_GET_CLASS(obj) \ - OBJECT_GET_CLASS(NetFilterClass, (obj), TYPE_NETFILTER) -#define NETFILTER_CLASS(klass) \ - OBJECT_CLASS_CHECK(NetFilterClass, (klass), TYPE_NETFILTER) +DECLARE_OBJ_CHECKERS(NetFilterState, NetFilterClass, + NETFILTER, TYPE_NETFILTER) typedef void (FilterSetup) (NetFilterState *nf, Error **errp); typedef void (FilterCleanup) (NetFilterState *nf); diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h index bb2dcfb97b..c1b2b2e52c 100644 --- a/include/sysemu/kvm_int.h +++ b/include/sysemu/kvm_int.h @@ -36,8 +36,8 @@ typedef struct KVMMemoryListener { #define TYPE_KVM_ACCEL ACCEL_CLASS_NAME("kvm") -#define KVM_STATE(obj) \ - OBJECT_CHECK(KVMState, (obj), TYPE_KVM_ACCEL) +DECLARE_INSTANCE_CHECKER(KVMState, KVM_STATE, + TYPE_KVM_ACCEL) void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml, AddressSpace *as, int as_id); diff --git a/include/ui/console.h b/include/ui/console.h index 2a74a27d50..8602203523 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -107,12 +107,8 @@ void kbd_put_keysym(int keysym); #define TYPE_QEMU_CONSOLE "qemu-console" typedef struct QemuConsoleClass QemuConsoleClass; -#define QEMU_CONSOLE(obj) \ - OBJECT_CHECK(QemuConsole, (obj), TYPE_QEMU_CONSOLE) -#define QEMU_CONSOLE_GET_CLASS(obj) \ - OBJECT_GET_CLASS(QemuConsoleClass, (obj), TYPE_QEMU_CONSOLE) -#define QEMU_CONSOLE_CLASS(klass) \ - OBJECT_CLASS_CHECK(QemuConsoleClass, (klass), TYPE_QEMU_CONSOLE) +DECLARE_OBJ_CHECKERS(QemuConsole, QemuConsoleClass, + QEMU_CONSOLE, TYPE_QEMU_CONSOLE) struct QemuConsoleClass { diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 1e01bfeaea..6153ebb657 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -1256,8 +1256,8 @@ struct PXA2xxI2CSlaveState { }; #define TYPE_PXA2XX_I2C "pxa2xx_i2c" -#define PXA2XX_I2C(obj) \ - OBJECT_CHECK(PXA2xxI2CState, (obj), TYPE_PXA2XX_I2C) +DECLARE_INSTANCE_CHECKER(PXA2xxI2CState, PXA2XX_I2C, + TYPE_PXA2XX_I2C) struct PXA2xxI2CState { /*< private >*/ @@ -1794,7 +1794,8 @@ static PXA2xxI2SState *pxa2xx_i2s_init(MemoryRegion *sysmem, /* PXA Fast Infra-red Communications Port */ #define TYPE_PXA2XX_FIR "pxa2xx-fir" -#define PXA2XX_FIR(obj) OBJECT_CHECK(PXA2xxFIrState, (obj), TYPE_PXA2XX_FIR) +DECLARE_INSTANCE_CHECKER(PXA2xxFIrState, PXA2XX_FIR, + TYPE_PXA2XX_FIR) struct PXA2xxFIrState { /*< private >*/ diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 2d7fe3d973..bcf3c58f17 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -845,8 +845,8 @@ static Property virtser_props[] = { }; #define TYPE_VIRTIO_SERIAL_BUS "virtio-serial-bus" -#define VIRTIO_SERIAL_BUS(obj) \ - OBJECT_CHECK(VirtIOSerialBus, (obj), TYPE_VIRTIO_SERIAL_BUS) +DECLARE_INSTANCE_CHECKER(VirtIOSerialBus, VIRTIO_SERIAL_BUS, + TYPE_VIRTIO_SERIAL_BUS) static void virtser_bus_class_init(ObjectClass *klass, void *data) { diff --git a/hw/core/irq.c b/hw/core/irq.c index 8aebc22cb2..d8532dee22 100644 --- a/hw/core/irq.c +++ b/hw/core/irq.c @@ -26,7 +26,8 @@ #include "hw/irq.h" #include "qom/object.h" -#define IRQ(obj) OBJECT_CHECK(struct IRQState, (obj), TYPE_IRQ) +DECLARE_INSTANCE_CHECKER(struct IRQState, IRQ, + TYPE_IRQ) struct IRQState { Object parent_obj; diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index fbfdc1886e..148eb534c5 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -18,8 +18,8 @@ #include "migration/blocker.h" #include "qom/object.h" -#define VHOST_USER_GPU(obj) \ - OBJECT_CHECK(VhostUserGPU, (obj), TYPE_VHOST_USER_GPU) +DECLARE_INSTANCE_CHECKER(VhostUserGPU, VHOST_USER_GPU, + TYPE_VHOST_USER_GPU) typedef enum VhostUserGpuRequest { VHOST_USER_GPU_NONE = 0, diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index ac6d6b2b68..aa7b890ffb 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -86,8 +86,8 @@ struct vmsvga_state_s { #define TYPE_VMWARE_SVGA "vmware-svga" -#define VMWARE_SVGA(obj) \ - OBJECT_CHECK(struct pci_vmsvga_state_s, (obj), TYPE_VMWARE_SVGA) +DECLARE_INSTANCE_CHECKER(struct pci_vmsvga_state_s, VMWARE_SVGA, + TYPE_VMWARE_SVGA) struct pci_vmsvga_state_s { /*< private >*/ diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index 8e1adc0fb3..c5415ed20e 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -34,8 +34,8 @@ #include "trace.h" #include "qom/object.h" -#define I8257(obj) \ - OBJECT_CHECK(I8257State, (obj), TYPE_I8257) +DECLARE_INSTANCE_CHECKER(I8257State, I8257, + TYPE_I8257) /* #define DEBUG_DMA */ diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index f91fc15483..e3aeb27c15 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -22,7 +22,8 @@ #include "qom/object.h" #define TYPE_VMBUS "vmbus" -#define VMBUS(obj) OBJECT_CHECK(VMBus, (obj), TYPE_VMBUS) +DECLARE_INSTANCE_CHECKER(VMBus, VMBUS, + TYPE_VMBUS) enum { VMGPADL_INIT, diff --git a/hw/ide/ahci-allwinner.c b/hw/ide/ahci-allwinner.c index ebb31f89c6..9e82bf376b 100644 --- a/hw/ide/ahci-allwinner.c +++ b/hw/ide/ahci-allwinner.c @@ -26,8 +26,8 @@ #include "trace.h" #include "qom/object.h" -#define ALLWINNER_AHCI(obj) \ - OBJECT_CHECK(AllwinnerAHCIState, (obj), TYPE_ALLWINNER_AHCI) +DECLARE_INSTANCE_CHECKER(AllwinnerAHCIState, ALLWINNER_AHCI, + TYPE_ALLWINNER_AHCI) #define ALLWINNER_AHCI_BISTAFR ((0xa0 - ALLWINNER_AHCI_MMIO_OFF) / 4) #define ALLWINNER_AHCI_BISTCR ((0xa4 - ALLWINNER_AHCI_MMIO_OFF) / 4) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 61af67503a..f6aa074fb6 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -482,7 +482,8 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, qemu_register_reset(kbd_reset, s); } -#define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042) +DECLARE_INSTANCE_CHECKER(ISAKBDState, I8042, + TYPE_I8042) struct ISAKBDState { ISADevice parent_obj; diff --git a/hw/intc/apic.c b/hw/intc/apic.c index afbb653497..cd360a2b38 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -40,8 +40,8 @@ static APICCommonState *local_apics[MAX_APICS + 1]; #define TYPE_APIC "apic" -#define APIC(obj) \ - OBJECT_CHECK(APICCommonState, (obj), TYPE_APIC) +DECLARE_INSTANCE_CHECKER(APICCommonState, APIC, + TYPE_APIC) static void apic_set_irq(APICCommonState *s, int vector_num, int trigger_mode); static void apic_update_irq(APICCommonState *s); diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c index 8bc90aa65d..f2fcd36e4d 100644 --- a/hw/intc/arm_gic_kvm.c +++ b/hw/intc/arm_gic_kvm.c @@ -33,12 +33,8 @@ #define TYPE_KVM_ARM_GIC "kvm-arm-gic" typedef struct KVMARMGICClass KVMARMGICClass; -#define KVM_ARM_GIC(obj) \ - OBJECT_CHECK(GICState, (obj), TYPE_KVM_ARM_GIC) -#define KVM_ARM_GIC_CLASS(klass) \ - OBJECT_CLASS_CHECK(KVMARMGICClass, (klass), TYPE_KVM_ARM_GIC) -#define KVM_ARM_GIC_GET_CLASS(obj) \ - OBJECT_GET_CLASS(KVMARMGICClass, (obj), TYPE_KVM_ARM_GIC) +DECLARE_OBJ_CHECKERS(GICState, KVMARMGICClass, + KVM_ARM_GIC, TYPE_KVM_ARM_GIC) struct KVMARMGICClass { ARMGICCommonClass parent_class; diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c index 198be30cf5..74b9b24514 100644 --- a/hw/intc/arm_gicv3_its_kvm.c +++ b/hw/intc/arm_gicv3_its_kvm.c @@ -31,11 +31,8 @@ #define TYPE_KVM_ARM_ITS "arm-its-kvm" typedef struct KVMARMITSClass KVMARMITSClass; -#define KVM_ARM_ITS(obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_ITS) -#define KVM_ARM_ITS_CLASS(klass) \ - OBJECT_CLASS_CHECK(KVMARMITSClass, (klass), TYPE_KVM_ARM_ITS) -#define KVM_ARM_ITS_GET_CLASS(obj) \ - OBJECT_GET_CLASS(KVMARMITSClass, (obj), TYPE_KVM_ARM_ITS) +DECLARE_OBJ_CHECKERS(GICv3ITSState, KVMARMITSClass, + KVM_ARM_ITS, TYPE_KVM_ARM_ITS) struct KVMARMITSClass { GICv3ITSCommonClass parent_class; diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 87092795e6..3468db9790 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -43,12 +43,8 @@ #define TYPE_KVM_ARM_GICV3 "kvm-arm-gicv3" typedef struct KVMARMGICv3Class KVMARMGICv3Class; -#define KVM_ARM_GICV3(obj) \ - OBJECT_CHECK(GICv3State, (obj), TYPE_KVM_ARM_GICV3) -#define KVM_ARM_GICV3_CLASS(klass) \ - OBJECT_CLASS_CHECK(KVMARMGICv3Class, (klass), TYPE_KVM_ARM_GICV3) -#define KVM_ARM_GICV3_GET_CLASS(obj) \ - OBJECT_GET_CLASS(KVMARMGICv3Class, (obj), TYPE_KVM_ARM_GICV3) +DECLARE_OBJ_CHECKERS(GICv3State, KVMARMGICv3Class, + KVM_ARM_GICV3, TYPE_KVM_ARM_GICV3) #define KVM_DEV_ARM_VGIC_SYSREG(op0, op1, crn, crm, op2) \ (ARM64_SYS_REG_SHIFT_MASK(op0, OP0) | \ diff --git a/hw/intc/etraxfs_pic.c b/hw/intc/etraxfs_pic.c index 0dae5ec090..8ac0c5cb9b 100644 --- a/hw/intc/etraxfs_pic.c +++ b/hw/intc/etraxfs_pic.c @@ -39,8 +39,8 @@ #define R_MAX 5 #define TYPE_ETRAX_FS_PIC "etraxfs,pic" -#define ETRAX_FS_PIC(obj) \ - OBJECT_CHECK(struct etrax_pic, (obj), TYPE_ETRAX_FS_PIC) +DECLARE_INSTANCE_CHECKER(struct etrax_pic, ETRAX_FS_PIC, + TYPE_ETRAX_FS_PIC) struct etrax_pic { diff --git a/hw/intc/loongson_liointc.c b/hw/intc/loongson_liointc.c index 81b2672cd3..6d0807faf0 100644 --- a/hw/intc/loongson_liointc.c +++ b/hw/intc/loongson_liointc.c @@ -44,8 +44,8 @@ #define R_END 0x64 #define TYPE_LOONGSON_LIOINTC "loongson.liointc" -#define LOONGSON_LIOINTC(obj) \ - OBJECT_CHECK(struct loongson_liointc, (obj), TYPE_LOONGSON_LIOINTC) +DECLARE_INSTANCE_CHECKER(struct loongson_liointc, LOONGSON_LIOINTC, + TYPE_LOONGSON_LIOINTC) struct loongson_liointc { SysBusDevice parent_obj; diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c index 66ce18955e..a7e6ff2913 100644 --- a/hw/intc/xilinx_intc.c +++ b/hw/intc/xilinx_intc.c @@ -42,7 +42,8 @@ #define R_MAX 8 #define TYPE_XILINX_INTC "xlnx.xps-intc" -#define XILINX_INTC(obj) OBJECT_CHECK(struct xlx_pic, (obj), TYPE_XILINX_INTC) +DECLARE_INSTANCE_CHECKER(struct xlx_pic, XILINX_INTC, + TYPE_XILINX_INTC) struct xlx_pic { diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index 6ee14a4682..dcf836a14e 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -38,8 +38,8 @@ #define XEN_PIIX_NUM_PIRQS 128ULL #define TYPE_PIIX3_PCI_DEVICE "pci-piix3" -#define PIIX3_PCI_DEVICE(obj) \ - OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE) +DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE, + TYPE_PIIX3_PCI_DEVICE) #define TYPE_PIIX3_DEVICE "PIIX3" #define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index e96f565ba1..2011fb11ca 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -47,7 +47,8 @@ } while (0) #define TYPE_AUXTOI2C "aux-to-i2c-bridge" -#define AUXTOI2C(obj) OBJECT_CHECK(AUXTOI2CState, (obj), TYPE_AUXTOI2C) +DECLARE_INSTANCE_CHECKER(AUXTOI2CState, AUXTOI2C, + TYPE_AUXTOI2C) static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent); static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge); diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index e064ca4048..76de6d027f 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -76,8 +76,8 @@ struct rocker { #define TYPE_ROCKER "rocker" -#define ROCKER(obj) \ - OBJECT_CHECK(Rocker, (obj), TYPE_ROCKER) +DECLARE_INSTANCE_CHECKER(Rocker, ROCKER, + TYPE_ROCKER) static QLIST_HEAD(, rocker) rockers; diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index bc43adf985..8496759376 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -53,8 +53,8 @@ #define CTRL_S 0x1 #define TYPE_XILINX_ETHLITE "xlnx.xps-ethernetlite" -#define XILINX_ETHLITE(obj) \ - OBJECT_CHECK(struct xlx_ethlite, (obj), TYPE_XILINX_ETHLITE) +DECLARE_INSTANCE_CHECKER(struct xlx_ethlite, XILINX_ETHLITE, + TYPE_XILINX_ETHLITE) struct xlx_ethlite { diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 2cc429ba7b..cf789103a4 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -878,8 +878,8 @@ static IOMMUTLBEntry pnv_phb3_translate_iommu(IOMMUMemoryRegion *iommu, } #define TYPE_PNV_PHB3_IOMMU_MEMORY_REGION "pnv-phb3-iommu-memory-region" -#define PNV_PHB3_IOMMU_MEMORY_REGION(obj) \ - OBJECT_CHECK(IOMMUMemoryRegion, (obj), TYPE_PNV_PHB3_IOMMU_MEMORY_REGION) +DECLARE_INSTANCE_CHECKER(IOMMUMemoryRegion, PNV_PHB3_IOMMU_MEMORY_REGION, + TYPE_PNV_PHB3_IOMMU_MEMORY_REGION) static void pnv_phb3_iommu_memory_region_class_init(ObjectClass *klass, void *data) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 0802d4d64b..a3990a7b0e 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1043,8 +1043,8 @@ static IOMMUTLBEntry pnv_phb4_translate_iommu(IOMMUMemoryRegion *iommu, } #define TYPE_PNV_PHB4_IOMMU_MEMORY_REGION "pnv-phb4-iommu-memory-region" -#define PNV_PHB4_IOMMU_MEMORY_REGION(obj) \ - OBJECT_CHECK(IOMMUMemoryRegion, (obj), TYPE_PNV_PHB4_IOMMU_MEMORY_REGION) +DECLARE_INSTANCE_CHECKER(IOMMUMemoryRegion, PNV_PHB4_IOMMU_MEMORY_REGION, + TYPE_PNV_PHB4_IOMMU_MEMORY_REGION) static void pnv_phb4_iommu_memory_region_class_init(ObjectClass *klass, void *data) diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index 2af7ce83eb..5eeff10164 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -162,8 +162,8 @@ DECLARE_INSTANCE_CHECKER(PCIVPBState, PCI_VPB, TYPE_VERSATILE_PCI) #define TYPE_VERSATILE_PCI_HOST "versatile_pci_host" -#define PCI_VPB_HOST(obj) \ - OBJECT_CHECK(PCIDevice, (obj), TYPE_VERSATILE_PCI_HOST) +DECLARE_INSTANCE_CHECKER(PCIDevice, PCI_VPB_HOST, + TYPE_VERSATILE_PCI_HOST) typedef enum { PCI_IMAP0 = 0x0, diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c index 0afead5d9f..e40b22996f 100644 --- a/hw/pcmcia/pxa2xx.c +++ b/hw/pcmcia/pxa2xx.c @@ -20,8 +20,8 @@ #include "qom/object.h" #define TYPE_PXA2XX_PCMCIA "pxa2xx-pcmcia" -#define PXA2XX_PCMCIA(obj) \ - OBJECT_CHECK(PXA2xxPCMCIAState, obj, TYPE_PXA2XX_PCMCIA) +DECLARE_INSTANCE_CHECKER(PXA2xxPCMCIAState, PXA2XX_PCMCIA, + TYPE_PXA2XX_PCMCIA) struct PXA2xxPCMCIAState { SysBusDevice parent_obj; diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c index 447444cfdf..1d6842b01b 100644 --- a/hw/scsi/mptsas.c +++ b/hw/scsi/mptsas.c @@ -45,8 +45,8 @@ #define TYPE_MPTSAS1068 "mptsas1068" -#define MPT_SAS(obj) \ - OBJECT_CHECK(MPTSASState, (obj), TYPE_MPTSAS1068) +DECLARE_INSTANCE_CHECKER(MPTSASState, MPT_SAS, + TYPE_MPTSAS1068) #define MPTSAS1068_PRODUCT_ID \ (MPI_FW_HEADER_PID_FAMILY_1068_SAS | \ diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index 3036f0e830..0189c3ec56 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -29,8 +29,8 @@ #include "qom/object.h" #define TYPE_AW_SDHOST_BUS "allwinner-sdhost-bus" -#define AW_SDHOST_BUS(obj) \ - OBJECT_CHECK(SDBus, (obj), TYPE_AW_SDHOST_BUS) +DECLARE_INSTANCE_CHECKER(SDBus, AW_SDHOST_BUS, + TYPE_AW_SDHOST_BUS) /* SD Host register offsets */ enum { diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c index 36255bc30b..5e5a9db6de 100644 --- a/hw/sd/bcm2835_sdhost.c +++ b/hw/sd/bcm2835_sdhost.c @@ -22,8 +22,8 @@ #include "qom/object.h" #define TYPE_BCM2835_SDHOST_BUS "bcm2835-sdhost-bus" -#define BCM2835_SDHOST_BUS(obj) \ - OBJECT_CHECK(SDBus, (obj), TYPE_BCM2835_SDHOST_BUS) +DECLARE_INSTANCE_CHECKER(SDBus, BCM2835_SDHOST_BUS, + TYPE_BCM2835_SDHOST_BUS) #define SDCMD 0x00 /* Command to SD card - 16 R/W */ #define SDARG 0x04 /* Argument to SD card - 32 R/W */ diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 5c853b1f4f..0807a23732 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -24,10 +24,12 @@ #include "qom/object.h" #define TYPE_PXA2XX_MMCI "pxa2xx-mmci" -#define PXA2XX_MMCI(obj) OBJECT_CHECK(PXA2xxMMCIState, (obj), TYPE_PXA2XX_MMCI) +DECLARE_INSTANCE_CHECKER(PXA2xxMMCIState, PXA2XX_MMCI, + TYPE_PXA2XX_MMCI) #define TYPE_PXA2XX_MMCI_BUS "pxa2xx-mmci-bus" -#define PXA2XX_MMCI_BUS(obj) OBJECT_CHECK(SDBus, (obj), TYPE_PXA2XX_MMCI_BUS) +DECLARE_INSTANCE_CHECKER(SDBus, PXA2XX_MMCI_BUS, + TYPE_PXA2XX_MMCI_BUS) struct PXA2xxMMCIState { SysBusDevice parent_obj; diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 54c4200369..ca4060e057 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -40,7 +40,8 @@ #include "qom/object.h" #define TYPE_SDHCI_BUS "sdhci-bus" -#define SDHCI_BUS(obj) OBJECT_CHECK(SDBus, (obj), TYPE_SDHCI_BUS) +DECLARE_INSTANCE_CHECKER(SDBus, SDHCI_BUS, + TYPE_SDHCI_BUS) #define MASKED_WRITE(reg, mask, val) (reg = (reg & (mask)) | (val)) diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c index d9b6da316b..e6eac3c3a4 100644 --- a/hw/ssi/ssi.c +++ b/hw/ssi/ssi.c @@ -24,7 +24,8 @@ struct SSIBus { }; #define TYPE_SSI_BUS "SSI" -#define SSI_BUS(obj) OBJECT_CHECK(SSIBus, (obj), TYPE_SSI_BUS) +DECLARE_INSTANCE_CHECKER(SSIBus, SSI_BUS, + TYPE_SSI_BUS) static const TypeInfo ssi_bus_info = { .name = TYPE_SSI_BUS, diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c index bd36d906a2..0cfb2301e0 100644 --- a/hw/timer/xilinx_timer.c +++ b/hw/timer/xilinx_timer.c @@ -62,8 +62,8 @@ struct xlx_timer }; #define TYPE_XILINX_TIMER "xlnx.xps-timer" -#define XILINX_TIMER(obj) \ - OBJECT_CHECK(struct timerblock, (obj), TYPE_XILINX_TIMER) +DECLARE_INSTANCE_CHECKER(struct timerblock, XILINX_TIMER, + TYPE_XILINX_TIMER) struct timerblock { diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 22072dd7d5..f1c7bb3227 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -44,7 +44,8 @@ #include "qom/object.h" #define TYPE_VFIO_PCI "vfio-pci" -#define PCI_VFIO(obj) OBJECT_CHECK(VFIOPCIDevice, obj, TYPE_VFIO_PCI) +DECLARE_INSTANCE_CHECKER(VFIOPCIDevice, PCI_VFIO, + TYPE_VFIO_PCI) #define TYPE_VFIO_PCI_NOHOTPLUG "vfio-pci-nohotplug" From patchwork Thu Aug 13 22:26:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 276557 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 249D4C433E1 for ; Thu, 13 Aug 2020 22:47:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E247020771 for ; Thu, 13 Aug 2020 22:47:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RLBYh4Oc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E247020771 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6M0A-0004V9-5w for qemu-devel@archiver.kernel.org; Thu, 13 Aug 2020 18:47:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6Lh3-0006QQ-F0 for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:29 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20303 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k6Lgy-0002wn-7h for qemu-devel@nongnu.org; Thu, 13 Aug 2020 18:27:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597357643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6AqjA4h5I5Dp/r4Bm0a1zmu86WiIsKpgt30sbB7FoFI=; b=RLBYh4OcFgonIYGjfllg/q2ZvCrdJTh5rI0sdX2htcalrIelHSdlU0rmFBGwBqXOktKhfA LQAKLX797JZlPQaoTlTobv1oGZztMzk2BevBA7zGpmZ6VnJNbG4GIwpqEh7VlfMFUwzw+W Lx6ixm3HdkTsvIbUiykcMAjt8tK3FPM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-436-QaYsdyhRMeSN3NjjLn7cCg-1; Thu, 13 Aug 2020 18:27:21 -0400 X-MC-Unique: QaYsdyhRMeSN3NjjLn7cCg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB71C800683 for ; Thu, 13 Aug 2020 22:27:20 +0000 (UTC) Received: from localhost (ovpn-117-153.rdu2.redhat.com [10.10.117.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id A28D15D9D2; Thu, 13 Aug 2020 22:27:20 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Subject: [PATCH 40/41] crypto: use QOM macros for declaration/definition of secret types Date: Thu, 13 Aug 2020 18:26:24 -0400 Message-Id: <20200813222625.243136-41-ehabkost@redhat.com> In-Reply-To: <20200813222625.243136-1-ehabkost@redhat.com> References: <20200813222625.243136-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ehabkost@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=ehabkost@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/13 17:30:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Daniel P. Berrangé This introduces the use of the OBJECT_DEFINE and OBJECT_DECLARE macro families in the secret types, in order to eliminate boilerplate code. Signed-off-by: Daniel P. Berrangé Message-Id: <20200723181410.3145233-4-berrange@redhat.com> [ehabkost: rebase, update to pass additional arguments to macro] Signed-off-by: Eduardo Habkost --- include/crypto/secret.h | 11 ++--------- crypto/secret.c | 25 +++++++------------------ crypto/secret_common.c | 27 +++++++++------------------ crypto/secret_keyring.c | 29 ++++++++++++----------------- 4 files changed, 30 insertions(+), 62 deletions(-) diff --git a/include/crypto/secret.h b/include/crypto/secret.h index 5d20ae6d2f..4eb4e5ffef 100644 --- a/include/crypto/secret.h +++ b/include/crypto/secret.h @@ -26,11 +26,9 @@ #include "crypto/secret_common.h" #define TYPE_QCRYPTO_SECRET "secret" -typedef struct QCryptoSecret QCryptoSecret; -DECLARE_INSTANCE_CHECKER(QCryptoSecret, QCRYPTO_SECRET, - TYPE_QCRYPTO_SECRET) -typedef struct QCryptoSecretClass QCryptoSecretClass; +OBJECT_DECLARE_SIMPLE_TYPE(QCryptoSecret, qcrypto_secret, + QCRYPTO_SECRET, QCryptoSecretCommon) /** * QCryptoSecret: @@ -125,9 +123,4 @@ struct QCryptoSecret { char *file; }; - -struct QCryptoSecretClass { - QCryptoSecretCommonClass parent_class; -}; - #endif /* QCRYPTO_SECRET_H */ diff --git a/crypto/secret.c b/crypto/secret.c index c07011d388..55b406f79e 100644 --- a/crypto/secret.c +++ b/crypto/secret.c @@ -25,6 +25,9 @@ #include "qemu/module.h" #include "trace.h" +OBJECT_DEFINE_TYPE_WITH_INTERFACES(QCryptoSecret, qcrypto_secret, + QCRYPTO_SECRET, QCRYPTO_SECRET_COMMON, + { TYPE_USER_CREATABLE }, { NULL }) static void qcrypto_secret_load_data(QCryptoSecretCommon *sec_common, @@ -140,21 +143,7 @@ qcrypto_secret_class_init(ObjectClass *oc, void *data) qcrypto_secret_prop_set_file); } - -static const TypeInfo qcrypto_secret_info = { - .parent = TYPE_QCRYPTO_SECRET_COMMON, - .name = TYPE_QCRYPTO_SECRET, - .instance_size = sizeof(QCryptoSecret), - .instance_finalize = qcrypto_secret_finalize, - .class_size = sizeof(QCryptoSecretClass), - .class_init = qcrypto_secret_class_init, - .interfaces = (InterfaceInfo[]) { - { TYPE_USER_CREATABLE }, - { } - } -}; -TYPE_INFO(qcrypto_secret_info) - - - - +static void +qcrypto_secret_init(Object *obj) +{ +} diff --git a/crypto/secret_common.c b/crypto/secret_common.c index 80d7d75b4d..9a054b90b5 100644 --- a/crypto/secret_common.c +++ b/crypto/secret_common.c @@ -28,6 +28,9 @@ #include "trace.h" +OBJECT_DEFINE_ABSTRACT_TYPE(QCryptoSecretCommon, qcrypto_secret_common, + QCRYPTO_SECRET_COMMON, OBJECT) + static void qcrypto_secret_decrypt(QCryptoSecretCommon *secret, const uint8_t *input, size_t inputlen, @@ -269,7 +272,7 @@ qcrypto_secret_prop_get_keyid(Object *obj, static void -qcrypto_secret_finalize(Object *obj) +qcrypto_secret_common_finalize(Object *obj) { QCryptoSecretCommon *secret = QCRYPTO_SECRET_COMMON(obj); @@ -279,7 +282,7 @@ qcrypto_secret_finalize(Object *obj) } static void -qcrypto_secret_class_init(ObjectClass *oc, void *data) +qcrypto_secret_common_class_init(ObjectClass *oc, void *data) { object_class_property_add_bool(oc, "loaded", qcrypto_secret_prop_get_loaded, @@ -297,6 +300,10 @@ qcrypto_secret_class_init(ObjectClass *oc, void *data) qcrypto_secret_prop_set_iv); } +static void +qcrypto_secret_common_init(Object *obj) +{ +} int qcrypto_secret_lookup(const char *secretid, uint8_t **data, @@ -380,19 +387,3 @@ char *qcrypto_secret_lookup_as_base64(const char *secretid, g_free(data); return ret; } - - -static const TypeInfo qcrypto_secret_info = { - .parent = TYPE_OBJECT, - .name = TYPE_QCRYPTO_SECRET_COMMON, - .instance_size = sizeof(QCryptoSecretCommon), - .instance_finalize = qcrypto_secret_finalize, - .class_size = sizeof(QCryptoSecretCommonClass), - .class_init = qcrypto_secret_class_init, - .abstract = true, -}; -TYPE_INFO(qcrypto_secret_info) - - - - diff --git a/crypto/secret_keyring.c b/crypto/secret_keyring.c index 821d2e421b..463aefe5dc 100644 --- a/crypto/secret_keyring.c +++ b/crypto/secret_keyring.c @@ -26,6 +26,9 @@ #include "trace.h" #include "crypto/secret_keyring.h" +OBJECT_DEFINE_TYPE_WITH_INTERFACES(QCryptoSecretKeyring, qcrypto_secret_keyring, + QCRYPTO_SECRET_KEYRING, QCRYPTO_SECRET_COMMON, + { TYPE_USER_CREATABLE }, { NULL }) static inline long keyctl_read(int32_t key, uint8_t *buffer, size_t buflen) @@ -109,6 +112,11 @@ qcrypto_secret_keyring_complete(UserCreatable *uc, Error **errp) } +static void +qcrypto_secret_keyring_finalize(Object *obj) +{ +} + static void qcrypto_secret_keyring_class_init(ObjectClass *oc, void *data) { @@ -124,20 +132,7 @@ qcrypto_secret_keyring_class_init(ObjectClass *oc, void *data) NULL, NULL); } - -static const TypeInfo qcrypto_secret_info = { - .parent = TYPE_QCRYPTO_SECRET_COMMON, - .name = TYPE_QCRYPTO_SECRET_KEYRING, - .instance_size = sizeof(QCryptoSecretKeyring), - .class_size = sizeof(QCryptoSecretKeyringClass), - .class_init = qcrypto_secret_keyring_class_init, - .interfaces = (InterfaceInfo[]) { - { TYPE_USER_CREATABLE }, - { } - } -}; -TYPE_INFO(qcrypto_secret_info) - - - - +static void +qcrypto_secret_keyring_init(Object *obj) +{ +}