[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/16] hw/pci-host/raven: Use DEFINE_TYPES macro
From: |
BALATON Zoltan |
Subject: |
[PATCH 05/16] hw/pci-host/raven: Use DEFINE_TYPES macro |
Date: |
Sun, 04 May 2025 18:01:31 +0200 (CEST) |
Convert to using DEFINE_TYPES macro and move raven_pcihost_class_init
so methods of each object are grouped together.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/pci-host/raven.c | 57 +++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 31 deletions(-)
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 878c915de5..e0f98afebf 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -304,6 +304,15 @@ static void raven_pcihost_initfn(Object *obj)
h->bus = &s->pci_bus;
}
+static void raven_pcihost_class_init(ObjectClass *klass, const void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
+ dc->realize = raven_pcihost_realizefn;
+ dc->fw_name = "pci";
+}
+
static void raven_realize(PCIDevice *d, Error **errp)
{
d->config[PCI_CACHE_LINE_SIZE] = 0x08;
@@ -329,37 +338,23 @@ static void raven_class_init(ObjectClass *klass, const
void *data)
dc->user_creatable = false;
}
-static const TypeInfo raven_info = {
- .name = TYPE_RAVEN_PCI_DEVICE,
- .parent = TYPE_PCI_DEVICE,
- .class_init = raven_class_init,
- .interfaces = (const InterfaceInfo[]) {
- { INTERFACE_CONVENTIONAL_PCI_DEVICE },
- { },
+static const TypeInfo raven_types[] = {
+ {
+ .name = TYPE_RAVEN_PCI_HOST_BRIDGE,
+ .parent = TYPE_PCI_HOST_BRIDGE,
+ .instance_size = sizeof(PREPPCIState),
+ .instance_init = raven_pcihost_initfn,
+ .class_init = raven_pcihost_class_init,
+ },
+ {
+ .name = TYPE_RAVEN_PCI_DEVICE,
+ .parent = TYPE_PCI_DEVICE,
+ .class_init = raven_class_init,
+ .interfaces = (const InterfaceInfo[]) {
+ { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+ { },
+ },
},
};
-static void raven_pcihost_class_init(ObjectClass *klass, const void *data)
-{
- DeviceClass *dc = DEVICE_CLASS(klass);
-
- set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
- dc->realize = raven_pcihost_realizefn;
- dc->fw_name = "pci";
-}
-
-static const TypeInfo raven_pcihost_info = {
- .name = TYPE_RAVEN_PCI_HOST_BRIDGE,
- .parent = TYPE_PCI_HOST_BRIDGE,
- .instance_size = sizeof(PREPPCIState),
- .instance_init = raven_pcihost_initfn,
- .class_init = raven_pcihost_class_init,
-};
-
-static void raven_register_types(void)
-{
- type_register_static(&raven_pcihost_info);
- type_register_static(&raven_info);
-}
-
-type_init(raven_register_types)
+DEFINE_TYPES(raven_types)
--
2.41.3
- [PATCH 00/16] hw/pci-host/raven clean ups, BALATON Zoltan, 2025/05/04
- [PATCH 02/16] hw/pci-host/raven: Revert "raven: Move BIOS loading from board code to PCI host", BALATON Zoltan, 2025/05/04
- [PATCH 01/16] hw/pci-host/raven: Remove is-legacy-prep property, BALATON Zoltan, 2025/05/04
- [PATCH 04/16] hw/pci-host/raven: Simplify host bridge type declaration, BALATON Zoltan, 2025/05/04
- [PATCH 03/16] hw/pci-host/raven: Simplify PCI facing part, BALATON Zoltan, 2025/05/04
- [PATCH 06/16] hw/pci-host/raven: Simplify PCI bus creation, BALATON Zoltan, 2025/05/04
- [PATCH 12/16] hw/pci-host/raven: Fix PCI config direct access region, BALATON Zoltan, 2025/05/04
- [PATCH 13/16] hw/pci-host/raven: Simpify discontiguous IO access, BALATON Zoltan, 2025/05/04
- [PATCH 05/16] hw/pci-host/raven: Use DEFINE_TYPES macro,
BALATON Zoltan <=
- [PATCH 07/16] hw/pci-host/raven: Simplify PCI interrupt routing, BALATON Zoltan, 2025/05/04
- [PATCH 08/16] hw/pci-host/raven: Simplify direct config access address decoding, BALATON Zoltan, 2025/05/04
- [PATCH 10/16] hw/pci-host/raven: Use correct parameter in direct access ops, BALATON Zoltan, 2025/05/04
- [PATCH 09/16] hw/pci-host/raven: Rename direct config access ops, BALATON Zoltan, 2025/05/04
- [PATCH 11/16] hw/pci-host/raven: Do not use parent object for mmcfg region, BALATON Zoltan, 2025/05/04
- [PATCH 14/16] hw/pci-host/raven: Move bus master address space creation to one place, BALATON Zoltan, 2025/05/04
- [PATCH 15/16] hw/pci-host/raven: Do not map regions in init method, BALATON Zoltan, 2025/05/04
- [PATCH 16/16] hw/ppc/prep: Fix non-contiguous IO control bit, BALATON Zoltan, 2025/05/04