diff mbox series

[v2,18/18] hw/isa: Remove empty ISADeviceClass structure

Message ID 20230215161641.32663-19-philmd@linaro.org
State Superseded
Headers show
Series hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() | expand

Commit Message

Philippe Mathieu-Daudé Feb. 15, 2023, 4:16 p.m. UTC
ISADeviceClass is an empty class and just increase code
complexity. Remove it, directly embedding DeviceClass in
classes expanding TYPE_ISA_DEVICE.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/isa/isa-bus.c                  | 1 -
 hw/rtc/m48t59-isa.c               | 2 +-
 include/hw/isa/i8259_internal.h   | 2 +-
 include/hw/isa/isa.h              | 6 +-----
 include/hw/isa/superio.h          | 2 +-
 include/hw/timer/i8254_internal.h | 2 +-
 6 files changed, 5 insertions(+), 10 deletions(-)

Comments

Bernhard Beschow Feb. 16, 2023, 3:28 p.m. UTC | #1
Am 15. Februar 2023 16:16:41 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>ISADeviceClass is an empty class and just increase code
>complexity. Remove it, directly embedding DeviceClass in
>classes expanding TYPE_ISA_DEVICE.
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>---
> hw/isa/isa-bus.c                  | 1 -
> hw/rtc/m48t59-isa.c               | 2 +-
> include/hw/isa/i8259_internal.h   | 2 +-
> include/hw/isa/isa.h              | 6 +-----
> include/hw/isa/superio.h          | 2 +-
> include/hw/timer/i8254_internal.h | 2 +-
> 6 files changed, 5 insertions(+), 10 deletions(-)
>
>diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
>index f44817b88b..1276f31826 100644
>--- a/hw/isa/isa-bus.c
>+++ b/hw/isa/isa-bus.c
>@@ -221,7 +221,6 @@ static const TypeInfo isa_device_type_info = {
>     .parent = TYPE_DEVICE,
>     .instance_size = sizeof(ISADevice),
>     .abstract = true,
>-    .class_size = sizeof(ISADeviceClass),
>     .class_init = isa_device_class_init,
> };
> 
>diff --git a/hw/rtc/m48t59-isa.c b/hw/rtc/m48t59-isa.c
>index e61f7ec370..5bb46f2383 100644
>--- a/hw/rtc/m48t59-isa.c
>+++ b/hw/rtc/m48t59-isa.c
>@@ -47,7 +47,7 @@ struct M48txxISAState {
> };
> 
> struct M48txxISADeviceClass {
>-    ISADeviceClass parent_class;
>+    DeviceClass parent_class;
>     M48txxInfo info;
> };
> 
>diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_internal.h
>index d272d879fb..155b098452 100644
>--- a/include/hw/isa/i8259_internal.h
>+++ b/include/hw/isa/i8259_internal.h
>@@ -35,7 +35,7 @@
> OBJECT_DECLARE_TYPE(PICCommonState, PICCommonClass, PIC_COMMON)
> 
> struct PICCommonClass {
>-    ISADeviceClass parent_class;
>+    DeviceClass parent_class;
> 
>     void (*pre_save)(PICCommonState *s);
>     void (*post_load)(PICCommonState *s);
>diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
>index c9954a7d99..411d12330b 100644
>--- a/include/hw/isa/isa.h
>+++ b/include/hw/isa/isa.h
>@@ -11,7 +11,7 @@
> #define ISA_NUM_IRQS 16
> 
> #define TYPE_ISA_DEVICE "isa-device"
>-OBJECT_DECLARE_TYPE(ISADevice, ISADeviceClass, ISA_DEVICE)
>+OBJECT_DECLARE_SIMPLE_TYPE(ISADevice, ISA_DEVICE)
> 
> #define TYPE_ISA_BUS "ISA"
> OBJECT_DECLARE_SIMPLE_TYPE(ISABus, ISA_BUS)
>@@ -48,10 +48,6 @@ struct IsaDmaClass {
>                              void *opaque);
> };
> 
>-struct ISADeviceClass {
>-    DeviceClass parent_class;
>-};
>-
> struct ISABus {
>     /*< private >*/
>     BusState parent_obj;
>diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
>index b9f5c19155..0dc45104d4 100644
>--- a/include/hw/isa/superio.h
>+++ b/include/hw/isa/superio.h
>@@ -44,7 +44,7 @@ typedef struct ISASuperIOFuncs {
> 
> struct ISASuperIOClass {
>     /*< private >*/
>-    ISADeviceClass parent_class;
>+    DeviceClass parent_class;
>     /*< public >*/
>     DeviceRealize parent_realize;
> 
>diff --git a/include/hw/timer/i8254_internal.h b/include/hw/timer/i8254_internal.h
>index a9a600d941..1761deb4cf 100644
>--- a/include/hw/timer/i8254_internal.h
>+++ b/include/hw/timer/i8254_internal.h
>@@ -58,7 +58,7 @@ struct PITCommonState {
> };
> 
> struct PITCommonClass {
>-    ISADeviceClass parent_class;
>+    DeviceClass parent_class;
> 
>     void (*set_channel_gate)(PITCommonState *s, PITChannelState *sc, int val);
>     void (*get_channel_info)(PITCommonState *s, PITChannelState *sc,

Reviewed-by: Bernhard Beschow <shentey@gmail.com>
diff mbox series

Patch

diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index f44817b88b..1276f31826 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -221,7 +221,6 @@  static const TypeInfo isa_device_type_info = {
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(ISADevice),
     .abstract = true,
-    .class_size = sizeof(ISADeviceClass),
     .class_init = isa_device_class_init,
 };
 
diff --git a/hw/rtc/m48t59-isa.c b/hw/rtc/m48t59-isa.c
index e61f7ec370..5bb46f2383 100644
--- a/hw/rtc/m48t59-isa.c
+++ b/hw/rtc/m48t59-isa.c
@@ -47,7 +47,7 @@  struct M48txxISAState {
 };
 
 struct M48txxISADeviceClass {
-    ISADeviceClass parent_class;
+    DeviceClass parent_class;
     M48txxInfo info;
 };
 
diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_internal.h
index d272d879fb..155b098452 100644
--- a/include/hw/isa/i8259_internal.h
+++ b/include/hw/isa/i8259_internal.h
@@ -35,7 +35,7 @@ 
 OBJECT_DECLARE_TYPE(PICCommonState, PICCommonClass, PIC_COMMON)
 
 struct PICCommonClass {
-    ISADeviceClass parent_class;
+    DeviceClass parent_class;
 
     void (*pre_save)(PICCommonState *s);
     void (*post_load)(PICCommonState *s);
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index c9954a7d99..411d12330b 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -11,7 +11,7 @@ 
 #define ISA_NUM_IRQS 16
 
 #define TYPE_ISA_DEVICE "isa-device"
-OBJECT_DECLARE_TYPE(ISADevice, ISADeviceClass, ISA_DEVICE)
+OBJECT_DECLARE_SIMPLE_TYPE(ISADevice, ISA_DEVICE)
 
 #define TYPE_ISA_BUS "ISA"
 OBJECT_DECLARE_SIMPLE_TYPE(ISABus, ISA_BUS)
@@ -48,10 +48,6 @@  struct IsaDmaClass {
                              void *opaque);
 };
 
-struct ISADeviceClass {
-    DeviceClass parent_class;
-};
-
 struct ISABus {
     /*< private >*/
     BusState parent_obj;
diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
index b9f5c19155..0dc45104d4 100644
--- a/include/hw/isa/superio.h
+++ b/include/hw/isa/superio.h
@@ -44,7 +44,7 @@  typedef struct ISASuperIOFuncs {
 
 struct ISASuperIOClass {
     /*< private >*/
-    ISADeviceClass parent_class;
+    DeviceClass parent_class;
     /*< public >*/
     DeviceRealize parent_realize;
 
diff --git a/include/hw/timer/i8254_internal.h b/include/hw/timer/i8254_internal.h
index a9a600d941..1761deb4cf 100644
--- a/include/hw/timer/i8254_internal.h
+++ b/include/hw/timer/i8254_internal.h
@@ -58,7 +58,7 @@  struct PITCommonState {
 };
 
 struct PITCommonClass {
-    ISADeviceClass parent_class;
+    DeviceClass parent_class;
 
     void (*set_channel_gate)(PITCommonState *s, PITChannelState *sc, int val);
     void (*get_channel_info)(PITCommonState *s, PITChannelState *sc,