qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 27/34] wdt_ib700: QOM'ify


From: Andreas Färber
Subject: [Qemu-devel] [RFC 27/34] wdt_ib700: QOM'ify
Date: Mon, 26 Nov 2012 01:12:39 +0100

Introduce type constant and cast macro to obsolete DO_UPCAST().

Prepares for ISA realizefn.

Signed-off-by: Andreas Färber <address@hidden>
---
 hw/wdt_ib700.c |   14 +++++++++-----
 1 Datei geändert, 9 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)

diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c
index 7f6c21d..1365898 100644
--- a/hw/wdt_ib700.c
+++ b/hw/wdt_ib700.c
@@ -35,8 +35,12 @@
 #define ib700_debug(fs,...)
 #endif
 
+#define TYPE_IB700 "ib700"
+#define IB700(obj) OBJECT_CHECK(IB700State, (obj), TYPE_IB700)
+
 typedef struct IB700state {
-    ISADevice dev;
+    ISADevice parent_obj;
+
     QEMUTimer *timer;
 } IB700State;
 
@@ -95,7 +99,7 @@ static const VMStateDescription vmstate_ib700 = {
 
 static int wdt_ib700_init(ISADevice *dev)
 {
-    IB700State *s = DO_UPCAST(IB700State, dev, dev);
+    IB700State *s = IB700(dev);
 
     ib700_debug("watchdog init\n");
 
@@ -108,7 +112,7 @@ static int wdt_ib700_init(ISADevice *dev)
 
 static void wdt_ib700_reset(DeviceState *dev)
 {
-    IB700State *s = DO_UPCAST(IB700State, dev.qdev, dev);
+    IB700State *s = IB700(dev);
 
     ib700_debug("watchdog reset\n");
 
@@ -129,8 +133,8 @@ static void wdt_ib700_class_init(ObjectClass *klass, void 
*data)
     dc->vmsd = &vmstate_ib700;
 }
 
-static TypeInfo wdt_ib700_info = {
-    .name          = "ib700",
+static const TypeInfo wdt_ib700_info = {
+    .name          = TYPE_IB700,
     .parent        = TYPE_ISA_DEVICE,
     .instance_size = sizeof(IB700State),
     .class_init    = wdt_ib700_class_init,
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]