From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Scott Wood" <scottwood@freescale.com>,
"open list:mpc8544ds" <qemu-ppc@nongnu.org>,
"Andreas Färber" <afaerber@suse.de>,
"Alexander Graf" <agraf@suse.de>
Subject: [Qemu-devel] [PATCH 2/3] mpc8544_guts: QOM'ify
Date: Sun, 9 Jun 2013 22:47:34 +0200 [thread overview]
Message-ID: <1370810855-18334-3-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1370810855-18334-1-git-send-email-afaerber@suse.de>
Introduce type constant, cast macro and rename parent field.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/ppc/mpc8544_guts.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/hw/ppc/mpc8544_guts.c b/hw/ppc/mpc8544_guts.c
index 98540a4..f623b04 100644
--- a/hw/ppc/mpc8544_guts.c
+++ b/hw/ppc/mpc8544_guts.c
@@ -51,8 +51,14 @@
#define MPC8544_GUTS_ADDR_SRDS2CR1 0xF10
#define MPC8544_GUTS_ADDR_SRDS2CR3 0xF18
+#define TYPE_MPC8544_GUTS "mpc8544-guts"
+#define MPC8544_GUTS(obj) OBJECT_CHECK(GutsState, (obj), TYPE_MPC8544_GUTS)
+
struct GutsState {
- SysBusDevice busdev;
+ /*< private >*/
+ SysBusDevice parent_obj;
+ /*< public >*/
+
MemoryRegion iomem;
};
@@ -110,9 +116,7 @@ static const MemoryRegionOps mpc8544_guts_ops = {
static int mpc8544_guts_initfn(SysBusDevice *dev)
{
- GutsState *s;
-
- s = FROM_SYSBUS(GutsState, SYS_BUS_DEVICE(dev));
+ GutsState *s = MPC8544_GUTS(dev);
memory_region_init_io(&s->iomem, &mpc8544_guts_ops, s,
"mpc8544.guts", MPC8544_GUTS_MMIO_SIZE);
@@ -129,7 +133,7 @@ static void mpc8544_guts_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo mpc8544_guts_info = {
- .name = "mpc8544-guts",
+ .name = TYPE_MPC8544_GUTS,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(GutsState),
.class_init = mpc8544_guts_class_init,
--
1.8.1.4
next prev parent reply other threads:[~2013-06-09 20:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-09 20:47 [Qemu-devel] [PATCH 0/3] ppc: QOM'ify mpc8544_guts device Andreas Färber
2013-06-09 20:47 ` [Qemu-devel] [PATCH 1/3] mpc8544_guts: Fix MemoryRegion name Andreas Färber
2013-06-09 20:47 ` Andreas Färber [this message]
2013-06-09 20:47 ` [Qemu-devel] [PATCH 3/3] mpc8544_guts: Turn qdev initfn into instance_init Andreas Färber
2013-06-16 17:29 ` [Qemu-devel] [PATCH 0/3] ppc: QOM'ify mpc8544_guts device Andreas Färber
2013-06-18 12:43 ` Alexander Graf
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=1370810855-18334-3-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=scottwood@freescale.com \
/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).