qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 084/173] gpio/zaurus: QOM cast cleanup


From: Andreas Färber
Subject: [Qemu-devel] [PULL 084/173] gpio/zaurus: QOM cast cleanup
Date: Mon, 29 Jul 2013 21:19:01 +0200

Signed-off-by: Andreas Färber <address@hidden>
---
 hw/gpio/zaurus.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/hw/gpio/zaurus.c b/hw/gpio/zaurus.c
index c235c3e..dc79a8b 100644
--- a/hw/gpio/zaurus.c
+++ b/hw/gpio/zaurus.c
@@ -24,9 +24,13 @@
 
 /* SCOOP devices */
 
+#define TYPE_SCOOP "scoop"
+#define SCOOP(obj) OBJECT_CHECK(ScoopInfo, (obj), TYPE_SCOOP)
+
 typedef struct ScoopInfo ScoopInfo;
 struct ScoopInfo {
-    SysBusDevice busdev;
+    SysBusDevice parent_obj;
+
     qemu_irq handler[16];
     MemoryRegion iomem;
     uint16_t status;
@@ -162,16 +166,17 @@ static void scoop_gpio_set(void *opaque, int line, int 
level)
         s->gpio_level &= ~(1 << line);
 }
 
-static int scoop_init(SysBusDevice *dev)
+static int scoop_init(SysBusDevice *sbd)
 {
-    ScoopInfo *s = FROM_SYSBUS(ScoopInfo, dev);
+    DeviceState *dev = DEVICE(sbd);
+    ScoopInfo *s = SCOOP(dev);
 
     s->status = 0x02;
-    qdev_init_gpio_out(&s->busdev.qdev, s->handler, 16);
-    qdev_init_gpio_in(&s->busdev.qdev, scoop_gpio_set, 16);
+    qdev_init_gpio_out(dev, s->handler, 16);
+    qdev_init_gpio_in(dev, scoop_gpio_set, 16);
     memory_region_init_io(&s->iomem, OBJECT(s), &scoop_ops, s, "scoop", 
0x1000);
 
-    sysbus_init_mmio(dev, &s->iomem);
+    sysbus_init_mmio(sbd, &s->iomem);
 
     return 0;
 }
@@ -237,7 +242,7 @@ static void scoop_sysbus_class_init(ObjectClass *klass, 
void *data)
 }
 
 static const TypeInfo scoop_sysbus_info = {
-    .name          = "scoop",
+    .name          = TYPE_SCOOP,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(ScoopInfo),
     .class_init    = scoop_sysbus_class_init,
-- 
1.8.1.4




reply via email to

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