Patchwork [RFC,29/34] i8254: QOM'ify

login
register
mail settings
Submitter Andreas Färber
Date Nov. 26, 2012, 12:12 a.m.
Message ID <1353888766-6951-30-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/201589/
State New
Headers show

Comments

Andreas Färber - Nov. 26, 2012, 12:12 a.m.
Introduce type constant and avoid DO_UPCAST().

Prepares for PIT realizefn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/i8254.c |    6 +++---
 hw/i8254.h |    4 +++-
 2 Dateien geändert, 6 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

Patch

diff --git a/hw/i8254.c b/hw/i8254.c
index bea5f92..2a01217 100644
--- a/hw/i8254.c
+++ b/hw/i8254.c
@@ -265,7 +265,7 @@  static void pit_irq_timer(void *opaque)
 
 static void pit_reset(DeviceState *dev)
 {
-    PITCommonState *pit = DO_UPCAST(PITCommonState, dev.qdev, dev);
+    PITCommonState *pit = PIT_COMMON(dev);
     PITChannelState *s;
 
     pit_reset_common(pit);
@@ -347,8 +347,8 @@  static void pit_class_initfn(ObjectClass *klass, void *data)
     dc->props = pit_properties;
 }
 
-static TypeInfo pit_info = {
-    .name          = "isa-pit",
+static const TypeInfo pit_info = {
+    .name          = TYPE_I8254,
     .parent        = TYPE_PIT_COMMON,
     .instance_size = sizeof(PITCommonState),
     .class_init    = pit_class_initfn,
diff --git a/hw/i8254.h b/hw/i8254.h
index ba6b598..2566bac 100644
--- a/hw/i8254.h
+++ b/hw/i8254.h
@@ -37,12 +37,14 @@  typedef struct PITChannelInfo {
     int out;
 } PITChannelInfo;
 
+#define TYPE_I8254 "isa-pit"
+
 static inline ISADevice *pit_init(ISABus *bus, int base, int isa_irq,
                                   qemu_irq alt_irq)
 {
     ISADevice *dev;
 
-    dev = isa_create(bus, "isa-pit");
+    dev = isa_create(bus, TYPE_I8254);
     qdev_prop_set_uint32(&dev->qdev, "iobase", base);
     qdev_init_nofail(&dev->qdev);
     qdev_connect_gpio_out(&dev->qdev, 0,