puv3_pm: QOM cast cleanup
authorAndreas Färber <afaerber@suse.de>
Fri, 26 Jul 2013 21:16:03 +0000 (23:16 +0200)
committerAndreas Färber <afaerber@suse.de>
Mon, 29 Jul 2013 19:06:59 +0000 (21:06 +0200)
Signed-off-by: Andreas Färber <afaerber@suse.de>
hw/misc/puv3_pm.c

index 5592560014a449cf72f64b562f5fac51d68b61a1..37f23695d83235077d9ac483304dff92b375f2ea 100644 (file)
 #undef DEBUG_PUV3
 #include "hw/unicore32/puv3.h"
 
-typedef struct {
-    SysBusDevice busdev;
+#define TYPE_PUV3_PM "puv3_pm"
+#define PUV3_PM(obj) OBJECT_CHECK(PUV3PMState, (obj), TYPE_PUV3_PM)
+
+typedef struct PUV3PMState {
+    SysBusDevice parent_obj;
+
     MemoryRegion iomem;
 
     uint32_t reg_PMCR;
@@ -116,7 +120,7 @@ static const MemoryRegionOps puv3_pm_ops = {
 
 static int puv3_pm_init(SysBusDevice *dev)
 {
-    PUV3PMState *s = FROM_SYSBUS(PUV3PMState, dev);
+    PUV3PMState *s = PUV3_PM(dev);
 
     s->reg_PCGR = 0x0;
 
@@ -135,7 +139,7 @@ static void puv3_pm_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo puv3_pm_info = {
-    .name = "puv3_pm",
+    .name = TYPE_PUV3_PM,
     .parent = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(PUV3PMState),
     .class_init = puv3_pm_class_init,