From: Bernhard Beschow <shentey@gmail.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Yi Liu" <yi.l.liu@intel.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Anthony PERARD" <anthony@xenproject.org>,
"Gustavo Romero" <gustavo.romero@linaro.org>,
"Jason Wang" <jasowang@redhat.com>,
qemu-ppc@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alexander Graf" <graf@amazon.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
xen-devel@lists.xenproject.org,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Paul Durrant" <paul@xen.org>,
"Clément Mathieu--Drif" <clement.mathieu--drif@eviden.com>,
"Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH 2/9] hw/sysbus: Declare QOM types using DEFINE_TYPES() macro
Date: Mon, 27 Jan 2025 09:23:38 +0000 [thread overview]
Message-ID: <003404AB-0220-474C-B9DC-4CD88225C420@gmail.com> (raw)
In-Reply-To: <20250125181343.59151-3-philmd@linaro.org>
Am 25. Januar 2025 18:13:36 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>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.
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>---
> hw/core/sysbus.c | 39 +++++++++++++++++----------------------
> 1 file changed, 17 insertions(+), 22 deletions(-)
>
>diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
>index f713bbfe04f..306f98406c0 100644
>--- a/hw/core/sysbus.c
>+++ b/hw/core/sysbus.c
>@@ -80,13 +80,6 @@ static void system_bus_class_init(ObjectClass *klass, void *data)
> k->get_fw_dev_path = sysbus_get_fw_dev_path;
> }
>
>-static const TypeInfo system_bus_info = {
>- .name = TYPE_SYSTEM_BUS,
>- .parent = TYPE_BUS,
>- .instance_size = sizeof(BusState),
>- .class_init = system_bus_class_init,
>-};
>-
> /* Check whether an IRQ source exists */
> bool sysbus_has_irq(SysBusDevice *dev, int n)
> {
>@@ -306,15 +299,6 @@ static void sysbus_device_class_init(ObjectClass *klass, void *data)
> k->user_creatable = false;
> }
>
>-static const TypeInfo sysbus_device_type_info = {
>- .name = TYPE_SYS_BUS_DEVICE,
>- .parent = TYPE_DEVICE,
>- .instance_size = sizeof(SysBusDevice),
>- .abstract = true,
>- .class_size = sizeof(SysBusDeviceClass),
>- .class_init = sysbus_device_class_init,
>-};
>-
> static BusState *main_system_bus;
>
> static void main_system_bus_create(void)
>@@ -337,10 +321,21 @@ 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);
>-}
>+static const TypeInfo sysbus_types[] = {
>+ {
>+ .name = TYPE_SYSTEM_BUS,
>+ .parent = TYPE_BUS,
>+ .instance_size = sizeof(BusState),
>+ .class_init = system_bus_class_init,
>+ },
>+ {
>+ .name = TYPE_SYS_BUS_DEVICE,
>+ .parent = TYPE_DEVICE,
>+ .instance_size = sizeof(SysBusDevice),
>+ .abstract = true,
>+ .class_size = sizeof(SysBusDeviceClass),
>+ .class_init = sysbus_device_class_init,
>+ },
>+};
>
>-type_init(sysbus_register_types)
>+DEFINE_TYPES(sysbus_types)
Can now omit the "qom/module.h" include. With that changed:
Reviewed-by: Bernhard Beschow
next prev parent reply other threads:[~2025-01-27 9:24 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-25 18:13 [PATCH 0/9] hw/sysbus/platform-bus: Introduce TYPE_DYNAMIC_SYS_BUS_DEVICE Philippe Mathieu-Daudé
2025-01-25 18:13 ` [PATCH 1/9] hw/sysbus: Use sizeof(BusState) in main_system_bus_create() Philippe Mathieu-Daudé
2025-01-26 21:42 ` Richard Henderson
2025-01-27 6:21 ` CLEMENT MATHIEU--DRIF
2025-01-25 18:13 ` [PATCH 2/9] hw/sysbus: Declare QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2025-01-26 21:45 ` Richard Henderson
2025-01-27 6:26 ` CLEMENT MATHIEU--DRIF
2025-01-27 9:23 ` Bernhard Beschow [this message]
2025-01-25 18:13 ` [PATCH 3/9] hw/sysbus: Introduce TYPE_DYNAMIC_SYS_BUS_DEVICE Philippe Mathieu-Daudé
2025-01-26 21:47 ` Richard Henderson
2025-01-27 6:19 ` CLEMENT MATHIEU--DRIF
2025-01-25 18:13 ` [PATCH 4/9] hw/vfio: Have VFIO_PLATFORM devices inherit from DYNAMIC_SYS_BUS_DEVICE Philippe Mathieu-Daudé
2025-01-26 21:52 ` Richard Henderson
2025-01-25 18:13 ` [PATCH 5/9] hw/display: Have RAMFB device " Philippe Mathieu-Daudé
2025-01-26 21:53 ` Richard Henderson
2025-01-27 6:17 ` CLEMENT MATHIEU--DRIF
2025-01-25 18:13 ` [PATCH 6/9] hw/i386: Have X86_IOMMU devices " Philippe Mathieu-Daudé
2025-01-26 21:54 ` Richard Henderson
2025-01-27 6:14 ` CLEMENT MATHIEU--DRIF
2025-01-25 18:13 ` [PATCH 7/9] hw/net: Have eTSEC device " Philippe Mathieu-Daudé
2025-01-26 21:54 ` Richard Henderson
2025-01-27 6:21 ` CLEMENT MATHIEU--DRIF
2025-01-27 9:21 ` Bernhard Beschow
2025-01-25 18:13 ` [PATCH 8/9] hw/tpm: Have TPM TIS sysbus " Philippe Mathieu-Daudé
2025-01-26 21:55 ` Richard Henderson
2025-01-27 6:16 ` CLEMENT MATHIEU--DRIF
2025-01-27 16:52 ` Stefan Berger
2025-01-25 18:13 ` [RFC PATCH 9/9] hw/xen: Have legacy Xen backend " Philippe Mathieu-Daudé
2025-01-27 9:41 ` [PATCH] hw/*/xen*: Prefer QOM cast for XenLegacyDevice Bernhard Beschow
2025-02-04 21:23 ` Philippe Mathieu-Daudé
2025-01-27 9:46 ` [RFC PATCH 9/9] hw/xen: Have legacy Xen backend inherit from DYNAMIC_SYS_BUS_DEVICE Bernhard Beschow
2025-02-04 21:25 ` Philippe Mathieu-Daudé
2025-02-04 23:12 ` Bernhard Beschow
2025-02-05 18:10 ` Philippe Mathieu-Daudé
2025-01-27 0:29 ` [PATCH 0/9] hw/sysbus/platform-bus: Introduce TYPE_DYNAMIC_SYS_BUS_DEVICE Alexander Graf
2025-01-28 10:41 ` Gerd Hoffmann
2025-01-28 10:50 ` Peter Maydell
2025-01-28 12:57 ` BALATON Zoltan
2025-01-28 15:10 ` Philippe Mathieu-Daudé
2025-01-28 19:13 ` Bernhard Beschow
2025-02-10 20:36 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=003404AB-0220-474C-B9DC-4CD88225C420@gmail.com \
--to=shentey@gmail.com \
--cc=alex.williamson@redhat.com \
--cc=anthony@xenproject.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=clement.mathieu--drif@eviden.com \
--cc=clg@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=graf@amazon.com \
--cc=gustavo.romero@linaro.org \
--cc=jasowang@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sstabellini@kernel.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=xen-devel@lists.xenproject.org \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).