Skip to contentSkip to conversation

hw/isa/isa-superio: Set abstract TYPE_ISA_SUPERIO instance size

PATCH Superseded Philippe Mathieu-Daudé 2 participants 2 messages Aug 21, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/isa/isa-superio: Set abstract TYPE_ISA_SUPERIO instance size

Instead of setting the instance size on each implementations, set it on the abstract parent, so we are sure no implementation will forget to set it.

---
See:
https://www.mail-archive.com/[email protected]/msg731954.html

---
 hw/isa/isa-superio.c       | 2 +-
 hw/isa/smc37c669-superio.c | 1 -
 hw/isa/vt82c686.c          | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)
hw/isa/isa-superio.c +1 -1
index e2e47d8fd99..83eb21ebb2a 100644
@@ -182,6 +182,7 @@ static const TypeInfo isa_superio_type_info = {
     .name = TYPE_ISA_SUPERIO,
     .parent = TYPE_ISA_DEVICE,
     .abstract = true,
+    .instance_size = sizeof(ISASuperIODevice),
     .class_size = sizeof(ISASuperIOClass),
     .class_init = isa_superio_class_init,
 };
@@ -200,7 +201,6 @@ static void fdc37m81x_class_init(ObjectClass *klass, void *data)
 static const TypeInfo fdc37m81x_type_info = {
     .name          = TYPE_FDC37M81X_SUPERIO,
     .parent        = TYPE_ISA_SUPERIO,
-    .instance_size = sizeof(ISASuperIODevice),
     .class_init    = fdc37m81x_class_init,
 };
 
hw/isa/smc37c669-superio.c +0 -1
index 18287741cb4..9e59dc16039 100644
@@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)
 static const TypeInfo smc37c669_type_info = {
     .name          = TYPE_SMC37C669_SUPERIO,
     .parent        = TYPE_ISA_SUPERIO,
-    .instance_size = sizeof(ISASuperIODevice),
     .class_size    = sizeof(ISASuperIOClass),
     .class_init    = smc37c669_class_init,
 };
hw/isa/vt82c686.c +0 -1
index 18160ca445d..a4b84d405d0 100644
@@ -533,7 +533,6 @@ static void vt82c686b_superio_class_init(ObjectClass *klass, void *data)
 static const TypeInfo via_superio_info = {
     .name          = TYPE_VT82C686B_SUPERIO,
     .parent        = TYPE_ISA_SUPERIO,
-    .instance_size = sizeof(ISASuperIODevice),
     .class_size    = sizeof(ISASuperIOClass),
     .class_init    = vt82c686b_superio_class_init,
 };
Signature · 1 line
2.26.2
#1 lore raw
Quoted 6 lines · Philippe Mathieu-Daudé

Instead of setting the instance size on each implementations, set it on the abstract parent, so we are sure no implementation will forget to set it.

Thanks!

The changes look good, but while we are at it we could also clear class_size at smc37c669_type_info and via_superio_info.

---

hw/isa/smc37c669-superio.c +0 -1
index a988c55330..2dab9d90bf 100644
@@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)
 static const TypeInfo smc37c669_type_info = {
     .name          = TYPE_SMC37C669_SUPERIO,
     .parent        = TYPE_ISA_SUPERIO,
-    .class_size    = sizeof(ISASuperIOClass),
     .class_init    = smc37c669_class_init,
 };
 TYPE_INFO(smc37c669_type_info)
hw/isa/vt82c686.c +0 -1
index 4a9f8954a9..4fd3550cbb 100644
@@ -542,7 +542,6 @@ static void vt82c686b_superio_class_init(ObjectClass *klass, void *data)
 static const TypeInfo via_superio_info = {
     .name          = TYPE_VT82C686B_SUPERIO,
     .parent        = TYPE_ISA_SUPERIO,
-    .class_size    = sizeof(ISASuperIOClass),
     .class_init    = vt82c686b_superio_class_init,
 };
 TYPE_INFO(via_superio_info)
Quoted 56 lines

---
See:
https://www.mail-archive.com/[email protected]/msg731954.html

---
 hw/isa/isa-superio.c       | 2 +-
 hw/isa/smc37c669-superio.c | 1 -
 hw/isa/vt82c686.c          | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)
hw/isa/isa-superio.c +1 -1
index e2e47d8fd99..83eb21ebb2a 100644
@@ -182,6 +182,7 @@ static const TypeInfo isa_superio_type_info = {
     .name = TYPE_ISA_SUPERIO,
     .parent = TYPE_ISA_DEVICE,
     .abstract = true,
+    .instance_size = sizeof(ISASuperIODevice),
     .class_size = sizeof(ISASuperIOClass),
     .class_init = isa_superio_class_init,
 };
@@ -200,7 +201,6 @@ static void fdc37m81x_class_init(ObjectClass *klass, void *data)
 static const TypeInfo fdc37m81x_type_info = {
     .name          = TYPE_FDC37M81X_SUPERIO,
     .parent        = TYPE_ISA_SUPERIO,
-    .instance_size = sizeof(ISASuperIODevice),
     .class_init    = fdc37m81x_class_init,
 };
 
hw/isa/smc37c669-superio.c +0 -1
index 18287741cb4..9e59dc16039 100644
@@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)
 static const TypeInfo smc37c669_type_info = {
     .name          = TYPE_SMC37C669_SUPERIO,
     .parent        = TYPE_ISA_SUPERIO,
-    .instance_size = sizeof(ISASuperIODevice),
     .class_size    = sizeof(ISASuperIOClass),
     .class_init    = smc37c669_class_init,
 };
hw/isa/vt82c686.c +0 -1
index 18160ca445d..a4b84d405d0 100644
@@ -533,7 +533,6 @@ static void vt82c686b_superio_class_init(ObjectClass *klass, void *data)
 static const TypeInfo via_superio_info = {
     .name          = TYPE_VT82C686B_SUPERIO,
     .parent        = TYPE_ISA_SUPERIO,
-    .instance_size = sizeof(ISASuperIODevice),
     .class_size    = sizeof(ISASuperIOClass),
     .class_init    = vt82c686b_superio_class_init,
 };
Signature · 1 line
2.26.2
Signature · 1 line
Eduardo