diff mbox

[qom-next,for-1.6,7/8] pl110: QOM'ify pl110, pl110_versatile and pl111

Message ID 51F41093.4010601@suse.de
State New
Headers show

Commit Message

Andreas Färber July 27, 2013, 6:25 p.m. UTC
Am 26.07.2013 14:40, schrieb Andreas Färber:
> Am 26.07.2013 04:58, schrieb Hu Tao:
>> Would it be better to explicitly set PL110 version? I know PL110 is 0,
>> but it's not like a normal variable which is always good to be
>> initialized to 0, assuming a version number is bad. (This is not a problem
>> of this patch)
> 
> Sure, I can add such a no-op line. Thanks for your watchful review!

Squashed the attached patch, that should address it.

Andreas
diff mbox

Patch

diff --git a/hw/display/pl110.c b/hw/display/pl110.c
index c774e46..58a8ff1 100644
--- a/hw/display/pl110.c
+++ b/hw/display/pl110.c
@@ -457,7 +457,7 @@  static const GraphicHwOps pl110_gfx_ops = {
     .gfx_update  = pl110_update_display,
 };
 
-static int pl110_init(SysBusDevice *sbd)
+static int pl110_initfn(SysBusDevice *sbd)
 {
     DeviceState *dev = DEVICE(sbd);
     PL110State *s = PL110(dev);
@@ -470,6 +470,13 @@  static int pl110_init(SysBusDevice *sbd)
     return 0;
 }
 
+static void pl110_init(Object *obj)
+{
+    PL110State *s = PL110(obj);
+
+    s->version = PL110;
+}
+
 static void pl110_versatile_init(Object *obj)
 {
     PL110State *s = PL110(obj);
@@ -489,7 +496,7 @@  static void pl110_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = pl110_init;
+    k->init = pl110_initfn;
     dc->no_user = 1;
     dc->vmsd = &vmstate_pl110;
 }
@@ -498,6 +505,7 @@  static const TypeInfo pl110_info = {
     .name          = TYPE_PL110,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(PL110State),
+    .instance_init = pl110_init,
     .class_init    = pl110_class_init,
 };