Patchwork [qom-next,for-1.6,02/11] etraxfs_eth: QOM cast cleanup

login
register
mail settings
Submitter Andreas Färber
Date July 27, 2013, 10:44 a.m.
Message ID <1374921903-13114-3-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/262423/
State New
Headers show

Comments

Andreas Färber - July 27, 2013, 10:44 a.m.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/net/etraxfs_eth.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c
index ab9a215..71b4fb8 100644
--- a/hw/net/etraxfs_eth.c
+++ b/hw/net/etraxfs_eth.c
@@ -322,9 +322,14 @@  static void mdio_cycle(struct qemu_mdio *bus)
 #define R_STAT          0x0b
 #define FS_ETH_MAX_REGS      0x17
 
+#define TYPE_ETRAX_FS_ETH "etraxfs-eth"
+#define ETRAX_FS_ETH(obj) \
+    OBJECT_CHECK(struct fs_eth, (obj), TYPE_ETRAX_FS_ETH)
+
 struct fs_eth
 {
-    SysBusDevice busdev;
+    SysBusDevice parent_obj;
+
     MemoryRegion mmio;
     NICState *nic;
     NICConf conf;
@@ -599,7 +604,7 @@  static NetClientInfo net_etraxfs_info = {
 
 static int fs_eth_init(SysBusDevice *dev)
 {
-    struct fs_eth *s = FROM_SYSBUS(typeof(*s), dev);
+    struct fs_eth *s = ETRAX_FS_ETH(dev);
 
     if (!s->dma_out || !s->dma_in) {
         hw_error("Unconnected ETRAX-FS Ethernet MAC.\n");
@@ -643,7 +648,7 @@  static void etraxfs_eth_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo etraxfs_eth_info = {
-    .name          = "etraxfs-eth",
+    .name          = TYPE_ETRAX_FS_ETH,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(struct fs_eth),
     .class_init    = etraxfs_eth_class_init,