qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>, anthony@codemonkey.ws
Subject: [Qemu-devel] [PATCH v2 04/12] i8254: QOM'ify some more
Date: Fri,  7 Jun 2013 14:58:12 +0200	[thread overview]
Message-ID: <1370609900-21998-5-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1370609900-21998-1-git-send-email-afaerber@suse.de>

Introduce type constant and avoid DO_UPCAST().

Prepares for PIT realizefn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/timer/i8254.c         |  4 ++--
 include/hw/timer/i8254.h | 18 +++++++++++-------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c
index 20c0c36..efbca19 100644
--- a/hw/timer/i8254.c
+++ b/hw/timer/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);
@@ -348,7 +348,7 @@ static void pit_class_initfn(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo pit_info = {
-    .name          = "isa-pit",
+    .name          = TYPE_I8254,
     .parent        = TYPE_PIT_COMMON,
     .instance_size = sizeof(PITCommonState),
     .class_init    = pit_class_initfn,
diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
index 75bb530..016f990 100644
--- a/include/hw/timer/i8254.h
+++ b/include/hw/timer/i8254.h
@@ -37,18 +37,22 @@ 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;
+    DeviceState *dev;
+    ISADevice *d;
 
-    dev = isa_create(bus, "isa-pit");
-    qdev_prop_set_uint32(&dev->qdev, "iobase", base);
-    qdev_init_nofail(&dev->qdev);
-    qdev_connect_gpio_out(&dev->qdev, 0,
-                          isa_irq >= 0 ? isa_get_irq(dev, isa_irq) : alt_irq);
+    d = isa_create(bus, TYPE_I8254);
+    dev = DEVICE(d);
+    qdev_prop_set_uint32(dev, "iobase", base);
+    qdev_init_nofail(dev);
+    qdev_connect_gpio_out(dev, 0,
+                          isa_irq >= 0 ? isa_get_irq(d, isa_irq) : alt_irq);
 
-    return dev;
+    return d;
 }
 
 static inline ISADevice *kvm_pit_init(ISABus *bus, int base)
-- 
1.8.1.4

  parent reply	other threads:[~2013-06-07 12:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 12:58 [Qemu-devel] [PATCH v2 00/12] QOM realize for ISA, part 2 Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 01/12] gus: QOM'ify some more Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 02/12] cs4231a: " Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 03/12] isa: Use realizefn for ISADevice Andreas Färber
2013-06-07 12:58 ` Andreas Färber [this message]
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 05/12] kvm/i8254: QOM'ify some more Andreas Färber
2013-06-10  1:37   ` li guang
2013-06-10  1:40     ` Andreas Färber
2013-06-10  1:43       ` li guang
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 06/12] i8254: Convert PITCommonState to QOM realizefn Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 07/12] i8259: QOM'ify some more Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 08/12] kvm/i8259: " Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 09/12] i8259: Convert PICCommonState to use QOM realizefn Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 10/12] isa: QOM'ify ISABus Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 11/12] isa: QOM'ify ISADevice Andreas Färber
2013-06-07 12:58 ` [Qemu-devel] [PATCH v2 12/12] qdev: Drop FROM_QBUS() macro Andreas Färber
2013-06-07 13:08 ` [Qemu-devel] [PATCH v2 00/12] QOM realize for ISA, part 2 Andreas Färber
2013-06-15 17:55 ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370609900-21998-5-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).