qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC 23/34] sga: QOM'ify


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

Introduce type constant and cast macro.

Prepares for ISA realizefn.

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

diff --git a/hw/sga.c b/hw/sga.c
index a666349..d828f45 100644
--- a/hw/sga.c
+++ b/hw/sga.c
@@ -31,8 +31,11 @@
 
 #define SGABIOS_FILENAME "sgabios.bin"
 
-typedef struct ISAGAState {
-    ISADevice dev;
+#define TYPE_SGA "sga"
+#define SGA(obj) OBJECT_CHECK(ISASGAState, (obj), TYPE_SGA)
+
+typedef struct ISASGAState {
+    ISADevice parent_obj;
 } ISASGAState;
 
 static int sga_initfn(ISADevice *dev)
@@ -40,6 +43,7 @@ static int sga_initfn(ISADevice *dev)
     rom_add_vga(SGABIOS_FILENAME);
     return 0;
 }
+
 static void sga_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -48,8 +52,8 @@ static void sga_class_initfn(ObjectClass *klass, void *data)
     dc->desc = "Serial Graphics Adapter";
 }
 
-static TypeInfo sga_info = {
-    .name          = "sga",
+static const TypeInfo sga_info = {
+    .name          = TYPE_SGA,
     .parent        = TYPE_ISA_DEVICE,
     .instance_size = sizeof(ISASGAState),
     .class_init    = sga_class_initfn,
-- 
1.7.10.4




reply via email to

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