From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH qom-next for-1.6 04/11] opencores_eth: QOM cast cleanup
Date: Sat, 27 Jul 2013 22:19:49 +0200 [thread overview]
Message-ID: <1374956396-25586-5-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1374956396-25586-1-git-send-email-afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/net/opencores_eth.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
index 4637557..f2f82f2 100644
--- a/hw/net/opencores_eth.c
+++ b/hw/net/opencores_eth.c
@@ -267,8 +267,12 @@ typedef struct desc {
#define DEFAULT_PHY 1
+#define TYPE_OPEN_ETH "open_eth"
+#define OPEN_ETH(obj) OBJECT_CHECK(OpenEthState, (obj), TYPE_OPEN_ETH)
+
typedef struct OpenEthState {
- SysBusDevice dev;
+ SysBusDevice parent_obj;
+
NICState *nic;
NICConf conf;
MemoryRegion reg_io;
@@ -677,28 +681,30 @@ static const MemoryRegionOps open_eth_desc_ops = {
.write = open_eth_desc_write,
};
-static int sysbus_open_eth_init(SysBusDevice *dev)
+static int sysbus_open_eth_init(SysBusDevice *sbd)
{
- OpenEthState *s = DO_UPCAST(OpenEthState, dev, dev);
+ DeviceState *dev = DEVICE(sbd);
+ OpenEthState *s = OPEN_ETH(dev);
memory_region_init_io(&s->reg_io, OBJECT(dev), &open_eth_reg_ops, s,
"open_eth.regs", 0x54);
- sysbus_init_mmio(dev, &s->reg_io);
+ sysbus_init_mmio(sbd, &s->reg_io);
memory_region_init_io(&s->desc_io, OBJECT(dev), &open_eth_desc_ops, s,
"open_eth.desc", 0x400);
- sysbus_init_mmio(dev, &s->desc_io);
+ sysbus_init_mmio(sbd, &s->desc_io);
- sysbus_init_irq(dev, &s->irq);
+ sysbus_init_irq(sbd, &s->irq);
s->nic = qemu_new_nic(&net_open_eth_info, &s->conf,
- object_get_typename(OBJECT(s)), s->dev.qdev.id, s);
+ object_get_typename(OBJECT(s)), dev->id, s);
return 0;
}
static void qdev_open_eth_reset(DeviceState *dev)
{
- OpenEthState *d = DO_UPCAST(OpenEthState, dev.qdev, dev);
+ OpenEthState *d = OPEN_ETH(dev);
+
open_eth_reset(d);
}
@@ -719,7 +725,7 @@ static void open_eth_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo open_eth_info = {
- .name = "open_eth",
+ .name = TYPE_OPEN_ETH,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(OpenEthState),
.class_init = open_eth_class_init,
--
1.8.1.4
next prev parent reply other threads:[~2013-07-27 21:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-27 20:19 [Qemu-devel] [PATCH qom-next for-1.6 00/11] sysbus: QOM cast cleanups -- plus outlook Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 01/11] sysbus: Drop FROM_SYSBUS() Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 02/11] sysbus: Remove unused sysbus_new() prototype Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 03/11] exynos4210_i2c: QOM cast cleanup Andreas Färber
2013-07-27 20:19 ` Andreas Färber [this message]
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 05/11] mipsnet: " Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 06/11] kvmvapic: " Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 07/11] kvm/ioapic: " Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 08/11] ioapic: " Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 09/11] mips_malta: " Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 10/11] spapr_pci: " Andreas Färber
2013-07-27 20:19 ` [Qemu-devel] [PATCH qom-next for-1.6 11/11] sysbus: QOM parent field cleanup for SysBusDevice Andreas Färber
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=1374956396-25586-5-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--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).