From nobody Wed Nov 27 12:31:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1699360074; cv=none; d=zohomail.com; s=zohoarc; b=QlCHDp5WFgiozoVzeUkHxGbL9YKSWK9wTwaLeGgC1PafrQuB84bbXSrwIzsXInwM94jhjrIZCzNwNMAcyT1nsVAfQ3ZrSKYra8zmzEyrx2cxrSHxKB74OjX7idP83oOS03lAw3WsmVD953O/5+5Kctr02xR+b8Q378oxg8/DOKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699360074; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jft9oGCgqyG/kQiaCmJITBNqDZ3C+l2CeBQR+HBLqn0=; b=Sk1u8BNsue0irh15rwH0pmL93nUfLqAn6MTwqLY3xGpiLkXVwJ2M77Bij21rl8CI6dhFvt99c8bFxymf+4F6LGmcC1ujIdlCSws31Ejaaam+lFkSftrNM/4J0OghBTrhUA1l6NbfrGlzL9lolkaJNuuBJOKZ4J56h+SpsZAAT5A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16993600748451013.3474857690638; Tue, 7 Nov 2023 04:27:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0LAR-0007yP-Ut; Tue, 07 Nov 2023 07:26:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0L9w-0006hD-Rg for qemu-devel@nongnu.org; Tue, 07 Nov 2023 07:26:20 -0500 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0L9m-0005GB-Gu for qemu-devel@nongnu.org; Tue, 07 Nov 2023 07:26:20 -0500 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-9c53e8b7cf4so840208266b.1 for ; Tue, 07 Nov 2023 04:26:07 -0800 (PST) Received: from m1x-phil.lan ([176.187.216.69]) by smtp.gmail.com with ESMTPSA id s22-20020a170906355600b009dd7bc622fbsm992734eja.113.2023.11.07.04.26.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Nov 2023 04:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699359966; x=1699964766; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jft9oGCgqyG/kQiaCmJITBNqDZ3C+l2CeBQR+HBLqn0=; b=UcowPgP/HTxM3Vbu0CeK/G5jByMXPqsFy6ocomp4ketUt9eApDJsA9v/G/b3IQW2AO gL/1ZNwc6i2t0BSipnOS78AThuSCNq7jbHQLN7QwLA8Fj1U0Mru8wkuSo97bJwnL/5Rz 9RUJ+w4zGRnyk2qREmqRXUg8XFJjt3wWXJkks0O2q83mqPTGDaG8++WD6QIHQ0qvWKk5 ssQzEt3n4t4GPMVA4n3tTxLZ0FjV1l61g3B5DWhtiASZrFQedMKLlQbiXrWk+P7ndm/x DpfutJrOzMKAgOtuvfiu80xn4eU3fVoaAmA2O3pA3er4gcflTZErCO1bb0bpeRYFLlYD wyYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699359966; x=1699964766; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jft9oGCgqyG/kQiaCmJITBNqDZ3C+l2CeBQR+HBLqn0=; b=dZjwnfZmwHJTU/eR2DH3ck7YgZh53jVWnxxfrSIvFRvr/sqO4YMD4Pc32oHFE8iAkF lsH+NP4mFdeSr8OWgglkiNYsvBf4bNqsHiOTUPdQ9mLLTU4e5OecCnjCwfa7BDdmp6mg sBcs53OyXy8+leIH9OZMtp76yxiGhX8f2X5q6M1xN9ZRzStDW0c5+XAR+9Ot92jdgAcY Gt6Ls5hTyLjTTFtxsDuss6HZ9B/aQvjOm44BedVDPA58eoOHI5/5demw4WG/VBY9Fqta B3yFHtBtseW+cEiDP+3Jx8eEQaU076JO8AWmzQ1OOE1C1cuQwCN9ly2w3y0L4r/eTVg9 jMaw== X-Gm-Message-State: AOJu0YxRL6gsob2jKZXjCiZ1T9JiOVk5uTIbf2u7Nn3ar2DXvTH/RhQn jivpG4RpSsXr6nNTgQ8o+FVQCcevRVWBlqqWoIk= X-Google-Smtp-Source: AGHT+IFLIxHMjLr/iZek67gx5lWhbT5iuNpNw9fB1473FwcwSj4RPE3c+cu2gcPlPpE5LtOiYUC6VQ== X-Received: by 2002:a17:907:c784:b0:9da:e694:e6a2 with SMTP id tz4-20020a170907c78400b009dae694e6a2mr15534129ejc.4.1699359966525; Tue, 07 Nov 2023 04:26:06 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Peter Maydell , Andrew Jeffery , Joel Stanley , "Edgar E. Iglesias" , Alistair Francis , Bin Meng , Tyrone Ting , Hao Wu Subject: [PULL 68/75] hw/sd: Declare QOM types using DEFINE_TYPES() macro Date: Tue, 7 Nov 2023 13:24:38 +0100 Message-ID: <20231107122442.58674-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231107122442.58674-1-philmd@linaro.org> References: <20231107122442.58674-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=philmd@linaro.org; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1699360076978100003 When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. Mechanical transformation using the following comby script: [pattern-x1] match=3D''' static const TypeInfo :[i1~.*_info] =3D { :[body] }; static void :[rt1~.*_register_type.](void) { type_register_static(&:[i2~.*_info]); } type_init(:[rt2~.*_register_type.]) ''' rewrite=3D''' static const TypeInfo :[i1][] =3D { { :[body] }, }; DEFINE_TYPES(:[i1]) ''' rule=3D'where :[i1] =3D=3D :[i2], :[rt1] =3D=3D :[rt2]' [pattern-x2] match=3D''' static const TypeInfo :[i1a~.*_info] =3D { :[body1] }; ... static const TypeInfo :[i2a~.*_info] =3D { :[body2] }; static void :[rt1~.*_register_type.](void) { type_register_static(&:[i1b~.*_info]); type_register_static(&:[i2b~.*_info]); } type_init(:[rt2~.*_register_type.]) ''' rewrite=3D''' static const TypeInfo :[i1a][] =3D { { :[body1] }, { :[body2] }, }; DEFINE_TYPES(:[i1a]) ''' rule=3D''' where :[i1a] =3D=3D :[i1b], :[i2a] =3D=3D :[i2b], :[rt1] =3D=3D :[rt2] ''' and re-indented manually. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater Message-Id: <20231031080603.86889-2-philmd@linaro.org> --- hw/sd/aspeed_sdhci.c | 19 ++++++++----------- hw/sd/bcm2835_sdhost.c | 33 ++++++++++++++------------------- hw/sd/cadence_sdhci.c | 21 +++++++++------------ hw/sd/core.c | 19 ++++++++----------- hw/sd/npcm7xx_sdhci.c | 21 +++++++++------------ hw/sd/pl181.c | 35 +++++++++++++++-------------------- hw/sd/pxa2xx_mmci.c | 35 +++++++++++++++-------------------- hw/sd/sd.c | 37 ++++++++++++++++--------------------- hw/sd/sdhci-pci.c | 25 +++++++++++-------------- hw/sd/ssi-sd.c | 19 ++++++++----------- 10 files changed, 113 insertions(+), 151 deletions(-) diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c index be8cafd65f..e53206d959 100644 --- a/hw/sd/aspeed_sdhci.c +++ b/hw/sd/aspeed_sdhci.c @@ -198,16 +198,13 @@ static void aspeed_sdhci_class_init(ObjectClass *clas= sp, void *data) device_class_set_props(dc, aspeed_sdhci_properties); } =20 -static const TypeInfo aspeed_sdhci_info =3D { - .name =3D TYPE_ASPEED_SDHCI, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(AspeedSDHCIState), - .class_init =3D aspeed_sdhci_class_init, +static const TypeInfo aspeed_sdhci_types[] =3D { + { + .name =3D TYPE_ASPEED_SDHCI, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(AspeedSDHCIState), + .class_init =3D aspeed_sdhci_class_init, + }, }; =20 -static void aspeed_sdhci_register_types(void) -{ - type_register_static(&aspeed_sdhci_info); -} - -type_init(aspeed_sdhci_register_types) +DEFINE_TYPES(aspeed_sdhci_types) diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c index 9431c35914..a600cf39e2 100644 --- a/hw/sd/bcm2835_sdhost.c +++ b/hw/sd/bcm2835_sdhost.c @@ -436,24 +436,19 @@ static void bcm2835_sdhost_class_init(ObjectClass *kl= ass, void *data) dc->vmsd =3D &vmstate_bcm2835_sdhost; } =20 -static const TypeInfo bcm2835_sdhost_info =3D { - .name =3D TYPE_BCM2835_SDHOST, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(BCM2835SDHostState), - .class_init =3D bcm2835_sdhost_class_init, - .instance_init =3D bcm2835_sdhost_init, +static const TypeInfo bcm2835_sdhost_types[] =3D { + { + .name =3D TYPE_BCM2835_SDHOST, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(BCM2835SDHostState), + .class_init =3D bcm2835_sdhost_class_init, + .instance_init =3D bcm2835_sdhost_init, + }, + { + .name =3D TYPE_BCM2835_SDHOST_BUS, + .parent =3D TYPE_SD_BUS, + .instance_size =3D sizeof(SDBus), + }, }; =20 -static const TypeInfo bcm2835_sdhost_bus_info =3D { - .name =3D TYPE_BCM2835_SDHOST_BUS, - .parent =3D TYPE_SD_BUS, - .instance_size =3D sizeof(SDBus), -}; - -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) +DEFINE_TYPES(bcm2835_sdhost_types) diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c index 75db34befe..ef4e0d74e3 100644 --- a/hw/sd/cadence_sdhci.c +++ b/hw/sd/cadence_sdhci.c @@ -175,17 +175,14 @@ static void cadence_sdhci_class_init(ObjectClass *cla= ssp, void *data) dc->vmsd =3D &vmstate_cadence_sdhci; } =20 -static const TypeInfo cadence_sdhci_info =3D { - .name =3D TYPE_CADENCE_SDHCI, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(CadenceSDHCIState), - .instance_init =3D cadence_sdhci_instance_init, - .class_init =3D cadence_sdhci_class_init, +static const TypeInfo cadence_sdhci_types[] =3D { + { + .name =3D TYPE_CADENCE_SDHCI, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(CadenceSDHCIState), + .instance_init =3D cadence_sdhci_instance_init, + .class_init =3D cadence_sdhci_class_init, + }, }; =20 -static void cadence_sdhci_register_types(void) -{ - type_register_static(&cadence_sdhci_info); -} - -type_init(cadence_sdhci_register_types) +DEFINE_TYPES(cadence_sdhci_types) diff --git a/hw/sd/core.c b/hw/sd/core.c index 30ee62c510..52d5d90045 100644 --- a/hw/sd/core.c +++ b/hw/sd/core.c @@ -259,16 +259,13 @@ void sdbus_reparent_card(SDBus *from, SDBus *to) sdbus_set_readonly(to, readonly); } =20 -static const TypeInfo sd_bus_info =3D { - .name =3D TYPE_SD_BUS, - .parent =3D TYPE_BUS, - .instance_size =3D sizeof(SDBus), - .class_size =3D sizeof(SDBusClass), +static const TypeInfo sd_bus_types[] =3D { + { + .name =3D TYPE_SD_BUS, + .parent =3D TYPE_BUS, + .instance_size =3D sizeof(SDBus), + .class_size =3D sizeof(SDBusClass), + }, }; =20 -static void sd_bus_register_types(void) -{ - type_register_static(&sd_bus_info); -} - -type_init(sd_bus_register_types) +DEFINE_TYPES(sd_bus_types) diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c index b2f5b4a542..9958680090 100644 --- a/hw/sd/npcm7xx_sdhci.c +++ b/hw/sd/npcm7xx_sdhci.c @@ -166,17 +166,14 @@ static void npcm7xx_sdhci_instance_init(Object *obj) TYPE_SYSBUS_SDHCI); } =20 -static const TypeInfo npcm7xx_sdhci_info =3D { - .name =3D TYPE_NPCM7XX_SDHCI, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(NPCM7xxSDHCIState), - .instance_init =3D npcm7xx_sdhci_instance_init, - .class_init =3D npcm7xx_sdhci_class_init, +static const TypeInfo npcm7xx_sdhci_types[] =3D { + { + .name =3D TYPE_NPCM7XX_SDHCI, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(NPCM7xxSDHCIState), + .instance_init =3D npcm7xx_sdhci_instance_init, + .class_init =3D npcm7xx_sdhci_class_init, + }, }; =20 -static void npcm7xx_sdhci_register_types(void) -{ - type_register_static(&npcm7xx_sdhci_info); -} - -type_init(npcm7xx_sdhci_register_types) +DEFINE_TYPES(npcm7xx_sdhci_types) diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 5e554bd467..2b33814d83 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -519,14 +519,6 @@ static void pl181_class_init(ObjectClass *klass, void = *data) k->user_creatable =3D false; } =20 -static const TypeInfo pl181_info =3D { - .name =3D TYPE_PL181, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(PL181State), - .instance_init =3D pl181_init, - .class_init =3D pl181_class_init, -}; - static void pl181_bus_class_init(ObjectClass *klass, void *data) { SDBusClass *sbc =3D SD_BUS_CLASS(klass); @@ -535,17 +527,20 @@ static void pl181_bus_class_init(ObjectClass *klass, = void *data) sbc->set_readonly =3D pl181_set_readonly; } =20 -static const TypeInfo pl181_bus_info =3D { - .name =3D TYPE_PL181_BUS, - .parent =3D TYPE_SD_BUS, - .instance_size =3D sizeof(SDBus), - .class_init =3D pl181_bus_class_init, +static const TypeInfo pl181_info[] =3D { + { + .name =3D TYPE_PL181, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(PL181State), + .instance_init =3D pl181_init, + .class_init =3D pl181_class_init, + }, + { + .name =3D TYPE_PL181_BUS, + .parent =3D TYPE_SD_BUS, + .instance_size =3D sizeof(SDBus), + .class_init =3D pl181_bus_class_init, + }, }; =20 -static void pl181_register_types(void) -{ - type_register_static(&pl181_info); - type_register_static(&pl181_bus_info); -} - -type_init(pl181_register_types) +DEFINE_TYPES(pl181_info) diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 4749e935d8..5e8ea69188 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -575,25 +575,20 @@ static void pxa2xx_mmci_bus_class_init(ObjectClass *k= lass, void *data) sbc->set_readonly =3D pxa2xx_mmci_set_readonly; } =20 -static const TypeInfo pxa2xx_mmci_info =3D { - .name =3D TYPE_PXA2XX_MMCI, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(PXA2xxMMCIState), - .instance_init =3D pxa2xx_mmci_instance_init, - .class_init =3D pxa2xx_mmci_class_init, +static const TypeInfo pxa2xx_mmci_types[] =3D { + { + .name =3D TYPE_PXA2XX_MMCI, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(PXA2xxMMCIState), + .instance_init =3D pxa2xx_mmci_instance_init, + .class_init =3D pxa2xx_mmci_class_init, + }, + { + .name =3D TYPE_PXA2XX_MMCI_BUS, + .parent =3D TYPE_SD_BUS, + .instance_size =3D sizeof(SDBus), + .class_init =3D pxa2xx_mmci_bus_class_init, + }, }; =20 -static const TypeInfo pxa2xx_mmci_bus_info =3D { - .name =3D TYPE_PXA2XX_MMCI_BUS, - .parent =3D TYPE_SD_BUS, - .instance_size =3D sizeof(SDBus), - .class_init =3D pxa2xx_mmci_bus_class_init, -}; - -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) +DEFINE_TYPES(pxa2xx_mmci_types) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 4823befdef..1106ff7d78 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2278,16 +2278,6 @@ static void sd_class_init(ObjectClass *klass, void *= data) sc->proto =3D &sd_proto_sd; } =20 -static const TypeInfo sd_info =3D { - .name =3D TYPE_SD_CARD, - .parent =3D TYPE_DEVICE, - .instance_size =3D sizeof(SDState), - .class_size =3D sizeof(SDCardClass), - .class_init =3D sd_class_init, - .instance_init =3D sd_instance_init, - .instance_finalize =3D sd_instance_finalize, -}; - /* * We do not model the chip select pin, so allow the board to select * whether card should be in SSI or MMC/SD mode. It is also up to the @@ -2303,16 +2293,21 @@ static void sd_spi_class_init(ObjectClass *klass, v= oid *data) sc->proto =3D &sd_proto_spi; } =20 -static const TypeInfo sd_spi_info =3D { - .name =3D TYPE_SD_CARD_SPI, - .parent =3D TYPE_SD_CARD, - .class_init =3D sd_spi_class_init, +static const TypeInfo sd_types[] =3D { + { + .name =3D TYPE_SD_CARD, + .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(SDState), + .class_size =3D sizeof(SDCardClass), + .class_init =3D sd_class_init, + .instance_init =3D sd_instance_init, + .instance_finalize =3D sd_instance_finalize, + }, + { + .name =3D TYPE_SD_CARD_SPI, + .parent =3D TYPE_SD_CARD, + .class_init =3D sd_spi_class_init, + }, }; =20 -static void sd_register_types(void) -{ - type_register_static(&sd_info); - type_register_static(&sd_spi_info); -} - -type_init(sd_register_types) +DEFINE_TYPES(sd_types) diff --git a/hw/sd/sdhci-pci.c b/hw/sd/sdhci-pci.c index c737c8b930..9b7bee8b3f 100644 --- a/hw/sd/sdhci-pci.c +++ b/hw/sd/sdhci-pci.c @@ -68,20 +68,17 @@ static void sdhci_pci_class_init(ObjectClass *klass, vo= id *data) sdhci_common_class_init(klass, data); } =20 -static const TypeInfo sdhci_pci_info =3D { - .name =3D TYPE_PCI_SDHCI, - .parent =3D TYPE_PCI_DEVICE, - .instance_size =3D sizeof(SDHCIState), - .class_init =3D sdhci_pci_class_init, - .interfaces =3D (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, +static const TypeInfo sdhci_pci_types[] =3D { + { + .name =3D TYPE_PCI_SDHCI, + .parent =3D TYPE_PCI_DEVICE, + .instance_size =3D sizeof(SDHCIState), + .class_init =3D sdhci_pci_class_init, + .interfaces =3D (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, }, }; =20 -static void sdhci_pci_register_type(void) -{ - type_register_static(&sdhci_pci_info); -} - -type_init(sdhci_pci_register_type) +DEFINE_TYPES(sdhci_pci_types) diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index 167c03b780..a6cc1ad6c8 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -403,16 +403,13 @@ static void ssi_sd_class_init(ObjectClass *klass, voi= d *data) dc->user_creatable =3D false; } =20 -static const TypeInfo ssi_sd_info =3D { - .name =3D TYPE_SSI_SD, - .parent =3D TYPE_SSI_PERIPHERAL, - .instance_size =3D sizeof(ssi_sd_state), - .class_init =3D ssi_sd_class_init, +static const TypeInfo ssi_sd_types[] =3D { + { + .name =3D TYPE_SSI_SD, + .parent =3D TYPE_SSI_PERIPHERAL, + .instance_size =3D sizeof(ssi_sd_state), + .class_init =3D ssi_sd_class_init, + }, }; =20 -static void ssi_sd_register_types(void) -{ - type_register_static(&ssi_sd_info); -} - -type_init(ssi_sd_register_types) +DEFINE_TYPES(ssi_sd_types) --=20 2.41.0