mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:17 +00:00
hw/timer/aspeed_timer: Convert to DEFINE_TYPES() with inlined TypeInfo
Replace 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. 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-20-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
c8ec9605b8
commit
228ad5fac7
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user