mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
hw/adc/aspeed_adc: Convert to DEFINE_TYPES() with inlined TypeInfo
Replace 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. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/20260601024959.2347639-11-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
committed by
Cédric Le Goater
parent
752ba21c3f
commit
a3f6263c7e
@@ -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_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 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 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)
|
||||
|
||||
Reference in New Issue
Block a user