Patchwork [RFC,16/34] ne2000-isa: QOM'ify

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

Comments

Andreas Färber - Nov. 26, 2012, 12:12 a.m.
Introduce type constant and cast macro to obsolete DO_UPCAST().

Prepares for ISA realizefn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/ne2000-isa.c |   12 ++++++++----
 1 Datei geändert, 8 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

Patch

diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c
index 69982a9..5aabe7c 100644
--- a/hw/ne2000-isa.c
+++ b/hw/ne2000-isa.c
@@ -29,8 +29,12 @@ 
 #include "ne2000.h"
 #include "exec-memory.h"
 
+#define TYPE_ISA_NE2000 "ne2k_isa"
+#define ISA_NE2000(obj) OBJECT_CHECK(ISANE2000State, (obj), TYPE_ISA_NE2000)
+
 typedef struct ISANE2000State {
-    ISADevice dev;
+    ISADevice parent_obj;
+
     uint32_t iobase;
     uint32_t isairq;
     NE2000State ne2000;
@@ -64,7 +68,7 @@  static const VMStateDescription vmstate_isa_ne2000 = {
 
 static int isa_ne2000_initfn(ISADevice *dev)
 {
-    ISANE2000State *isa = DO_UPCAST(ISANE2000State, dev, dev);
+    ISANE2000State *isa = ISA_NE2000(dev);
     NE2000State *s = &isa->ne2000;
 
     ne2000_setup_io(s, 0x20);
@@ -97,8 +101,8 @@  static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
     dc->props = ne2000_isa_properties;
 }
 
-static TypeInfo ne2000_isa_info = {
-    .name          = "ne2k_isa",
+static const TypeInfo ne2000_isa_info = {
+    .name          = TYPE_ISA_NE2000,
     .parent        = TYPE_ISA_DEVICE,
     .instance_size = sizeof(ISANE2000State),
     .class_init    = isa_ne2000_class_initfn,