Patchwork [RFC,05/34] isa: Split off instance_init for ISADevice

login
register
mail settings
Submitter Andreas Färber
Date Nov. 26, 2012, 12:12 a.m.
Message ID <1353888766-6951-6-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/201587/
State New
Headers show

Comments

Andreas Färber - Nov. 26, 2012, 12:12 a.m.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/isa-bus.c |   14 ++++++++++----
 1 Datei geändert, 10 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

Patch

diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 144a88e..2b1fc40 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -124,9 +124,6 @@  static int isa_qdev_init(DeviceState *qdev)
     ISADevice *dev = ISA_DEVICE(qdev);
     ISADeviceClass *klass = ISA_DEVICE_GET_CLASS(dev);
 
-    dev->isairq[0] = -1;
-    dev->isairq[1] = -1;
-
     if (klass->init) {
         return klass->init(dev);
     }
@@ -134,6 +131,14 @@  static int isa_qdev_init(DeviceState *qdev)
     return 0;
 }
 
+static void isa_device_init(Object *obj)
+{
+    ISADevice *dev = ISA_DEVICE(obj);
+
+    dev->isairq[0] = -1;
+    dev->isairq[1] = -1;
+}
+
 ISADevice *isa_create(ISABus *bus, const char *name)
 {
     DeviceState *dev;
@@ -229,10 +234,11 @@  static void isa_device_class_init(ObjectClass *klass, void *data)
     k->bus_type = TYPE_ISA_BUS;
 }
 
-static TypeInfo isa_device_type_info = {
+static const TypeInfo isa_device_type_info = {
     .name = TYPE_ISA_DEVICE,
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(ISADevice),
+    .instance_init = isa_device_init,
     .abstract = true,
     .class_size = sizeof(ISADeviceClass),
     .class_init = isa_device_class_init,