[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 87/88] esp.c: switch TypeInfo registration to use DEFINE_TYPES()
|
From: |
Mark Cave-Ayland |
|
Subject: |
[PATCH 87/88] esp.c: switch TypeInfo registration to use DEFINE_TYPES() macro |
|
Date: |
Fri, 12 Jan 2024 12:54:19 +0000 |
The use of the DEFINE_TYPES() macro will soon be recommended over the use of
calling type_init() directly.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/scsi/esp.c | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 04615d8b5f..b8762d5ee0 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -1549,14 +1549,6 @@ static void sysbus_esp_class_init(ObjectClass *klass,
void *data)
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
-static const TypeInfo sysbus_esp_info = {
- .name = TYPE_SYSBUS_ESP,
- .parent = TYPE_SYS_BUS_DEVICE,
- .instance_init = sysbus_esp_init,
- .instance_size = sizeof(SysBusESPState),
- .class_init = sysbus_esp_class_init,
-};
-
static void esp_finalize(Object *obj)
{
ESPState *s = ESP(obj);
@@ -1582,19 +1574,22 @@ static void esp_class_init(ObjectClass *klass, void
*data)
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
-static const TypeInfo esp_info = {
- .name = TYPE_ESP,
- .parent = TYPE_DEVICE,
- .instance_init = esp_init,
- .instance_finalize = esp_finalize,
- .instance_size = sizeof(ESPState),
- .class_init = esp_class_init,
+static const TypeInfo esp_info_types[] = {
+ {
+ .name = TYPE_SYSBUS_ESP,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_init = sysbus_esp_init,
+ .instance_size = sizeof(SysBusESPState),
+ .class_init = sysbus_esp_class_init,
+ },
+ {
+ .name = TYPE_ESP,
+ .parent = TYPE_DEVICE,
+ .instance_init = esp_init,
+ .instance_finalize = esp_finalize,
+ .instance_size = sizeof(ESPState),
+ .class_init = esp_class_init,
+ },
};
-static void esp_register_types(void)
-{
- type_register_static(&sysbus_esp_info);
- type_register_static(&esp_info);
-}
-
-type_init(esp_register_types)
+DEFINE_TYPES(esp_info_types)
--
2.39.2
- [PATCH 82/88] esp.c: consolidate DMA and PDMA logic in STATUS and MESSAGE IN phases, (continued)
- [PATCH 82/88] esp.c: consolidate DMA and PDMA logic in STATUS and MESSAGE IN phases, Mark Cave-Ayland, 2024/01/12
- [PATCH 69/88] esp.c: consolidate end of command sequence after ICCS command, Mark Cave-Ayland, 2024/01/12
- [PATCH 52/88] esp.c: move CMD_SELATNS end of command logic to esp_do_dma() and do_dma_pdma_cb(), Mark Cave-Ayland, 2024/01/12
- [PATCH 68/88] esp.c: move write_response() non-DMA logic to esp_do_nodma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 86/88] esp.c: keep track of the DRQ state during DMA, Mark Cave-Ayland, 2024/01/12
- [PATCH 88/88] esp.c: add my copyright to the file, Mark Cave-Ayland, 2024/01/12
- [PATCH 60/88] esp.c: use deferred interrupts for both DATA IN and DATA OUT phases, Mark Cave-Ayland, 2024/01/12
- [PATCH 85/88] esp.c: rename irq_data IRQ to drq_irq, Mark Cave-Ayland, 2024/01/12
- [PATCH 83/88] esp.c: replace n variable with len in esp_do_nodma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 67/88] esp.c: replace get_cmd() with esp_do_nodma(), Mark Cave-Ayland, 2024/01/12
- [PATCH 87/88] esp.c: switch TypeInfo registration to use DEFINE_TYPES() macro,
Mark Cave-Ayland <=
- Re: [PATCH 00/88] esp: rework ESP emulation to use a SCSI phase-based state machine, Mark Cave-Ayland, 2024/01/22
- Re: [PATCH 00/88] esp: rework ESP emulation to use a SCSI phase-based state machine, Thomas Huth, 2024/01/25