hw/aspeed: Convert all Aspeed devices to DEFINE_TYPES() with inlined TypeInfo
cover hw/aspeed: Convert all Aspeed devices to DEFINE_TYPES() with inlined TypeInfo
The QEMU community now prefers the DEFINE_TYPES() macro over the legacy type_register_static()/type_init() pattern for device type registration. DEFINE_TYPES() accepts an array of TypeInfo structs and registers them all in a single call, making the registration code more concise and consistent with modern QEMU coding style.
This series converts all Aspeed device models to use DEFINE_TYPES() and further inlines the individual static TypeInfo variable declarations directly into the types array, eliminating the need for standalone TypeInfo variables scattered throughout each file.
v1:
The changes are purely mechanical refactoring with no functional difference. The 24 patches cover all Aspeed-related device models across hw/adc, hw/arm, hw/fsi, hw/gpio, hw/i2c, hw/intc, hw/misc, hw/net, hw/nvram, hw/pci-host, hw/rtc, hw/ssi, hw/timer and hw/watchdog.
Jamin Lin (24):
hw/misc/aspeed_hace: Convert to DEFINE_TYPES() with inlined TypeInfo hw/misc/aspeed_lpc: Convert to DEFINE_TYPES() with inlined TypeInfo hw/misc/aspeed_ltpi: Convert to DEFINE_TYPES() with inlined TypeInfo hw/misc/aspeed_pwm: Convert to DEFINE_TYPES() with inlined TypeInfo hw/misc/aspeed_sbc: Convert to DEFINE_TYPES() with inlined TypeInfo hw/misc/aspeed_scu: Convert to DEFINE_TYPES() with inlined TypeInfo hw/misc/aspeed_sdmc: Convert to DEFINE_TYPES() with inlined TypeInfo hw/misc:aspeed_sli: Convert to DEFINE_TYPES() with inlined TypeInfo hw/misc/aspeed_xdma: Convert to DEFINE_TYPES() with inlined TypeInfo hw/adc/aspeed_adc: Convert to DEFINE_TYPES() with inlined TypeInfo hw/arm/aspeed_ast1700: Convert to DEFINE_TYPES() with inlined TypeInfo hw/gpio/aspeed_gpio: Convert to DEFINE_TYPES() with inlined TypeInfo hw/gpio/aspeed_sgpio: Convert to DEFINE_TYPES() with inlined TypeInfo hw/intc/aspeed_intc: convert to DEFINE_TYPES() with inlined TypeInfo hw/intc/aspeed_vic: Convert to DEFINE_TYPES() with inlined TypeInfo hw/rtc/aspeed_rtc: Convert to DEFINE_TYPES() with inlined TypeInfo hw/watchdog/wdt_aspeed: Convert to DEFINE_TYPES() with inlined
TypeInfo
hw/nvram/aspeed_otp: Convert to DEFINE_TYPES() with inlined TypeInfo hw/timer/aspeed_timer: Convert to DEFINE_TYPES() with inlined TypeInfo hw/fsi/aspeed_apb2opb: Convert to DEFINE_TYPES() with inlined TypeInfo hw/pci-host/aspeed_pcie: Convert to DEFINE_TYPES() with inlined
TypeInfo
hw/i2c/aspeed_i2c: Convert to DEFINE_TYPES() with inlined TypeInfo hw/net/ftgmac100: Convert to DEFINE_TYPES() with inlined TypeInfo hw/ssi/aspeed_smc: Convert to DEFINE_TYPES() with inlined TypeInfo
hw/adc/aspeed_adc.c | 95 +++++++--------- hw/arm/aspeed_ast1700.c | 21 ++-- hw/fsi/aspeed_apb2opb.c | 42 +++---- hw/gpio/aspeed_gpio.c | 107 ++++++++---------- hw/gpio/aspeed_sgpio.c | 37 +++---- hw/i2c/aspeed_i2c.c | 113 ++++++++----------- hw/intc/aspeed_intc.c | 121 +++++++++----------- hw/intc/aspeed_vic.c | 19 ++-- hw/misc/aspeed_hace.c | 81 ++++++-------- hw/misc/aspeed_lpc.c | 21 ++-- hw/misc/aspeed_ltpi.c | 19 ++-- hw/misc/aspeed_pwm.c | 19 ++-- hw/misc/aspeed_sbc.c | 46 ++++---- hw/misc/aspeed_scu.c | 107 ++++++++---------- hw/misc/aspeed_sdmc.c | 73 ++++++------ hw/misc/aspeed_sli.c | 44 ++++---- hw/misc/aspeed_xdma.c | 58 +++++----- hw/net/ftgmac100.c | 32 +++--- hw/nvram/aspeed_otp.c | 19 ++-- hw/pci-host/aspeed_pcie.c | 94 +++++++--------- hw/rtc/aspeed_rtc.c | 19 ++-- hw/ssi/aspeed_smc.c | 228 ++++++++++++++++---------------------- hw/timer/aspeed_timer.c | 83 ++++++-------- hw/watchdog/wdt_aspeed.c | 93 +++++++--------- 24 files changed, 678 insertions(+), 913 deletions(-)
Signature · 1 line
2.43.0
PATCH 3/24 hw/misc/aspeed_ltpi: Convert to DEFINE_TYPES() with inlined TypeInfo
Replace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline the standalone 'aspeed_ltpi_info' TypeInfo variable directly into the 'aspeed_ltpi_types[]' array, removing the need for a separate declaration.
No functional change.
--- hw/misc/aspeed_ltpi.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
hw/misc/aspeed_ltpi.c +8 -11
@@ -179,16 +179,13 @@ static void aspeed_ltpi_class_init(ObjectClass *klass, const void *data) rc->phases.hold = aspeed_ltpi_reset_hold; } -static const TypeInfo aspeed_ltpi_info = { - .name =TYPE_ASPEED_LTPI , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedLTPIState), - .class_init = aspeed_ltpi_class_init, +static const TypeInfo aspeed_ltpi_types[] = { + { + .name =TYPE_ASPEED_LTPI , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedLTPIState), + .class_init = aspeed_ltpi_class_init, + } }; -static void aspeed_ltpi_register_types (void ) -{ -type_register_static (&aspeed_ltpi_info); -} - -type_init (aspeed_ltpi_register_types); +DEFINE_TYPES (aspeed_ltpi_types)
Signature · 1 line
2.43.0
PATCH 16/24 hw/rtc/aspeed_rtc: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline the standalone 'aspeed_rtc_info' TypeInfo variable directly into the 'aspeed_rtc_types[]' array, removing the need for a separate declaration.
No functional change.
--- hw/rtc/aspeed_rtc.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
hw/rtc/aspeed_rtc.c +8 -11
@@ -166,16 +166,13 @@ static void aspeed_rtc_class_init(ObjectClass *klass, const void *data) rc->phases.hold = aspeed_rtc_reset_hold; } -static const TypeInfo aspeed_rtc_info = { - .name =TYPE_ASPEED_RTC , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedRtcState), - .class_init = aspeed_rtc_class_init, +static const TypeInfo aspeed_rtc_types[] = { + { + .name =TYPE_ASPEED_RTC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedRtcState), + .class_init = aspeed_rtc_class_init, + } }; -static void aspeed_rtc_register_types (void ) -{ -type_register_static (&aspeed_rtc_info); -} - -type_init (aspeed_rtc_register_types) +DEFINE_TYPES (aspeed_rtc_types)
Signature · 1 line
2.43.0
PATCH 22/24 hw/i2c/aspeed_i2c: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 9 standalone TypeInfo variables (aspeed_i2c_bus_info, aspeed_i2c_bus_slave_info, aspeed_i2c_info as abstract base, aspeed_2400_i2c_info, aspeed_2500_i2c_info, aspeed_2600_i2c_info, aspeed_1030_i2c_info and aspeed_2700_i2c_info) directly into the 'aspeed_i2c_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/i2c/aspeed_i2c.c | 113 +++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 65 deletions(-)
hw/i2c/aspeed_i2c.c +48 -65
@@ -1372,16 +1372,6 @@ static void aspeed_i2c_class_init(ObjectClass *klass, const void *data) dc->desc ="Aspeed I2C Controller" ; } -static const TypeInfo aspeed_i2c_info = { - .name =TYPE_ASPEED_I2C , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_init = aspeed_i2c_instance_init, - .instance_size =sizeof (AspeedI2CState), - .class_init = aspeed_i2c_class_init, - .class_size =sizeof (AspeedI2CClass), - .abstract = true, -}; -static int aspeed_i2c_bus_new_slave_event (AspeedI2CBus *bus,enum i2c_event event) {
@@ -1500,13 +1490,6 @@ static void aspeed_i2c_bus_slave_class_init(ObjectClass *klass, sc->send_async = aspeed_i2c_bus_slave_send_async; } -static const TypeInfo aspeed_i2c_bus_slave_info = { - .name =TYPE_ASPEED_I2C_BUS_SLAVE , - .parent =TYPE_I2C_SLAVE , - .instance_size =sizeof (AspeedI2CBusSlave), - .class_init = aspeed_i2c_bus_slave_class_init, -}; -static void aspeed_i2c_bus_reset_hold (Object *obj,ResetType type) {AspeedI2CBus *s =ASPEED_I2C_BUS (obj);
@@ -1565,13 +1548,6 @@ static void aspeed_i2c_bus_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_i2c_bus_properties); } -static const TypeInfo aspeed_i2c_bus_info = { - .name =TYPE_ASPEED_I2C_BUS , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedI2CBus), - .class_init = aspeed_i2c_bus_class_init, -}; -static qemu_irq aspeed_2400_i2c_bus_get_irq (AspeedI2CBus *bus) {return bus->controller->irq;
@@ -1605,12 +1581,6 @@ static void aspeed_2400_i2c_class_init(ObjectClass *klass, const void *data) aic->mem_size =0x1000 ; } -static const TypeInfo aspeed_2400_i2c_info = { - .name =TYPE_ASPEED_2400_I2C , - .parent =TYPE_ASPEED_I2C , - .class_init = aspeed_2400_i2c_class_init, -}; -static qemu_irq aspeed_2500_i2c_bus_get_irq (AspeedI2CBus *bus) {return bus->controller->irq;
@@ -1640,12 +1610,6 @@ static void aspeed_2500_i2c_class_init(ObjectClass *klass, const void *data) aic->mem_size =0x1000 ; } -static const TypeInfo aspeed_2500_i2c_info = { - .name =TYPE_ASPEED_2500_I2C , - .parent =TYPE_ASPEED_I2C , - .class_init = aspeed_2500_i2c_class_init, -}; -static qemu_irq aspeed_2600_i2c_bus_get_irq (AspeedI2CBus *bus) {return bus->irq;
@@ -1669,12 +1633,6 @@ static void aspeed_2600_i2c_class_init(ObjectClass *klass, const void *data) aic->mem_size =0x1000 ; } -static const TypeInfo aspeed_2600_i2c_info = { - .name =TYPE_ASPEED_2600_I2C , - .parent =TYPE_ASPEED_I2C , - .class_init = aspeed_2600_i2c_class_init, -}; -static void aspeed_1030_i2c_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -1693,12 +1651,6 @@ static void aspeed_1030_i2c_class_init(ObjectClass *klass, const void *data) aic->mem_size =0x10000 ; } -static const TypeInfo aspeed_1030_i2c_info = { - .name =TYPE_ASPEED_1030_I2C , - .parent =TYPE_ASPEED_I2C , - .class_init = aspeed_1030_i2c_class_init, -}; -static void aspeed_2700_i2c_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -1720,25 +1672,56 @@ static void aspeed_2700_i2c_class_init(ObjectClass *klass, const void *data) aic->has_dma64 = true; } -static const TypeInfo aspeed_2700_i2c_info = { - .name =TYPE_ASPEED_2700_I2C , - .parent =TYPE_ASPEED_I2C , - .class_init = aspeed_2700_i2c_class_init, +static const TypeInfo aspeed_i2c_types[] = { + { + .name =TYPE_ASPEED_I2C_BUS , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedI2CBus), + .class_init = aspeed_i2c_bus_class_init, + }, + { + .name =TYPE_ASPEED_I2C_BUS_SLAVE , + .parent =TYPE_I2C_SLAVE , + .instance_size =sizeof (AspeedI2CBusSlave), + .class_init = aspeed_i2c_bus_slave_class_init, + }, + { + .name =TYPE_ASPEED_I2C , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = aspeed_i2c_instance_init, + .instance_size =sizeof (AspeedI2CState), + .class_init = aspeed_i2c_class_init, + .class_size =sizeof (AspeedI2CClass), + .abstract = true, + }, + { + .name =TYPE_ASPEED_1030_I2C , + .parent =TYPE_ASPEED_I2C , + .class_init = aspeed_1030_i2c_class_init, + }, + { + .name =TYPE_ASPEED_2400_I2C , + .parent =TYPE_ASPEED_I2C , + .class_init = aspeed_2400_i2c_class_init, + }, + { + .name =TYPE_ASPEED_2500_I2C , + .parent =TYPE_ASPEED_I2C , + .class_init = aspeed_2500_i2c_class_init, + }, + { + .name =TYPE_ASPEED_2600_I2C , + .parent =TYPE_ASPEED_I2C , + .class_init = aspeed_2600_i2c_class_init, + }, + { + .name =TYPE_ASPEED_2700_I2C , + .parent =TYPE_ASPEED_I2C , + .class_init = aspeed_2700_i2c_class_init, + } }; -static void aspeed_i2c_register_types (void ) -{ -type_register_static (&aspeed_i2c_bus_info); -type_register_static (&aspeed_i2c_bus_slave_info); -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_register_static (&aspeed_1030_i2c_info); -type_register_static (&aspeed_2700_i2c_info); -} - -type_init (aspeed_i2c_register_types) +DEFINE_TYPES (aspeed_i2c_types) I2CBus *aspeed_i2c_get_bus(AspeedI2CState *s, int busnr)
Signature · 1 line
2.43.0
PATCH 5/24 hw/misc/aspeed_sbc: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 3 standalone TypeInfo variables (aspeed_2600_sbc_info, aspeed_ast10x0_sbc_info, aspeed_sbc_info) directly into the 'aspeed_sbc_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/misc/aspeed_sbc.c | 46 +++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 26 deletions(-)
hw/misc/aspeed_sbc.c +20 -26
@@ -338,14 +338,6 @@ static void aspeed_sbc_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_sbc_properties); } -static const TypeInfo aspeed_sbc_info = { - .name =TYPE_ASPEED_SBC , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedSBCState), - .instance_init = aspeed_sbc_instance_init, - .class_init = aspeed_sbc_class_init, - .class_size =sizeof (AspeedSBCClass) -};static void aspeed_ast2600_sbc_class_init (ObjectClass *klass,const void *data) {
@@ -356,12 +348,6 @@ static void aspeed_ast2600_sbc_class_init(ObjectClass *klass, const void *data) sc->has_otp = true; } -static const TypeInfo aspeed_ast2600_sbc_info = { - .name =TYPE_ASPEED_AST2600_SBC , - .parent =TYPE_ASPEED_SBC , - .class_init = aspeed_ast2600_sbc_class_init, -}; -static void aspeed_ast10x0_sbc_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -371,17 +357,25 @@ static void aspeed_ast10x0_sbc_class_init(ObjectClass *klass, const void *data) sc->has_otp = true; } -static const TypeInfo aspeed_ast10x0_sbc_info = { - .name =TYPE_ASPEED_AST10X0_SBC , - .parent =TYPE_ASPEED_SBC , - .class_init = aspeed_ast10x0_sbc_class_init, +static const TypeInfo aspeed_sbc_types[] = { + { + .name =TYPE_ASPEED_SBC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedSBCState), + .instance_init = aspeed_sbc_instance_init, + .class_init = aspeed_sbc_class_init, + .class_size =sizeof (AspeedSBCClass), + }, + { + .name =TYPE_ASPEED_AST10X0_SBC , + .parent =TYPE_ASPEED_SBC , + .class_init = aspeed_ast10x0_sbc_class_init, + }, + { + .name =TYPE_ASPEED_AST2600_SBC , + .parent =TYPE_ASPEED_SBC , + .class_init = aspeed_ast2600_sbc_class_init, + } }; -static void aspeed_sbc_register_types (void ) -{ -type_register_static (&aspeed_ast2600_sbc_info); -type_register_static (&aspeed_ast10x0_sbc_info); -type_register_static (&aspeed_sbc_info); -} - -type_init (aspeed_sbc_register_types); +DEFINE_TYPES (aspeed_sbc_types)
Signature · 1 line
2.43.0
PATCH 6/24 hw/misc/aspeed_scu: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 7 standalone TypeInfo variables (aspeed_scu_info as abstract base, aspeed_2400_scu_info, aspeed_2500_scu_info, aspeed_2600_scu_info, aspeed_1030_scu_info, aspeed_2700_scu_info, aspeed_2700_scuio_info) directly into the 'aspeed_scu_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/misc/aspeed_scu.c | 107 +++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 61 deletions(-)
hw/misc/aspeed_scu.c +46 -61
@@ -624,15 +624,6 @@ static void aspeed_scu_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_scu_properties); } -static const TypeInfo aspeed_scu_info = { - .name =TYPE_ASPEED_SCU , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedSCUState), - .class_init = aspeed_scu_class_init, - .class_size =sizeof (AspeedSCUClass), - .abstract = true, -}; -static void aspeed_2400_scu_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -648,13 +639,6 @@ static void aspeed_2400_scu_class_init(ObjectClass *klass, const void *data) asc->ops = &aspeed_ast2400_scu_ops; } -static const TypeInfo aspeed_2400_scu_info = { - .name =TYPE_ASPEED_2400_SCU , - .parent =TYPE_ASPEED_SCU , - .instance_size =sizeof (AspeedSCUState), - .class_init = aspeed_2400_scu_class_init, -}; -static void aspeed_2500_scu_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -670,13 +654,6 @@ static void aspeed_2500_scu_class_init(ObjectClass *klass, const void *data) asc->ops = &aspeed_ast2500_scu_ops; } -static const TypeInfo aspeed_2500_scu_info = { - .name =TYPE_ASPEED_2500_SCU , - .parent =TYPE_ASPEED_SCU , - .instance_size =sizeof (AspeedSCUState), - .class_init = aspeed_2500_scu_class_init, -}; -static uint64_t aspeed_ast2600_scu_read (void *opaque,hwaddr offset,unsigned size) {
@@ -859,13 +836,6 @@ static void aspeed_2600_scu_class_init(ObjectClass *klass, const void *data) asc->ops = &aspeed_ast2600_scu_ops; } -static const TypeInfo aspeed_2600_scu_info = { - .name =TYPE_ASPEED_2600_SCU , - .parent =TYPE_ASPEED_SCU , - .instance_size =sizeof (AspeedSCUState), - .class_init = aspeed_2600_scu_class_init, -}; -static uint64_t aspeed_ast2700_scu_read (void *opaque,hwaddr offset,unsigned size) {
@@ -1099,20 +1069,6 @@ static void aspeed_2700_scuio_class_init(ObjectClass *klass, const void *data) asc->ops = &aspeed_ast2700_scuio_ops; } -static const TypeInfo aspeed_2700_scu_info = { - .name =TYPE_ASPEED_2700_SCU , - .parent =TYPE_ASPEED_SCU , - .instance_size =sizeof (AspeedSCUState), - .class_init = aspeed_2700_scu_class_init, -}; - -static const TypeInfo aspeed_2700_scuio_info = { - .name =TYPE_ASPEED_2700_SCUIO , - .parent =TYPE_ASPEED_SCU , - .instance_size =sizeof (AspeedSCUState), - .class_init = aspeed_2700_scuio_class_init, -}; -static const uint32_t ast1030_a1_resets[ASPEED_AST2600_SCU_NR_REGS ] = { [AST2600_SYS_RST_CTRL ] =0xFFC3FED8 , [AST2600_SYS_RST_CTRL2 ] =0x09FFFFFC ,
@@ -1158,22 +1114,51 @@ static void aspeed_1030_scu_class_init(ObjectClass *klass, const void *data) asc->ops = &aspeed_ast2600_scu_ops; } -static const TypeInfo aspeed_1030_scu_info = { - .name =TYPE_ASPEED_1030_SCU , - .parent =TYPE_ASPEED_SCU , - .instance_size =sizeof (AspeedSCUState), - .class_init = aspeed_1030_scu_class_init, +static const TypeInfo aspeed_scu_types[] = { + { + .name =TYPE_ASPEED_SCU , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_scu_class_init, + .class_size =sizeof (AspeedSCUClass), + .abstract = true, + }, + { + .name =TYPE_ASPEED_1030_SCU , + .parent =TYPE_ASPEED_SCU , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_1030_scu_class_init, + }, + { + .name =TYPE_ASPEED_2400_SCU , + .parent =TYPE_ASPEED_SCU , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_2400_scu_class_init, + }, + { + .name =TYPE_ASPEED_2500_SCU , + .parent =TYPE_ASPEED_SCU , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_2500_scu_class_init, + }, + { + .name =TYPE_ASPEED_2600_SCU , + .parent =TYPE_ASPEED_SCU , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_2600_scu_class_init, + }, + { + .name =TYPE_ASPEED_2700_SCU , + .parent =TYPE_ASPEED_SCU , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_2700_scu_class_init, + }, + { + .name =TYPE_ASPEED_2700_SCUIO , + .parent =TYPE_ASPEED_SCU , + .instance_size =sizeof (AspeedSCUState), + .class_init = aspeed_2700_scuio_class_init, + } }; -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_register_static (&aspeed_1030_scu_info); -type_register_static (&aspeed_2700_scu_info); -type_register_static (&aspeed_2700_scuio_info); -} - -type_init (aspeed_scu_register_types); +DEFINE_TYPES (aspeed_scu_types)
Signature · 1 line
2.43.0
PATCH 23/24 hw/net/ftgmac100: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 2 standalone TypeInfo variables (ftgmac100_info, aspeed_mii_info) directly into the 'ftgmac100_types[]' array, removing the need for separate declarations. Note that this file covers both the Faraday FTGMAC100 Gigabit Ethernet controller and the Aspeed MII controller, which share the same type registration.
--- hw/net/ftgmac100.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-)
hw/net/ftgmac100.c +14 -18
@@ -1279,12 +1279,6 @@ static void ftgmac100_class_init(ObjectClass *klass, const void *data) dc->desc ="Faraday FTGMAC100 Gigabit Ethernet emulation" ; } -static const TypeInfo ftgmac100_info = { - .name =TYPE_FTGMAC100 , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (FTGMAC100State), - .class_init = ftgmac100_class_init, -};/* * AST2600 MII controller
@@ -1438,17 +1432,19 @@ static void aspeed_mii_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_mii_properties); } -static const TypeInfo aspeed_mii_info = { - .name =TYPE_ASPEED_MII , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedMiiState), - .class_init = aspeed_mii_class_init, +static const TypeInfo ftgmac100_types[] = { + { + .name =TYPE_FTGMAC100 , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (FTGMAC100State), + .class_init = ftgmac100_class_init, + }, + { + .name =TYPE_ASPEED_MII , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedMiiState), + .class_init = aspeed_mii_class_init, + } }; -static void ftgmac100_register_types (void ) -{ -type_register_static (&ftgmac100_info); -type_register_static (&aspeed_mii_info); -} - -type_init (ftgmac100_register_types) +DEFINE_TYPES (ftgmac100_types)
Signature · 1 line
2.43.0
PATCH 4/24 hw/misc/aspeed_pwm: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline the standalone 'aspeed_pwm_info' TypeInfo variable directly into the 'aspeed_pwm_types[]' array, removing the need for a separate declaration.
No functional change.
--- hw/misc/aspeed_pwm.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
hw/misc/aspeed_pwm.c +8 -11
@@ -106,16 +106,13 @@ static void aspeed_pwm_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_aspeed_pwm; } -static const TypeInfo aspeed_pwm_info = { - .name =TYPE_ASPEED_PWM , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedPWMState), - .class_init = aspeed_pwm_class_init, +static const TypeInfo aspeed_pwm_types[] = { + { + .name =TYPE_ASPEED_PWM , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedPWMState), + .class_init = aspeed_pwm_class_init, + } }; -static void aspeed_pwm_register_types (void ) -{ -type_register_static (&aspeed_pwm_info); -} - -type_init (aspeed_pwm_register_types); +DEFINE_TYPES (aspeed_pwm_types)
Signature · 1 line
2.43.0
PATCH 12/24 hw/gpio/aspeed_gpio: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 7 standalone TypeInfo variables (aspeed_gpio_info as abstract base, aspeed_2400_gpio_info, aspeed_2500_gpio_info, aspeed_2600_1_8v_gpio_info, aspeed_2600_3_3v_gpio_info, aspeed_1030_gpio_info, aspeed_2700_gpio_info)
directly into the 'aspeed_gpio_types[]'
array, removing the need for separate declarations.
No functional change.
--- hw/gpio/aspeed_gpio.c | 107 ++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 61 deletions(-)
hw/gpio/aspeed_gpio.c +46 -61
@@ -1620,66 +1620,51 @@ static void aspeed_gpio_2700_class_init(ObjectClass *klass, const void *data) agc->reg_ops = &aspeed_gpio_2700_ops; } -static const TypeInfo aspeed_gpio_info = { - .name =TYPE_ASPEED_GPIO , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedGPIOState), - .class_size =sizeof (AspeedGPIOClass), - .class_init = aspeed_gpio_class_init, - .abstract = true, -}; - -static const TypeInfo aspeed_gpio_ast2400_info = { - .name =TYPE_ASPEED_GPIO "-ast2400" , - .parent =TYPE_ASPEED_GPIO , - .class_init = aspeed_gpio_ast2400_class_init, - .instance_init = aspeed_gpio_init, -}; - -static const TypeInfo aspeed_gpio_ast2500_info = { - .name =TYPE_ASPEED_GPIO "-ast2500" , - .parent =TYPE_ASPEED_GPIO , - .class_init = aspeed_gpio_2500_class_init, - .instance_init = aspeed_gpio_init, -}; - -static const TypeInfo aspeed_gpio_ast2600_3_3v_info = { - .name =TYPE_ASPEED_GPIO "-ast2600" , - .parent =TYPE_ASPEED_GPIO , - .class_init = aspeed_gpio_ast2600_3_3v_class_init, - .instance_init = aspeed_gpio_init, -}; - -static const TypeInfo aspeed_gpio_ast2600_1_8v_info = { - .name =TYPE_ASPEED_GPIO "-ast2600-1_8v" , - .parent =TYPE_ASPEED_GPIO , - .class_init = aspeed_gpio_ast2600_1_8v_class_init, - .instance_init = aspeed_gpio_init, -}; - -static const TypeInfo aspeed_gpio_ast1030_info = { - .name =TYPE_ASPEED_GPIO "-ast1030" , - .parent =TYPE_ASPEED_GPIO , - .class_init = aspeed_gpio_1030_class_init, - .instance_init = aspeed_gpio_init, -}; - -static const TypeInfo aspeed_gpio_ast2700_info = { - .name =TYPE_ASPEED_GPIO "-ast2700" , - .parent =TYPE_ASPEED_GPIO , - .class_init = aspeed_gpio_2700_class_init, - .instance_init = aspeed_gpio_init, +static const TypeInfo aspeed_gpio_types[] = { + { + .name =TYPE_ASPEED_GPIO , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedGPIOState), + .class_size =sizeof (AspeedGPIOClass), + .class_init = aspeed_gpio_class_init, + .abstract = true, + }, + { + .name =TYPE_ASPEED_GPIO "-ast1030" , + .parent =TYPE_ASPEED_GPIO , + .class_init = aspeed_gpio_1030_class_init, + .instance_init = aspeed_gpio_init, + }, + { + .name =TYPE_ASPEED_GPIO "-ast2400" , + .parent =TYPE_ASPEED_GPIO , + .class_init = aspeed_gpio_ast2400_class_init, + .instance_init = aspeed_gpio_init, + }, + { + .name =TYPE_ASPEED_GPIO "-ast2500" , + .parent =TYPE_ASPEED_GPIO , + .class_init = aspeed_gpio_2500_class_init, + .instance_init = aspeed_gpio_init, + }, + { + .name =TYPE_ASPEED_GPIO "-ast2600" , + .parent =TYPE_ASPEED_GPIO , + .class_init = aspeed_gpio_ast2600_3_3v_class_init, + .instance_init = aspeed_gpio_init, + }, + { + .name =TYPE_ASPEED_GPIO "-ast2600-1_8v" , + .parent =TYPE_ASPEED_GPIO , + .class_init = aspeed_gpio_ast2600_1_8v_class_init, + .instance_init = aspeed_gpio_init, + }, + { + .name =TYPE_ASPEED_GPIO "-ast2700" , + .parent =TYPE_ASPEED_GPIO , + .class_init = aspeed_gpio_2700_class_init, + .instance_init = aspeed_gpio_init, + } }; -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_3v_info); -type_register_static (&aspeed_gpio_ast2600_1_8v_info); -type_register_static (&aspeed_gpio_ast1030_info); -type_register_static (&aspeed_gpio_ast2700_info); -} - -type_init (aspeed_gpio_register_types); +DEFINE_TYPES (aspeed_gpio_types)
Signature · 1 line
2.43.0
PATCH 17/24 hw/watchdog/wdt_aspeed: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 6 standalone TypeInfo variables (aspeed_wdt_info as abstract base, aspeed_2400_wdt_info, aspeed_2500_wdt_info, aspeed_2600_wdt_info, aspeed_1030_wdt_info, aspeed_2700_wdt_info) directly into the 'aspeed_wdt_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/watchdog/wdt_aspeed.c | 93 +++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 53 deletions(-)
hw/watchdog/wdt_aspeed.c +40 -53
@@ -321,15 +321,6 @@ static void aspeed_wdt_class_init(ObjectClass *klass, const void *data) dc->desc ="Aspeed watchdog device" ; } -static const TypeInfo aspeed_wdt_info = { - .parent =TYPE_SYS_BUS_DEVICE , - .name =TYPE_ASPEED_WDT , - .instance_size =sizeof (AspeedWDTState), - .class_init = aspeed_wdt_class_init, - .class_size =sizeof (AspeedWDTClass), - .abstract = true, -}; -static void aspeed_2400_wdt_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -345,13 +336,6 @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, const void *data) awc->default_reload_value =0x03EF1480 ; } -static const TypeInfo aspeed_2400_wdt_info = { - .name =TYPE_ASPEED_2400_WDT , - .parent =TYPE_ASPEED_WDT , - .instance_size =sizeof (AspeedWDTState), - .class_init = aspeed_2400_wdt_class_init, -}; -static void aspeed_2500_wdt_reset_pulse (AspeedWDTState *s,uint32_t property) {if (property) {
@@ -383,13 +367,6 @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, const void *data) awc->default_reload_value =0x014FB180 ; } -static const TypeInfo aspeed_2500_wdt_info = { - .name =TYPE_ASPEED_2500_WDT , - .parent =TYPE_ASPEED_WDT , - .instance_size =sizeof (AspeedWDTState), - .class_init = aspeed_2500_wdt_class_init, -}; -static void aspeed_2600_wdt_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -406,13 +383,6 @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, const void *data) awc->default_reload_value =0x014FB180 ; } -static const TypeInfo aspeed_2600_wdt_info = { - .name =TYPE_ASPEED_2600_WDT , - .parent =TYPE_ASPEED_WDT , - .instance_size =sizeof (AspeedWDTState), - .class_init = aspeed_2600_wdt_class_init, -}; -static void aspeed_1030_wdt_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -429,13 +399,6 @@ static void aspeed_1030_wdt_class_init(ObjectClass *klass, const void *data) awc->default_reload_value =0x014FB180 ; } -static const TypeInfo aspeed_1030_wdt_info = { - .name =TYPE_ASPEED_1030_WDT , - .parent =TYPE_ASPEED_WDT , - .instance_size =sizeof (AspeedWDTState), - .class_init = aspeed_1030_wdt_class_init, -}; -static void aspeed_2700_wdt_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -452,21 +415,45 @@ static void aspeed_2700_wdt_class_init(ObjectClass *klass, const void *data) awc->default_reload_value =0x014FB180 ; } -static const TypeInfo aspeed_2700_wdt_info = { - .name =TYPE_ASPEED_2700_WDT , - .parent =TYPE_ASPEED_WDT , - .instance_size =sizeof (AspeedWDTState), - .class_init = aspeed_2700_wdt_class_init, +static const TypeInfo aspeed_wdt_types[] = { + { + .parent =TYPE_SYS_BUS_DEVICE , + .name =TYPE_ASPEED_WDT , + .instance_size =sizeof (AspeedWDTState), + .class_init = aspeed_wdt_class_init, + .class_size =sizeof (AspeedWDTClass), + .abstract = true, + }, + { + .name =TYPE_ASPEED_1030_WDT , + .parent =TYPE_ASPEED_WDT , + .instance_size =sizeof (AspeedWDTState), + .class_init = aspeed_1030_wdt_class_init, + }, + { + .name =TYPE_ASPEED_2400_WDT , + .parent =TYPE_ASPEED_WDT , + .instance_size =sizeof (AspeedWDTState), + .class_init = aspeed_2400_wdt_class_init, + }, + { + .name =TYPE_ASPEED_2500_WDT , + .parent =TYPE_ASPEED_WDT , + .instance_size =sizeof (AspeedWDTState), + .class_init = aspeed_2500_wdt_class_init, + }, + { + .name =TYPE_ASPEED_2600_WDT , + .parent =TYPE_ASPEED_WDT , + .instance_size =sizeof (AspeedWDTState), + .class_init = aspeed_2600_wdt_class_init, + }, + { + .name =TYPE_ASPEED_2700_WDT , + .parent =TYPE_ASPEED_WDT , + .instance_size =sizeof (AspeedWDTState), + .class_init = aspeed_2700_wdt_class_init, + } }; -static void wdt_aspeed_register_types (void ) -{ -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_register_static (&aspeed_2700_wdt_info); -type_register_static (&aspeed_1030_wdt_info); -} - -type_init (wdt_aspeed_register_types) +DEFINE_TYPES (aspeed_wdt_types)
Signature · 1 line
2.43.0
PATCH 11/24 hw/arm/aspeed_ast1700: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline the standalone TypeInfo variable directly into the 'aspeed_ast1700_types[]' array, removing the need for a separate declaration.
No functional change.
--- hw/arm/aspeed_ast1700.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
hw/arm/aspeed_ast1700.c +9 -12
@@ -260,17 +260,14 @@ static void aspeed_ast1700_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_ast1700_props); } -static const TypeInfo aspeed_ast1700_info = { - .name =TYPE_ASPEED_AST1700 , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedAST1700SoCState), - .class_init = aspeed_ast1700_class_init, - .instance_init = aspeed_ast1700_instance_init, +static const TypeInfo aspeed_ast1700_types[] = { + { + .name =TYPE_ASPEED_AST1700 , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedAST1700SoCState), + .class_init = aspeed_ast1700_class_init, + .instance_init = aspeed_ast1700_instance_init, + } }; -static void aspeed_ast1700_register_types (void ) -{ -type_register_static (&aspeed_ast1700_info); -} - -type_init (aspeed_ast1700_register_types); +DEFINE_TYPES (aspeed_ast1700_types)
Signature · 1 line
2.43.0
PATCH 13/24 hw/gpio/aspeed_sgpio: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 2 standalone TypeInfo variables (aspeed_sgpio_info and aspeed_sgpio_ast2700_info) directly into the 'aspeed_sgpio_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/gpio/aspeed_sgpio.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-)
hw/gpio/aspeed_sgpio.c +16 -21
@@ -321,26 +321,21 @@ static void aspeed_sgpio_2700_class_init(ObjectClass *klass, const void *data) agc->reg_ops = &aspeed_sgpio_2700_ops; } -static const TypeInfo aspeed_sgpio_info = { - .name =TYPE_ASPEED_SGPIO , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedSGPIOState), - .class_size =sizeof (AspeedSGPIOClass), - .class_init = aspeed_sgpio_class_init, - .abstract = true, -}; - -static const TypeInfo aspeed_sgpio_ast2700_info = { - .name =TYPE_ASPEED_SGPIO "-ast2700" , - .parent =TYPE_ASPEED_SGPIO , - .class_init = aspeed_sgpio_2700_class_init, - .instance_init = aspeed_sgpio_init, +static const TypeInfo aspeed_sgpio_types[] = { + { + .name =TYPE_ASPEED_SGPIO , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedSGPIOState), + .class_size =sizeof (AspeedSGPIOClass), + .class_init = aspeed_sgpio_class_init, + .abstract = true, + }, + { + .name =TYPE_ASPEED_SGPIO "-ast2700" , + .parent =TYPE_ASPEED_SGPIO , + .class_init = aspeed_sgpio_2700_class_init, + .instance_init = aspeed_sgpio_init, + } }; -static void aspeed_sgpio_register_types (void ) -{ -type_register_static (&aspeed_sgpio_info); -type_register_static (&aspeed_sgpio_ast2700_info); -} - -type_init (aspeed_sgpio_register_types); +DEFINE_TYPES (aspeed_sgpio_types)
Signature · 1 line
2.43.0
PATCH 9/24 hw/misc/aspeed_xdma: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 4 standalone TypeInfo variables (aspeed_xdma_info as abstract base, aspeed_2400_xdma_info, aspeed_2500_xdma_info, aspeed_2600_xdma_info) directly into the 'aspeed_xdma_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/misc/aspeed_xdma.c | 58 +++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 33 deletions(-)
hw/misc/aspeed_xdma.c +25 -33
@@ -167,12 +167,6 @@ static void aspeed_2600_xdma_class_init(ObjectClass *klass, const void *data)XDMA_AST2600_IRQ_STATUS_DS_COMP ; } -static const TypeInfo aspeed_2600_xdma_info = { - .name =TYPE_ASPEED_2600_XDMA , - .parent =TYPE_ASPEED_XDMA , - .class_init = aspeed_2600_xdma_class_init, -}; -static void aspeed_2500_xdma_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -189,12 +183,6 @@ static void aspeed_2500_xdma_class_init(ObjectClass *klass, const void *data) axc->intr_complete =XDMA_IRQ_ENG_STAT_US_COMP |XDMA_IRQ_ENG_STAT_DS_COMP ; }; -static const TypeInfo aspeed_2500_xdma_info = { - .name =TYPE_ASPEED_2500_XDMA , - .parent =TYPE_ASPEED_XDMA , - .class_init = aspeed_2500_xdma_class_init, -}; -static void aspeed_2400_xdma_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -211,12 +199,6 @@ static void aspeed_2400_xdma_class_init(ObjectClass *klass, const void *data) axc->intr_complete =XDMA_IRQ_ENG_STAT_US_COMP |XDMA_IRQ_ENG_STAT_DS_COMP ; }; -static const TypeInfo aspeed_2400_xdma_info = { - .name =TYPE_ASPEED_2400_XDMA , - .parent =TYPE_ASPEED_XDMA , - .class_init = aspeed_2400_xdma_class_init, -}; -static void aspeed_xdma_class_init (ObjectClass *classp,const void *data) {DeviceClass *dc =DEVICE_CLASS (classp);
@@ -227,20 +209,30 @@ static void aspeed_xdma_class_init(ObjectClass *classp, const void *data) dc->vmsd = &aspeed_xdma_vmstate; } -static const TypeInfo aspeed_xdma_info = { - .name =TYPE_ASPEED_XDMA , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedXDMAState), - .class_init = aspeed_xdma_class_init, - .class_size =sizeof (AspeedXDMAClass), - .abstract = true, +static const TypeInfo aspeed_xdma_types[] = { + { + .name =TYPE_ASPEED_XDMA , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedXDMAState), + .class_init = aspeed_xdma_class_init, + .class_size =sizeof (AspeedXDMAClass), + .abstract = true, + }, + { + .name =TYPE_ASPEED_2400_XDMA , + .parent =TYPE_ASPEED_XDMA , + .class_init = aspeed_2400_xdma_class_init, + }, + { + .name =TYPE_ASPEED_2500_XDMA , + .parent =TYPE_ASPEED_XDMA , + .class_init = aspeed_2500_xdma_class_init, + }, + { + .name =TYPE_ASPEED_2600_XDMA , + .parent =TYPE_ASPEED_XDMA , + .class_init = aspeed_2600_xdma_class_init, + } }; -static void aspeed_xdma_register_type (void ) -{ -type_register_static (&aspeed_xdma_info); -type_register_static (&aspeed_2400_xdma_info); -type_register_static (&aspeed_2500_xdma_info); -type_register_static (&aspeed_2600_xdma_info); -} -type_init (aspeed_xdma_register_type); +DEFINE_TYPES (aspeed_xdma_types)
Signature · 1 line
2.43.0
PATCH 18/24 hw/nvram/aspeed_otp: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline the standalone 'aspeed_otp_info' TypeInfo variable directly into the 'aspeed_otp_types[]' array, removing the need for a separate declaration.
No functional change.
--- hw/nvram/aspeed_otp.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
hw/nvram/aspeed_otp.c +8 -11
@@ -174,16 +174,13 @@ static void aspeed_otp_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_otp_properties); } -static const TypeInfo aspeed_otp_info = { - .name =TYPE_ASPEED_OTP , - .parent =TYPE_DEVICE , - .instance_size =sizeof (AspeedOTPState), - .class_init = aspeed_otp_class_init, +static const TypeInfo aspeed_otp_types[] = { + { + .name =TYPE_ASPEED_OTP , + .parent =TYPE_DEVICE , + .instance_size =sizeof (AspeedOTPState), + .class_init = aspeed_otp_class_init, + } }; -static void aspeed_otp_register_types (void ) -{ -type_register_static (&aspeed_otp_info); -} - -type_init (aspeed_otp_register_types) +DEFINE_TYPES (aspeed_otp_types)
Signature · 1 line
2.43.0
PATCH 19/24 hw/timer/aspeed_timer: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 6 standalone TypeInfo variables (aspeed_timer_info as abstract base, aspeed_2400_timer_info, aspeed_2500_timer_info, aspeed_2600_timer_info, aspeed_1030_timer_info, aspeed_2700_timer_info) directly into the 'aspeed_timer_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/timer/aspeed_timer.c | 83 +++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 48 deletions(-)
hw/timer/aspeed_timer.c +35 -48
@@ -907,15 +907,6 @@ static void timer_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_timer_properties); } -static const TypeInfo aspeed_timer_info = { - .name =TYPE_ASPEED_TIMER , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedTimerCtrlState), - .class_init = timer_class_init, - .class_size =sizeof (AspeedTimerClass), - .abstract = true, -}; -static void aspeed_2400_timer_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -926,12 +917,6 @@ static void aspeed_2400_timer_class_init(ObjectClass *klass, const void *data) awc->write = aspeed_2400_timer_write; } -static const TypeInfo aspeed_2400_timer_info = { - .name =TYPE_ASPEED_2400_TIMER , - .parent =TYPE_ASPEED_TIMER , - .class_init = aspeed_2400_timer_class_init, -}; -static void aspeed_2500_timer_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -942,12 +927,6 @@ static void aspeed_2500_timer_class_init(ObjectClass *klass, const void *data) awc->write = aspeed_2500_timer_write; } -static const TypeInfo aspeed_2500_timer_info = { - .name =TYPE_ASPEED_2500_TIMER , - .parent =TYPE_ASPEED_TIMER , - .class_init = aspeed_2500_timer_class_init, -}; -static void aspeed_2600_timer_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -958,12 +937,6 @@ static void aspeed_2600_timer_class_init(ObjectClass *klass, const void *data) awc->write = aspeed_2600_timer_write; } -static const TypeInfo aspeed_2600_timer_info = { - .name =TYPE_ASPEED_2600_TIMER , - .parent =TYPE_ASPEED_TIMER , - .class_init = aspeed_2600_timer_class_init, -}; -static void aspeed_1030_timer_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -974,12 +947,6 @@ static void aspeed_1030_timer_class_init(ObjectClass *klass, const void *data) awc->write = aspeed_2600_timer_write; } -static const TypeInfo aspeed_1030_timer_info = { - .name =TYPE_ASPEED_1030_TIMER , - .parent =TYPE_ASPEED_TIMER , - .class_init = aspeed_1030_timer_class_init, -}; -static void aspeed_2700_timer_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -990,20 +957,40 @@ static void aspeed_2700_timer_class_init(ObjectClass *klass, const void *data) awc->write = aspeed_2700_timer_write; } -static const TypeInfo aspeed_2700_timer_info = { - .name =TYPE_ASPEED_2700_TIMER , - .parent =TYPE_ASPEED_TIMER , - .class_init = aspeed_2700_timer_class_init, +static const TypeInfo aspeed_timer_types[] = { + { + .name =TYPE_ASPEED_TIMER , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedTimerCtrlState), + .class_init = timer_class_init, + .class_size =sizeof (AspeedTimerClass), + .abstract = true, + }, + { + .name =TYPE_ASPEED_1030_TIMER , + .parent =TYPE_ASPEED_TIMER , + .class_init = aspeed_1030_timer_class_init, + }, + { + .name =TYPE_ASPEED_2400_TIMER , + .parent =TYPE_ASPEED_TIMER , + .class_init = aspeed_2400_timer_class_init, + }, + { + .name =TYPE_ASPEED_2500_TIMER , + .parent =TYPE_ASPEED_TIMER , + .class_init = aspeed_2500_timer_class_init, + }, + { + .name =TYPE_ASPEED_2600_TIMER , + .parent =TYPE_ASPEED_TIMER , + .class_init = aspeed_2600_timer_class_init, + }, + { + .name =TYPE_ASPEED_2700_TIMER , + .parent =TYPE_ASPEED_TIMER , + .class_init = aspeed_2700_timer_class_init, + } }; -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_register_static (&aspeed_1030_timer_info); -type_register_static (&aspeed_2700_timer_info); -} - -type_init (aspeed_timer_register_types) +DEFINE_TYPES (aspeed_timer_types)
Signature · 1 line
2.43.0
PATCH 21/24 hw/pci-host/aspeed_pcie: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 6 standalone TypeInfo variables (aspeed_pcie_phy_info, aspeed_2700_pcie_phy_info aspeed_pcie_root_port_info, aspeed_pcie_rc_info, aspeed_pcie_cfg_info and aspeed_2700_pcie_cfg_info directly into the 'aspeed_pcie_types[]'
array, removing the need for separate declarations.
No functional change.
--- hw/pci-host/aspeed_pcie.c | 94 +++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 53 deletions(-)
hw/pci-host/aspeed_pcie.c +41 -53
@@ -83,13 +83,6 @@ static void aspeed_pcie_root_port_class_init(ObjectClass *klass, rpc->ssid =0x1150 ; } -static const TypeInfo aspeed_pcie_root_port_info = { - .name =TYPE_ASPEED_PCIE_ROOT_PORT , - .parent =TYPE_PCIE_ROOT_PORT , - .instance_size =sizeof (AspeedPCIERootPortState), - .class_init = aspeed_pcie_root_port_class_init, -}; -/* * PCIe Root Complex (RC) */
@@ -305,14 +298,6 @@ static void aspeed_pcie_rc_class_init(ObjectClass *klass, const void *data) msi_nonbroken = true; } -static const TypeInfo aspeed_pcie_rc_info = { - .name =TYPE_ASPEED_PCIE_RC , - .parent =TYPE_PCIE_HOST_BRIDGE , - .instance_size =sizeof (AspeedPCIERcState), - .instance_init = aspeed_pcie_rc_instance_init, - .class_init = aspeed_pcie_rc_class_init, -}; -/* * PCIe Config *
@@ -679,15 +664,6 @@ static void aspeed_pcie_cfg_class_init(ObjectClass *klass, const void *data) apc->rc_rp_addr =PCI_DEVFN (8 ,0 ); } -static const TypeInfo aspeed_pcie_cfg_info = { - .name =TYPE_ASPEED_PCIE_CFG , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_init = aspeed_pcie_cfg_instance_init, - .instance_size =sizeof (AspeedPCIECfgState), - .class_init = aspeed_pcie_cfg_class_init, - .class_size =sizeof (AspeedPCIECfgClass), -}; -static void aspeed_2700_pcie_cfg_write (void *opaque,hwaddr addr,uint64_t data,unsigned int size) {
@@ -798,12 +774,6 @@ static void aspeed_2700_pcie_cfg_class_init(ObjectClass *klass, apc->rc_rp_addr =PCI_DEVFN (0 ,0 ); } -static const TypeInfo aspeed_2700_pcie_cfg_info = { - .name =TYPE_ASPEED_2700_PCIE_CFG , - .parent =TYPE_ASPEED_PCIE_CFG , - .class_init = aspeed_2700_pcie_cfg_class_init, -}; -/* * PCIe PHY *
@@ -926,14 +896,6 @@ static void aspeed_pcie_phy_class_init(ObjectClass *klass, const void *data) apc->nr_regs =0x100 >>2 ; } -static const TypeInfo aspeed_pcie_phy_info = { - .name =TYPE_ASPEED_PCIE_PHY , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedPCIEPhyState), - .class_init = aspeed_pcie_phy_class_init, - .class_size =sizeof (AspeedPCIEPhyClass), -}; -static void aspeed_2700_pcie_phy_reset_hold (Object *obj,ResetType type) {AspeedPCIEPhyState *s =ASPEED_PCIE_PHY (obj);
@@ -961,21 +923,47 @@ static void aspeed_2700_pcie_phy_class_init(ObjectClass *klass, apc->nr_regs =0x800 >>2 ; } -static const TypeInfo aspeed_2700_pcie_phy_info = { - .name =TYPE_ASPEED_2700_PCIE_PHY , - .parent =TYPE_ASPEED_PCIE_PHY , - .class_init = aspeed_2700_pcie_phy_class_init, -}; +static const TypeInfo aspeed_pcie_types[] = { + { + .name =TYPE_ASPEED_PCIE_RC , + .parent =TYPE_PCIE_HOST_BRIDGE , + .instance_size =sizeof (AspeedPCIERcState), + .instance_init = aspeed_pcie_rc_instance_init, + .class_init = aspeed_pcie_rc_class_init, + }, + { + .name =TYPE_ASPEED_PCIE_ROOT_PORT , + .parent =TYPE_PCIE_ROOT_PORT , + .instance_size =sizeof (AspeedPCIERootPortState), + .class_init = aspeed_pcie_root_port_class_init, + }, + { + .name =TYPE_ASPEED_PCIE_CFG , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = aspeed_pcie_cfg_instance_init, + .instance_size =sizeof (AspeedPCIECfgState), + .class_init = aspeed_pcie_cfg_class_init, + .class_size =sizeof (AspeedPCIECfgClass), + }, + { + .name =TYPE_ASPEED_PCIE_PHY , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedPCIEPhyState), + .class_init = aspeed_pcie_phy_class_init, + .class_size =sizeof (AspeedPCIEPhyClass), + }, + { + .name =TYPE_ASPEED_2700_PCIE_PHY , + .parent =TYPE_ASPEED_PCIE_PHY , + .class_init = aspeed_2700_pcie_phy_class_init, + }, + { + .name =TYPE_ASPEED_2700_PCIE_CFG , + .parent =TYPE_ASPEED_PCIE_CFG , + .class_init = aspeed_2700_pcie_cfg_class_init, + } -static void aspeed_pcie_register_types (void ) -{ -type_register_static (&aspeed_pcie_rc_info); -type_register_static (&aspeed_pcie_root_port_info); -type_register_static (&aspeed_pcie_cfg_info); -type_register_static (&aspeed_2700_pcie_cfg_info); -type_register_static (&aspeed_pcie_phy_info); -type_register_static (&aspeed_2700_pcie_phy_info); -} +}; -type_init (aspeed_pcie_register_types); +DEFINE_TYPES (aspeed_pcie_types)
Signature · 1 line
2.43.0
PATCH 15/24 hw/intc/aspeed_vic: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline the standalone 'aspeed_vic_info' TypeInfo variable directly into the 'aspeed_vic_types[]' array, removing the need for a separate declaration.
No functional change.
--- hw/intc/aspeed_vic.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
hw/intc/aspeed_vic.c +8 -11
@@ -349,16 +349,13 @@ static void aspeed_vic_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_aspeed_vic; } -static const TypeInfo aspeed_vic_info = { - .name =TYPE_ASPEED_VIC , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedVICState), - .class_init = aspeed_vic_class_init, +static const TypeInfo aspeed_vic_types[] = { + { + .name =TYPE_ASPEED_VIC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedVICState), + .class_init = aspeed_vic_class_init, + } }; -static void aspeed_vic_register_types (void ) -{ -type_register_static (&aspeed_vic_info); -} - -type_init (aspeed_vic_register_types); +DEFINE_TYPES (aspeed_vic_types)
Signature · 1 line
2.43.0
PATCH 1/24 hw/misc/aspeed_hace: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 6 standalone TypeInfo variables (aspeed_hace_info as abstract base, aspeed_2400_hace_info, aspeed_2500_hace_info, aspeed_2600_hace_info, aspeed_1030_hace_info, aspeed_2700_hace_info) directly into the 'aspeed_hace_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/misc/aspeed_hace.c | 81 ++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 47 deletions(-)
hw/misc/aspeed_hace.c +34 -47
@@ -696,14 +696,6 @@ static void aspeed_hace_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_aspeed_hace; } -static const TypeInfo aspeed_hace_info = { - .name =TYPE_ASPEED_HACE , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedHACEState), - .class_init = aspeed_hace_class_init, - .class_size =sizeof (AspeedHACEClass) -}; -static void aspeed_ast2400_hace_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -718,12 +710,6 @@ static void aspeed_ast2400_hace_class_init(ObjectClass *klass, const void *data) ahc->hash_mask =0x000003ff ;/* No SG or SHA512 modes */ } -static const TypeInfo aspeed_ast2400_hace_info = { - .name =TYPE_ASPEED_AST2400_HACE , - .parent =TYPE_ASPEED_HACE , - .class_init = aspeed_ast2400_hace_class_init, -}; -static void aspeed_ast2500_hace_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -738,12 +724,6 @@ static void aspeed_ast2500_hace_class_init(ObjectClass *klass, const void *data) ahc->hash_mask =0x000003ff ;/* No SG or SHA512 modes */ } -static const TypeInfo aspeed_ast2500_hace_info = { - .name =TYPE_ASPEED_AST2500_HACE , - .parent =TYPE_ASPEED_HACE , - .class_init = aspeed_ast2500_hace_class_init, -}; -static void aspeed_ast2600_hace_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -758,12 +738,6 @@ static void aspeed_ast2600_hace_class_init(ObjectClass *klass, const void *data) ahc->hash_mask =0x00147FFF ; } -static const TypeInfo aspeed_ast2600_hace_info = { - .name =TYPE_ASPEED_AST2600_HACE , - .parent =TYPE_ASPEED_HACE , - .class_init = aspeed_ast2600_hace_class_init, -}; -static void aspeed_ast1030_hace_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -778,12 +752,6 @@ static void aspeed_ast1030_hace_class_init(ObjectClass *klass, const void *data) ahc->hash_mask =0x00147FFF ; } -static const TypeInfo aspeed_ast1030_hace_info = { - .name =TYPE_ASPEED_AST1030_HACE , - .parent =TYPE_ASPEED_HACE , - .class_init = aspeed_ast1030_hace_class_init, -}; -static void aspeed_ast2700_hace_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
@@ -823,20 +791,39 @@ static void aspeed_ast2700_hace_class_init(ObjectClass *klass, const void *data) ahc->has_dma64 = true; } -static const TypeInfo aspeed_ast2700_hace_info = { - .name =TYPE_ASPEED_AST2700_HACE , - .parent =TYPE_ASPEED_HACE , - .class_init = aspeed_ast2700_hace_class_init, +static const TypeInfo aspeed_hace_types[] = { + { + .name =TYPE_ASPEED_HACE , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedHACEState), + .class_init = aspeed_hace_class_init, + .class_size =sizeof (AspeedHACEClass), + }, + { + .name =TYPE_ASPEED_AST1030_HACE , + .parent =TYPE_ASPEED_HACE , + .class_init = aspeed_ast1030_hace_class_init, + }, + { + .name =TYPE_ASPEED_AST2400_HACE , + .parent =TYPE_ASPEED_HACE , + .class_init = aspeed_ast2400_hace_class_init, + }, + { + .name =TYPE_ASPEED_AST2500_HACE , + .parent =TYPE_ASPEED_HACE , + .class_init = aspeed_ast2500_hace_class_init, + }, + { + .name =TYPE_ASPEED_AST2600_HACE , + .parent =TYPE_ASPEED_HACE , + .class_init = aspeed_ast2600_hace_class_init, + }, + { + .name =TYPE_ASPEED_AST2700_HACE , + .parent =TYPE_ASPEED_HACE , + .class_init = aspeed_ast2700_hace_class_init, + } }; -static void aspeed_hace_register_types (void ) -{ -type_register_static (&aspeed_ast2400_hace_info); -type_register_static (&aspeed_ast2500_hace_info); -type_register_static (&aspeed_ast2600_hace_info); -type_register_static (&aspeed_ast1030_hace_info); -type_register_static (&aspeed_ast2700_hace_info); -type_register_static (&aspeed_hace_info); -} - -type_init (aspeed_hace_register_types); +DEFINE_TYPES (aspeed_hace_types)
Signature · 1 line
2.43.0
PATCH 24/24 hw/ssi/aspeed_smc: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 18 standalone TypeInfo variables (aspeed_smc_flash_info, aspeed_smc_info as abstract base, aspeed_2400_smc_info, aspeed_2400_fmc_info, aspeed_2400_spi1_info, aspeed_2500_fmc_info, aspeed_2500_spi1_info, aspeed_2500_spi2_info, aspeed_2600_fmc_info, aspeed_2600_spi1_info, aspeed_2600_spi2_info, aspeed_1030_fmc_info, aspeed_1030_spi1_info, aspeed_1030_spi2_info, aspeed_2700_fmc_info, aspeed_2700_spi0_info, aspeed_2700_spi1_info, aspeed_2700_spi2_info) directly into the 'aspeed_smc_types[]' array, removing the need for separate declarations.
--- hw/ssi/aspeed_smc.c | 228 +++++++++++++++++++------------------------- 1 file changed, 96 insertions(+), 132 deletions(-)
hw/ssi/aspeed_smc.c +96 -132
@@ -1312,16 +1312,6 @@ static void aspeed_smc_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_aspeed_smc; } -static const TypeInfo aspeed_smc_info = { - .name =TYPE_ASPEED_SMC , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_init = aspeed_smc_instance_init, - .instance_size =sizeof (AspeedSMCState), - .class_size =sizeof (AspeedSMCClass), - .class_init = aspeed_smc_class_init, - .abstract = true, -}; -static void aspeed_smc_flash_realize (DeviceState *dev,Error **errp) {AspeedSMCFlash *s =ASPEED_SMC_FLASH (dev);
@@ -1358,13 +1348,6 @@ static void aspeed_smc_flash_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_smc_flash_properties); } -static const TypeInfo aspeed_smc_flash_info = { - .name =TYPE_ASPEED_SMC_FLASH , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedSMCFlash), - .class_init = aspeed_smc_flash_class_init, -}; -/* * The Segment Registers of the AST2400 and AST2500 have a 8MB * unit. The address range of a flash SPI peripheral is encoded with
@@ -1415,12 +1398,6 @@ static void aspeed_2400_smc_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2400_smc_info = { - .name ="aspeed.smc-ast2400" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2400_smc_class_init, -}; -static const uint32_t aspeed_2400_fmc_resets[ASPEED_SMC_R_MAX ] = {/* * CE0 and CE1 types are HW strapped in SCU70. Do it here to
@@ -1466,12 +1443,6 @@ static void aspeed_2400_fmc_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2400_fmc_info = { - .name ="aspeed.fmc-ast2400" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2400_fmc_class_init, -}; -static const AspeedSegments aspeed_2400_spi1_segments[] = { {0x30000000 ,64 * MiB }, };
@@ -1506,12 +1477,6 @@ static void aspeed_2400_spi1_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2400_spi1_info = { - .name ="aspeed.spi1-ast2400" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2400_spi1_class_init, -}; -static const uint32_t aspeed_2500_fmc_resets[ASPEED_SMC_R_MAX ] = { [R_CONF ] = (CONF_FLASH_TYPE_SPI <<CONF_FLASH_TYPE0 |CONF_FLASH_TYPE_SPI <<CONF_FLASH_TYPE1 ),
@@ -1552,12 +1517,6 @@ static void aspeed_2500_fmc_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2500_fmc_info = { - .name ="aspeed.fmc-ast2500" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2500_fmc_class_init, -}; -static const AspeedSegments aspeed_2500_spi1_segments[] = { {0x30000000 ,32 * MiB },/* start address is readonly */ {0x32000000 ,96 * MiB },/* end address is readonly */
@@ -1588,12 +1547,6 @@ static void aspeed_2500_spi1_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2500_spi1_info = { - .name ="aspeed.spi1-ast2500" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2500_spi1_class_init, -}; -static const AspeedSegments aspeed_2500_spi2_segments[] = { {0x38000000 ,32 * MiB },/* start address is readonly */ {0x3A000000 ,96 * MiB },/* end address is readonly */
@@ -1624,12 +1577,6 @@ static void aspeed_2500_spi2_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2500_spi2_info = { - .name ="aspeed.spi2-ast2500" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2500_spi2_class_init, -}; -/* * The Segment Registers of the AST2600 have a 1MB unit. The address * range of a flash SPI peripheral is encoded with offsets in the overall
@@ -1712,12 +1659,6 @@ static void aspeed_2600_fmc_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2600_fmc_info = { - .name ="aspeed.fmc-ast2600" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2600_fmc_class_init, -}; -static const AspeedSegments aspeed_2600_spi1_segments[] = { {0x0 ,128 * MiB },/* start address is readonly */ {0x0 ,0 },/* disabled */
@@ -1752,12 +1693,6 @@ static void aspeed_2600_spi1_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2600_spi1_info = { - .name ="aspeed.spi1-ast2600" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2600_spi1_class_init, -}; -static const AspeedSegments aspeed_2600_spi2_segments[] = { {0x0 ,128 * MiB },/* start address is readonly */ {0x0 ,0 },/* disabled */
@@ -1793,12 +1728,6 @@ static void aspeed_2600_spi2_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_2600_spi2_info = { - .name ="aspeed.spi2-ast2600" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2600_spi2_class_init, -}; -/* * The FMC Segment Registers of the AST1030 have a 512KB unit. * Only bits [27:19] are used for decoding.
@@ -1877,12 +1806,6 @@ static void aspeed_1030_fmc_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_1030_fmc_info = { - .name ="aspeed.fmc-ast1030" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_1030_fmc_class_init, -}; -static const AspeedSegments aspeed_1030_spi1_segments[] = { {0x0 ,128 * MiB },/* start address is readonly */ {0x0 ,0 },/* disabled */
@@ -1916,11 +1839,6 @@ static void aspeed_1030_spi1_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_1030_spi1_info = { - .name ="aspeed.spi1-ast1030" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_1030_spi1_class_init, -};static const AspeedSegments aspeed_1030_spi2_segments[] = { {0x0 ,128 * MiB },/* start address is readonly */ {0x0 ,0 },/* disabled */
@@ -1954,12 +1872,6 @@ static void aspeed_1030_spi2_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_smc_flash_ops; } -static const TypeInfo aspeed_1030_spi2_info = { - .name ="aspeed.spi2-ast1030" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_1030_spi2_class_init, -}; -/* * The FMC Segment Registers of the AST2700 have a 64KB unit. * Only bits [31:16] are used for decoding.
@@ -2061,12 +1973,6 @@ static void aspeed_2700_fmc_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_2700_smc_flash_ops; } -static const TypeInfo aspeed_2700_fmc_info = { - .name ="aspeed.fmc-ast2700" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2700_fmc_class_init, -}; -static const AspeedSegments aspeed_2700_spi0_segments[] = { {0x0 ,128 * MiB },/* start address is readonly */ {128 * MiB,128 * MiB },/* start address is readonly */
@@ -2102,12 +2008,6 @@ static void aspeed_2700_spi0_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_2700_smc_flash_ops; } -static const TypeInfo aspeed_2700_spi0_info = { - .name ="aspeed.spi0-ast2700" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2700_spi0_class_init, -}; -static const AspeedSegments aspeed_2700_spi1_segments[] = { {0x0 ,128 * MiB },/* start address is readonly */ {0x0 ,0 },/* disabled */
@@ -2142,12 +2042,6 @@ static void aspeed_2700_spi1_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_2700_smc_flash_ops; } -static const TypeInfo aspeed_2700_spi1_info = { - .name ="aspeed.spi1-ast2700" , - .parent =TYPE_ASPEED_SMC , - .class_init = aspeed_2700_spi1_class_init, -}; -static const AspeedSegments aspeed_2700_spi2_segments[] = { {0x0 ,128 * MiB },/* start address is readonly */ {0x0 ,0 },/* disabled */
@@ -2182,32 +2076,102 @@ static void aspeed_2700_spi2_class_init(ObjectClass *klass, const void *data) asc->reg_ops = &aspeed_2700_smc_flash_ops; } -static const TypeInfo aspeed_2700_spi2_info = { - .name ="aspeed.spi2-ast2700" , - .parent =TYPE_ASPEED_SMC , +static const TypeInfo aspeed_smc_types[] = { + { + .name =TYPE_ASPEED_SMC_FLASH , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedSMCFlash), + .class_init = aspeed_smc_flash_class_init, + }, + { + .name =TYPE_ASPEED_SMC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = aspeed_smc_instance_init, + .instance_size =sizeof (AspeedSMCState), + .class_size =sizeof (AspeedSMCClass), + .class_init = aspeed_smc_class_init, + .abstract = true, + }, + { + .name ="aspeed.fmc-ast1030" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_1030_fmc_class_init, + }, + { + .name ="aspeed.spi1-ast1030" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_1030_spi1_class_init, + }, + { + .name ="aspeed.spi2-ast1030" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_1030_spi2_class_init, + }, + { + .name ="aspeed.smc-ast2400" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2400_smc_class_init, + }, + { + .name ="aspeed.fmc-ast2400" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2400_fmc_class_init, + }, + { + .name ="aspeed.spi1-ast2400" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2400_spi1_class_init, + }, + { + .name ="aspeed.fmc-ast2500" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2500_fmc_class_init, + }, + { + .name ="aspeed.spi1-ast2500" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2500_spi1_class_init, + }, + { + .name ="aspeed.spi2-ast2500" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2500_spi2_class_init, + }, + { + .name ="aspeed.fmc-ast2600" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2600_fmc_class_init, + }, + { + .name ="aspeed.spi1-ast2600" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2600_spi1_class_init, + }, + { + .name ="aspeed.spi2-ast2600" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2600_spi2_class_init, + }, + { + .name ="aspeed.fmc-ast2700" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2700_fmc_class_init, + }, + { + .name ="aspeed.spi0-ast2700" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2700_spi0_class_init, + }, + { + .name ="aspeed.spi1-ast2700" , + .parent =TYPE_ASPEED_SMC , + .class_init = aspeed_2700_spi1_class_init, + }, + { + .name ="aspeed.spi2-ast2700" , + .parent =TYPE_ASPEED_SMC , .class_init = aspeed_2700_spi2_class_init, + } }; -static void aspeed_smc_register_types (void ) -{ -type_register_static (&aspeed_smc_flash_info); -type_register_static (&aspeed_smc_info); -type_register_static (&aspeed_2400_smc_info); -type_register_static (&aspeed_2400_fmc_info); -type_register_static (&aspeed_2400_spi1_info); -type_register_static (&aspeed_2500_fmc_info); -type_register_static (&aspeed_2500_spi1_info); -type_register_static (&aspeed_2500_spi2_info); -type_register_static (&aspeed_2600_fmc_info); -type_register_static (&aspeed_2600_spi1_info); -type_register_static (&aspeed_2600_spi2_info); -type_register_static (&aspeed_1030_fmc_info); -type_register_static (&aspeed_1030_spi1_info); -type_register_static (&aspeed_1030_spi2_info); -type_register_static (&aspeed_2700_fmc_info); -type_register_static (&aspeed_2700_spi0_info); -type_register_static (&aspeed_2700_spi1_info); -type_register_static (&aspeed_2700_spi2_info); -} - -type_init (aspeed_smc_register_types) +DEFINE_TYPES (aspeed_smc_types)
Signature · 1 line
2.43.0
PATCH 20/24 hw/fsi/aspeed_apb2opb: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
This file contains two independent subsystems (aspeed_apb2opb and fsi_opb), each with its own type_init() call. Both are converted to separate DEFINE_TYPES() blocks to preserve the original registration boundary.
Inline the standalone 'aspeed_apb2opb_info' and 'fsi_opb_info' TypeInfo variables directly into their respective types arrays, removing the need for separate declarations.
No functional change.
--- hw/fsi/aspeed_apb2opb.c | 42 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 24 deletions(-)
hw/fsi/aspeed_apb2opb.c +18 -24
@@ -319,20 +319,17 @@ static void fsi_aspeed_apb2opb_class_init(ObjectClass *klass, const void *data) rc->phases.hold = fsi_aspeed_apb2opb_reset_hold; } -static const TypeInfo aspeed_apb2opb_info = { - .name =TYPE_ASPEED_APB2OPB , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_init = fsi_aspeed_apb2opb_init, - .instance_size =sizeof (AspeedAPB2OPBState), - .class_init = fsi_aspeed_apb2opb_class_init, +static const TypeInfo aspeed_apb2opb_types[] = { + { + .name =TYPE_ASPEED_APB2OPB , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = fsi_aspeed_apb2opb_init, + .instance_size =sizeof (AspeedAPB2OPBState), + .class_init = fsi_aspeed_apb2opb_class_init, + } }; -static void aspeed_apb2opb_register_types (void ) -{ -type_register_static (&aspeed_apb2opb_info); -} - -type_init (aspeed_apb2opb_register_types); +DEFINE_TYPES (aspeed_apb2opb_types) static void fsi_opb_init(Object *o) {
@@ -363,17 +360,14 @@ static void fsi_opb_class_init(ObjectClass *klass, const void *data) bc->unrealize = fsi_opb_unrealize; } -static const TypeInfo opb_info = { - .name =TYPE_OP_BUS , - .parent =TYPE_BUS , - .instance_init = fsi_opb_init, - .instance_size =sizeof (OPBus), - .class_init = fsi_opb_class_init, +static const TypeInfo fsi_opb_types[] = { + { + .name =TYPE_OP_BUS , + .parent =TYPE_BUS , + .instance_init = fsi_opb_init, + .instance_size =sizeof (OPBus), + .class_init = fsi_opb_class_init, + } }; -static void fsi_opb_register_types (void ) -{ -type_register_static (&opb_info); -} - -type_init (fsi_opb_register_types); +DEFINE_TYPES (fsi_opb_types)
Signature · 1 line
2.43.0
PATCH 10/24 hw/adc/aspeed_adc: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 7 standalone TypeInfo variables (aspeed_adc_engine_info, aspeed_adc_info as abstract base, aspeed_2400_adc_info, aspeed_2500_adc_info, aspeed_2600_adc_info, aspeed_1030_adc_info, aspeed_2700_adc_info) directly into the 'aspeed_adc_types[]' array, removing the need for separate declarations. Note that aspeed_2400 and aspeed_2500 variants carry only .name and .parent with no class_init.
No functional change.
--- hw/adc/aspeed_adc.c | 95 +++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 55 deletions(-)
hw/adc/aspeed_adc.c +40 -55
@@ -304,13 +304,6 @@ static void aspeed_adc_engine_class_init(ObjectClass *klass, const void *data) dc->vmsd = &vmstate_aspeed_adc_engine; } -static const TypeInfo aspeed_adc_engine_info = { - .name =TYPE_ASPEED_ADC_ENGINE , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedADCEngineState), - .class_init = aspeed_adc_engine_class_init, -}; -static void aspeed_adc_instance_init (Object *obj) {AspeedADCState *s =ASPEED_ADC (obj);
@@ -408,53 +401,45 @@ static void aspeed_2700_adc_class_init(ObjectClass *klass, const void *data) aac->nr_engines =2 ; } -static const TypeInfo aspeed_adc_info = { - .name =TYPE_ASPEED_ADC , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_init = aspeed_adc_instance_init, - .instance_size =sizeof (AspeedADCState), - .class_init = aspeed_adc_class_init, - .class_size =sizeof (AspeedADCClass), - .abstract = true, -}; - -static const TypeInfo aspeed_2400_adc_info = { - .name =TYPE_ASPEED_2400_ADC , - .parent =TYPE_ASPEED_ADC , -}; - -static const TypeInfo aspeed_2500_adc_info = { - .name =TYPE_ASPEED_2500_ADC , - .parent =TYPE_ASPEED_ADC , -}; - -static const TypeInfo aspeed_2600_adc_info = { - .name =TYPE_ASPEED_2600_ADC , - .parent =TYPE_ASPEED_ADC , - .class_init = aspeed_2600_adc_class_init, -}; - -static const TypeInfo aspeed_1030_adc_info = { - .name =TYPE_ASPEED_1030_ADC , - .parent =TYPE_ASPEED_ADC , - .class_init = aspeed_1030_adc_class_init,/* No change since AST2600 */ -}; - -static const TypeInfo aspeed_2700_adc_info = { - .name =TYPE_ASPEED_2700_ADC , - .parent =TYPE_ASPEED_ADC , - .class_init = aspeed_2700_adc_class_init, +static const TypeInfo aspeed_adc_types[] = { + { + .name =TYPE_ASPEED_ADC_ENGINE , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedADCEngineState), + .class_init = aspeed_adc_engine_class_init, + }, + { + .name =TYPE_ASPEED_ADC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = aspeed_adc_instance_init, + .instance_size =sizeof (AspeedADCState), + .class_init = aspeed_adc_class_init, + .class_size =sizeof (AspeedADCClass), + .abstract = true, + }, + { + .name =TYPE_ASPEED_1030_ADC , + .parent =TYPE_ASPEED_ADC , + .class_init = aspeed_1030_adc_class_init,/* No change since AST2600 */ + }, + { + .name =TYPE_ASPEED_2400_ADC , + .parent =TYPE_ASPEED_ADC , + }, + { + .name =TYPE_ASPEED_2500_ADC , + .parent =TYPE_ASPEED_ADC , + }, + { + .name =TYPE_ASPEED_2600_ADC , + .parent =TYPE_ASPEED_ADC , + .class_init = aspeed_2600_adc_class_init, + }, + { + .name =TYPE_ASPEED_2700_ADC , + .parent =TYPE_ASPEED_ADC , + .class_init = aspeed_2700_adc_class_init, + } }; -static void aspeed_adc_register_types (void ) -{ -type_register_static (&aspeed_adc_engine_info); -type_register_static (&aspeed_adc_info); -type_register_static (&aspeed_2400_adc_info); -type_register_static (&aspeed_2500_adc_info); -type_register_static (&aspeed_2600_adc_info); -type_register_static (&aspeed_1030_adc_info); -type_register_static (&aspeed_2700_adc_info); -} - -type_init (aspeed_adc_register_types); +DEFINE_TYPES (aspeed_adc_types)
Signature · 1 line
2.43.0
PATCH 2/24 hw/misc/aspeed_lpc: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline the standalone 'aspeed_lpc_info' TypeInfo variable directly into the 'aspeed_lpc_types[]' array, removing the need for a separate declaration.
No functional change.
--- hw/misc/aspeed_lpc.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
hw/misc/aspeed_lpc.c +9 -12
@@ -470,17 +470,14 @@ static void aspeed_lpc_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_lpc_properties); } -static const TypeInfo aspeed_lpc_info = { - .name =TYPE_ASPEED_LPC , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedLPCState), - .class_init = aspeed_lpc_class_init, - .instance_init = aspeed_lpc_init, +static const TypeInfo aspeed_lpc_types[] = { + { + .name =TYPE_ASPEED_LPC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedLPCState), + .class_init = aspeed_lpc_class_init, + .instance_init = aspeed_lpc_init, + } }; -static void aspeed_lpc_register_types (void ) -{ -type_register_static (&aspeed_lpc_info); -} - -type_init (aspeed_lpc_register_types); +DEFINE_TYPES (aspeed_lpc_types)
Signature · 1 line
2.43.0
PATCH 7/24 hw/misc/aspeed_sdmc: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 5 standalone TypeInfo variables (aspeed_sdmc_info as abstract base, aspeed_2400_sdmc_info, aspeed_2500_sdmc_info, aspeed_2600_sdmc_info, aspeed_2700_sdmc_info) directly into the 'aspeed_sdmc_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/misc/aspeed_sdmc.c | 73 ++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 42 deletions(-)
hw/misc/aspeed_sdmc.c +31 -42
@@ -310,16 +310,6 @@ static void aspeed_sdmc_class_init(ObjectClass *klass, const void *data)device_class_set_props (dc, aspeed_sdmc_properties); } -static const TypeInfo aspeed_sdmc_info = { - .name =TYPE_ASPEED_SDMC , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedSDMCState), - .instance_init = aspeed_sdmc_initfn, - .class_init = aspeed_sdmc_class_init, - .class_size =sizeof (AspeedSDMCClass), - .abstract = true, -}; -static int aspeed_sdmc_get_ram_bits (AspeedSDMCState *s) {AspeedSDMCClass *asc =ASPEED_SDMC_GET_CLASS (s);
@@ -393,12 +383,6 @@ static void aspeed_2400_sdmc_class_init(ObjectClass *klass, const void *data) asc->valid_ram_sizes = aspeed_2400_ram_sizes; } -static const TypeInfo aspeed_2400_sdmc_info = { - .name =TYPE_ASPEED_2400_SDMC , - .parent =TYPE_ASPEED_SDMC , - .class_init = aspeed_2400_sdmc_class_init, -}; -static uint32_t aspeed_2500_sdmc_compute_conf (AspeedSDMCState *s,uint32_t data) { uint32_t fixed_conf = ASPEED_SDMC_HW_VERSION(1) |
@@ -461,12 +445,6 @@ static void aspeed_2500_sdmc_class_init(ObjectClass *klass, const void *data) asc->valid_ram_sizes = aspeed_2500_ram_sizes; } -static const TypeInfo aspeed_2500_sdmc_info = { - .name =TYPE_ASPEED_2500_SDMC , - .parent =TYPE_ASPEED_SDMC , - .class_init = aspeed_2500_sdmc_class_init, -}; -static uint32_t aspeed_2600_sdmc_compute_conf (AspeedSDMCState *s,uint32_t data) { uint32_t fixed_conf = ASPEED_SDMC_HW_VERSION(3) |
@@ -555,12 +533,6 @@ static void aspeed_2600_sdmc_class_init(ObjectClass *klass, const void *data) asc->valid_ram_sizes = aspeed_2600_ram_sizes; } -static const TypeInfo aspeed_2600_sdmc_info = { - .name =TYPE_ASPEED_2600_SDMC , - .parent =TYPE_ASPEED_SDMC , - .class_init = aspeed_2600_sdmc_class_init, -}; -static void aspeed_2700_sdmc_reset_hold (Object *obj,ResetType type) {AspeedSDMCState *s =ASPEED_SDMC (obj);
@@ -690,19 +662,36 @@ static void aspeed_2700_sdmc_class_init(ObjectClass *klass, const void *data) asc->valid_ram_sizes = aspeed_2700_ram_sizes; } -static const TypeInfo aspeed_2700_sdmc_info = { - .name =TYPE_ASPEED_2700_SDMC , - .parent =TYPE_ASPEED_SDMC , - .class_init = aspeed_2700_sdmc_class_init, +static const TypeInfo aspeed_sdmc_types[] = { + { + .name =TYPE_ASPEED_SDMC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedSDMCState), + .instance_init = aspeed_sdmc_initfn, + .class_init = aspeed_sdmc_class_init, + .class_size =sizeof (AspeedSDMCClass), + .abstract = true, + }, + { + .name =TYPE_ASPEED_2400_SDMC , + .parent =TYPE_ASPEED_SDMC , + .class_init = aspeed_2400_sdmc_class_init, + }, + { + .name =TYPE_ASPEED_2500_SDMC , + .parent =TYPE_ASPEED_SDMC , + .class_init = aspeed_2500_sdmc_class_init, + }, + { + .name =TYPE_ASPEED_2600_SDMC , + .parent =TYPE_ASPEED_SDMC , + .class_init = aspeed_2600_sdmc_class_init, + }, + { + .name =TYPE_ASPEED_2700_SDMC , + .parent =TYPE_ASPEED_SDMC , + .class_init = aspeed_2700_sdmc_class_init, + } }; -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_register_static (&aspeed_2700_sdmc_info); -} - -type_init (aspeed_sdmc_register_types); +DEFINE_TYPES (aspeed_sdmc_types)
Signature · 1 line
2.43.0
PATCH 14/24 hw/intc/aspeed_intc: convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 9 standalone TypeInfo variables (aspeed_intc_info as abstract base, aspeed_2700_intc_info, aspeed_2700_intcio_info, aspeed_2700_intcioexp1_info, aspeed_2700_intcioexp2_info, aspeed_2700ssp_intc_info, aspeed_2700ssp_intcio_info, aspeed_2700tsp_intc_info, aspeed_2700tsp_intcio_info) directly into the 'aspeed_intc_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/intc/aspeed_intc.c | 121 ++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 70 deletions(-)
hw/intc/aspeed_intc.c +51 -70
@@ -758,16 +758,6 @@ static void aspeed_intc_class_init(ObjectClass *klass, const void *data) aic->reg_ops = &aspeed_intc_ops; } -static const TypeInfo aspeed_intc_info = { - .name =TYPE_ASPEED_INTC , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_init = aspeed_intc_instance_init, - .instance_size =sizeof (AspeedINTCState), - .class_init = aspeed_intc_class_init, - .class_size =sizeof (AspeedINTCClass), - .abstract = true, -}; -static AspeedINTCIRQ aspeed_2700_intc_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,0 ,10 ,R_GICINT192_201_EN ,R_GICINT192_201_STATUS }, };
@@ -788,12 +778,6 @@ static void aspeed_2700_intc_class_init(ObjectClass *klass, const void *data) aic->irq_table_count =ARRAY_SIZE (aspeed_2700_intc_irqs); } -static const TypeInfo aspeed_2700_intc_info = { - .name =TYPE_ASPEED_2700_INTC , - .parent =TYPE_ASPEED_INTC , - .class_init = aspeed_2700_intc_class_init, -}; -static AspeedINTCIRQ aspeed_2700_intcioexp2_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,8 ,1 ,R_GICINT192_EN ,R_GICINT192_STATUS }, {1 ,9 ,1 ,R_GICINT193_EN ,R_GICINT193_STATUS },
@@ -817,12 +801,6 @@ static void aspeed_2700_intcioexp2_class_init(ObjectClass *klass, aic->irq_table_count =ARRAY_SIZE (aspeed_2700_intcioexp2_irqs); } -static const TypeInfo aspeed_2700_intcioexp2_info = { - .name =TYPE_ASPEED_2700_INTCIOEXP2 , - .parent =TYPE_ASPEED_INTC , - .class_init = aspeed_2700_intcioexp2_class_init, -}; -static AspeedINTCIRQ aspeed_2700_intcioexp1_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,6 ,1 ,R_GICINT192_EN ,R_GICINT192_STATUS }, {1 ,7 ,1 ,R_GICINT193_EN ,R_GICINT193_STATUS },
@@ -846,12 +824,6 @@ static void aspeed_2700_intcioexp1_class_init(ObjectClass *klass, aic->irq_table_count =ARRAY_SIZE (aspeed_2700_intcioexp1_irqs); } -static const TypeInfo aspeed_2700_intcioexp1_info = { - .name =TYPE_ASPEED_2700_INTCIOEXP1 , - .parent =TYPE_ASPEED_INTC , - .class_init = aspeed_2700_intcioexp1_class_init, -}; -static AspeedINTCIRQ aspeed_2700_intcio_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,0 ,1 ,R_GICINT192_EN ,R_GICINT192_STATUS }, {1 ,1 ,1 ,R_GICINT193_EN ,R_GICINT193_STATUS },
@@ -878,12 +850,6 @@ static void aspeed_2700_intcio_class_init(ObjectClass *klass, const void *data) aic->irq_table_count =ARRAY_SIZE (aspeed_2700_intcio_irqs); } -static const TypeInfo aspeed_2700_intcio_info = { - .name =TYPE_ASPEED_2700_INTCIO , - .parent =TYPE_ASPEED_INTC , - .class_init = aspeed_2700_intcio_class_init, -}; -static AspeedINTCIRQ aspeed_2700ssp_intc_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,0 ,10 ,R_SSPINT160_169_EN ,R_SSPINT160_169_STATUS }, };
@@ -905,12 +871,6 @@ static void aspeed_2700ssp_intc_class_init(ObjectClass *klass, const void *data) aic->irq_table_count =ARRAY_SIZE (aspeed_2700ssp_intc_irqs); } -static const TypeInfo aspeed_2700ssp_intc_info = { - .name =TYPE_ASPEED_2700SSP_INTC , - .parent =TYPE_ASPEED_INTC , - .class_init = aspeed_2700ssp_intc_class_init, -}; -static AspeedINTCIRQ aspeed_2700ssp_intcio_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,0 ,1 ,R_SSPINT160_EN ,R_SSPINT160_STATUS }, {1 ,1 ,1 ,R_SSPINT161_EN ,R_SSPINT161_STATUS },
@@ -938,12 +898,6 @@ static void aspeed_2700ssp_intcio_class_init(ObjectClass *klass, aic->irq_table_count =ARRAY_SIZE (aspeed_2700ssp_intcio_irqs); } -static const TypeInfo aspeed_2700ssp_intcio_info = { - .name =TYPE_ASPEED_2700SSP_INTCIO , - .parent =TYPE_ASPEED_INTC , - .class_init = aspeed_2700ssp_intcio_class_init, -}; -static AspeedINTCIRQ aspeed_2700tsp_intc_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,0 ,10 ,R_TSPINT160_169_EN ,R_TSPINT160_169_STATUS }, };
@@ -965,12 +919,6 @@ static void aspeed_2700tsp_intc_class_init(ObjectClass *klass, const void *data) aic->irq_table_count =ARRAY_SIZE (aspeed_2700tsp_intc_irqs); } -static const TypeInfo aspeed_2700tsp_intc_info = { - .name =TYPE_ASPEED_2700TSP_INTC , - .parent =TYPE_ASPEED_INTC , - .class_init = aspeed_2700tsp_intc_class_init, -}; -static AspeedINTCIRQ aspeed_2700tsp_intcio_irqs[ASPEED_INTC_MAX_INPINS ] = { {0 ,0 ,1 ,R_TSPINT160_EN ,R_TSPINT160_STATUS }, {1 ,1 ,1 ,R_TSPINT161_EN ,R_TSPINT161_STATUS },
@@ -998,23 +946,56 @@ static void aspeed_2700tsp_intcio_class_init(ObjectClass *klass, aic->irq_table_count =ARRAY_SIZE (aspeed_2700tsp_intcio_irqs); } -static const TypeInfo aspeed_2700tsp_intcio_info = { - .name =TYPE_ASPEED_2700TSP_INTCIO , - .parent =TYPE_ASPEED_INTC , - .class_init = aspeed_2700tsp_intcio_class_init, +static const TypeInfo aspeed_intc_types[] = { + { + .name =TYPE_ASPEED_INTC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = aspeed_intc_instance_init, + .instance_size =sizeof (AspeedINTCState), + .class_init = aspeed_intc_class_init, + .class_size =sizeof (AspeedINTCClass), + .abstract = true, + }, + { + .name =TYPE_ASPEED_2700_INTC , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700_intc_class_init, + }, + { + .name =TYPE_ASPEED_2700_INTCIO , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700_intcio_class_init, + }, + { + .name =TYPE_ASPEED_2700SSP_INTC , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700ssp_intc_class_init, + }, + { + .name =TYPE_ASPEED_2700SSP_INTCIO , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700ssp_intcio_class_init, + }, + { + .name =TYPE_ASPEED_2700TSP_INTC , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700tsp_intc_class_init, + }, + { + .name =TYPE_ASPEED_2700TSP_INTCIO , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700tsp_intcio_class_init, + }, + { + .name =TYPE_ASPEED_2700_INTCIOEXP1 , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700_intcioexp1_class_init, + }, + { + .name =TYPE_ASPEED_2700_INTCIOEXP2 , + .parent =TYPE_ASPEED_INTC , + .class_init = aspeed_2700_intcioexp2_class_init, + } }; -static void aspeed_intc_register_types (void ) -{ -type_register_static (&aspeed_intc_info); -type_register_static (&aspeed_2700_intc_info); -type_register_static (&aspeed_2700_intcio_info); -type_register_static (&aspeed_2700_intcioexp1_info); -type_register_static (&aspeed_2700_intcioexp2_info); -type_register_static (&aspeed_2700ssp_intc_info); -type_register_static (&aspeed_2700ssp_intcio_info); -type_register_static (&aspeed_2700tsp_intc_info); -type_register_static (&aspeed_2700tsp_intcio_info); -} - -type_init (aspeed_intc_register_types); +DEFINE_TYPES (aspeed_intc_types)
Signature · 1 line
2.43.0
PATCH 8/24 hw/misc:aspeed_sli: Convert to DEFINE_TYPES() with inlined TypeInfo
In reply to Jamin LinReplace the legacy type_register_static()/type_init() registration pattern with the modern DEFINE_TYPES() macro.
Inline 3 standalone TypeInfo variables (aspeed_sli_info as abstract base, aspeed_2700_sli_info, aspeed_2700_sliio_info) directly into the 'aspeed_sli_types[]' array, removing the need for separate declarations.
No functional change.
--- hw/misc/aspeed_sli.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-)
hw/misc/aspeed_sli.c +19 -25
@@ -132,13 +132,6 @@ static void aspeed_sli_class_init(ObjectClass *klass, const void *data) dc->realize = aspeed_sli_realize; } -static const TypeInfo aspeed_sli_info = { - .name =TYPE_ASPEED_SLI , - .parent =TYPE_SYS_BUS_DEVICE , - .instance_size =sizeof (AspeedSLIState), - .class_init = aspeed_sli_class_init, - .abstract = true, -};static void aspeed_2700_sli_class_init (ObjectClass *klass,const void *data) {
@@ -155,23 +148,24 @@ static void aspeed_2700_sliio_class_init(ObjectClass *klass, const void *data) dc->realize = aspeed_sliio_realize; } -static const TypeInfo aspeed_2700_sli_info = { - .name =TYPE_ASPEED_2700_SLI , - .parent =TYPE_ASPEED_SLI , - .class_init = aspeed_2700_sli_class_init, -}; - -static const TypeInfo aspeed_2700_sliio_info = { - .name =TYPE_ASPEED_2700_SLIIO , - .parent =TYPE_ASPEED_SLI , - .class_init = aspeed_2700_sliio_class_init, +static const TypeInfo aspeed_sli_types[] = { + { + .name =TYPE_ASPEED_SLI , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AspeedSLIState), + .class_init = aspeed_sli_class_init, + .abstract = true, + }, + { + .name =TYPE_ASPEED_2700_SLI , + .parent =TYPE_ASPEED_SLI , + .class_init = aspeed_2700_sli_class_init, + }, + { + .name =TYPE_ASPEED_2700_SLIIO , + .parent =TYPE_ASPEED_SLI , + .class_init = aspeed_2700_sliio_class_init, + } }; -static void aspeed_sli_register_types (void ) -{ -type_register_static (&aspeed_sli_info); -type_register_static (&aspeed_2700_sli_info); -type_register_static (&aspeed_2700_sliio_info); -} - -type_init (aspeed_sli_register_types); +DEFINE_TYPES (aspeed_sli_types)
Signature · 1 line
2.43.0
Quoted 63 lines · Jamin Lin
The QEMU community now prefers the
DEFINE_TYPES()macro over the legacy type_register_static()/type_init() pattern for device type registration.DEFINE_TYPES()accepts an array of TypeInfo structs and registers them all in a single call, making the registration code more concise and consistent with modern QEMU coding style.This series converts all Aspeed device models to use
DEFINE_TYPES()and further inlines the individual static TypeInfo variable declarations directly into the types array, eliminating the need for standalone TypeInfo variables scattered throughout each file.v1:
The changes are purely mechanical refactoring with no functional difference. The 24 patches cover all Aspeed-related device models across hw/adc, hw/arm, hw/fsi, hw/gpio, hw/i2c, hw/intc, hw/misc, hw/net, hw/nvram, hw/pci-host, hw/rtc, hw/ssi, hw/timer and hw/watchdog.Jamin Lin (24):
hw/misc/aspeed_hace: Convert toDEFINE_TYPES()with inlined TypeInfo hw/misc/aspeed_lpc: Convert toDEFINE_TYPES()with inlined TypeInfo hw/misc/aspeed_ltpi: Convert toDEFINE_TYPES()with inlined TypeInfo hw/misc/aspeed_pwm: Convert toDEFINE_TYPES()with inlined TypeInfo hw/misc/aspeed_sbc: Convert toDEFINE_TYPES()with inlined TypeInfo hw/misc/aspeed_scu: Convert toDEFINE_TYPES()with inlined TypeInfo hw/misc/aspeed_sdmc: Convert toDEFINE_TYPES()with inlined TypeInfo hw/misc:aspeed_sli: Convert toDEFINE_TYPES()with inlined TypeInfo hw/misc/aspeed_xdma: Convert toDEFINE_TYPES()with inlined TypeInfo hw/adc/aspeed_adc: Convert toDEFINE_TYPES()with inlined TypeInfo hw/arm/aspeed_ast1700: Convert toDEFINE_TYPES()with inlined TypeInfo hw/gpio/aspeed_gpio: Convert toDEFINE_TYPES()with inlined TypeInfo hw/gpio/aspeed_sgpio: Convert toDEFINE_TYPES()with inlined TypeInfo hw/intc/aspeed_intc: convert toDEFINE_TYPES()with inlined TypeInfo hw/intc/aspeed_vic: Convert toDEFINE_TYPES()with inlined TypeInfo hw/rtc/aspeed_rtc: Convert toDEFINE_TYPES()with inlined TypeInfo hw/watchdog/wdt_aspeed: Convert toDEFINE_TYPES()with inlined
TypeInfo
hw/nvram/aspeed_otp: Convert toDEFINE_TYPES()with inlined TypeInfo hw/timer/aspeed_timer: Convert toDEFINE_TYPES()with inlined TypeInfo hw/fsi/aspeed_apb2opb: Convert toDEFINE_TYPES()with inlined TypeInfo hw/pci-host/aspeed_pcie: Convert toDEFINE_TYPES()with inlined
TypeInfo
hw/i2c/aspeed_i2c: Convert toDEFINE_TYPES()with inlined TypeInfo hw/net/ftgmac100: Convert toDEFINE_TYPES()with inlined TypeInfo hw/ssi/aspeed_smc: Convert toDEFINE_TYPES()with inlined TypeInfohw/adc/aspeed_adc.c | 95 +++++++--------- hw/arm/aspeed_ast1700.c | 21 ++-- hw/fsi/aspeed_apb2opb.c | 42 +++---- hw/gpio/aspeed_gpio.c | 107 ++++++++---------- hw/gpio/aspeed_sgpio.c | 37 +++---- hw/i2c/aspeed_i2c.c | 113 ++++++++----------- hw/intc/aspeed_intc.c | 121 +++++++++----------- hw/intc/aspeed_vic.c | 19 ++-- hw/misc/aspeed_hace.c | 81 ++++++-------- hw/misc/aspeed_lpc.c | 21 ++-- hw/misc/aspeed_ltpi.c | 19 ++-- hw/misc/aspeed_pwm.c | 19 ++-- hw/misc/aspeed_sbc.c | 46 ++++---- hw/misc/aspeed_scu.c | 107 ++++++++---------- hw/misc/aspeed_sdmc.c | 73 ++++++------ hw/misc/aspeed_sli.c | 44 ++++---- hw/misc/aspeed_xdma.c | 58 +++++-----
Quoted 9 lines
hw/net/ftgmac100.c | 32 +++--- hw/nvram/aspeed_otp.c | 19 ++-- hw/pci-host/aspeed_pcie.c | 94 +++++++--------- hw/rtc/aspeed_rtc.c | 19 ++-- hw/ssi/aspeed_smc.c | 228 ++++++++++++++++---------------------- hw/timer/aspeed_timer.c | 83 ++++++-------- hw/watchdog/wdt_aspeed.c | 93 +++++++--------- 24 files changed, 678 insertions(+), 913 deletions(-)
Thanks,
C.