Patchwork [04/27] qdev: don't access name through info

login
register
mail settings
Submitter Anthony Liguori
Date Dec. 20, 2011, 4:51 p.m.
Message ID <1324399916-21315-5-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/132452/
State New
Headers show

Comments

Anthony Liguori - Dec. 20, 2011, 4:51 p.m.
We already have a QOM interface for this so let's use it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/e1000.c              |    2 +-
 hw/eepro100.c           |    2 +-
 hw/etraxfs_eth.c        |    2 +-
 hw/hda-audio.c          |    2 +-
 hw/intel-hda.c          |    2 +-
 hw/lan9118.c            |    2 +-
 hw/milkymist-minimac2.c |    2 +-
 hw/mipsnet.c            |    2 +-
 hw/musicpal.c           |    2 +-
 hw/ne2000-isa.c         |    2 +-
 hw/ne2000.c             |    2 +-
 hw/opencores_eth.c      |    2 +-
 hw/pci.c                |    2 +-
 hw/pcnet.c              |    2 +-
 hw/qdev-properties.c    |   16 ++++++++--------
 hw/qdev.c               |   16 ++++++++--------
 hw/rtl8139.c            |    2 +-
 hw/smc91c111.c          |    2 +-
 hw/spapr_llan.c         |    2 +-
 hw/stellaris_enet.c     |    2 +-
 hw/usb-bus.c            |    2 +-
 hw/usb-net.c            |    2 +-
 hw/usb-ohci.c           |    2 +-
 hw/virtio-net.c         |    2 +-
 hw/xilinx_axienet.c     |    2 +-
 hw/xilinx_ethlite.c     |    2 +-
 26 files changed, 40 insertions(+), 40 deletions(-)

Patch

diff --git a/hw/e1000.c b/hw/e1000.c
index 7e17d85..c5227ad 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1174,7 +1174,7 @@  static int pci_e1000_init(PCIDevice *pci_dev)
     d->eeprom_data[EEPROM_CHECKSUM_REG] = checksum;
 
     d->nic = qemu_new_nic(&net_e1000_info, &d->conf,
-                          qdev_get_info(&d->dev.qdev)->name, d->dev.qdev.id, d);
+                          object_get_type(OBJECT(d)), d->dev.qdev.id, d);
 
     qemu_format_nic_info_str(&d->nic->nc, macaddr);
 
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 81a32b8..f7d9eae 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1878,7 +1878,7 @@  static int e100_nic_init(PCIDevice *pci_dev)
     nic_reset(s);
 
     s->nic = qemu_new_nic(&net_eepro100_info, &s->conf,
-                          qdev_get_info(&pci_dev->qdev)->name, pci_dev->qdev.id, s);
+                          object_get_type(OBJECT(pci_dev)), pci_dev->qdev.id, s);
 
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
     TRACE(OTHER, logout("%s\n", s->nic->nc.info_str));
diff --git a/hw/etraxfs_eth.c b/hw/etraxfs_eth.c
index b525258..281a254 100644
--- a/hw/etraxfs_eth.c
+++ b/hw/etraxfs_eth.c
@@ -605,7 +605,7 @@  static int fs_eth_init(SysBusDevice *dev)
 
 	qemu_macaddr_default_if_unset(&s->conf.macaddr);
 	s->nic = qemu_new_nic(&net_etraxfs_info, &s->conf,
-			      dev->qdev.info->name, dev->qdev.id, s);
+			      object_get_type(OBJECT(s)), dev->qdev.id, s);
 	qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
 
 	tdk_init(&s->phy);
diff --git a/hw/hda-audio.c b/hw/hda-audio.c
index 0bc0a25..ffdd799 100644
--- a/hw/hda-audio.c
+++ b/hw/hda-audio.c
@@ -777,7 +777,7 @@  static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc)
     uint32_t i, type;
 
     a->desc = desc;
-    a->name = qdev_get_info(&a->hda.qdev)->name;
+    a->name = object_get_type(OBJECT(a));
     dprint(a, 1, "%s: cad %d\n", __FUNCTION__, a->hda.cad);
 
     AUD_register_card("hda", &a->card);
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 12dcc84..1b42e10 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -1129,7 +1129,7 @@  static int intel_hda_init(PCIDevice *pci)
     IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci);
     uint8_t *conf = d->pci.config;
 
-    d->name = qdev_get_info(&d->pci.qdev)->name;
+    d->name = object_get_type(OBJECT(d));
 
     pci_config_set_interrupt_pin(conf, 1);
 
diff --git a/hw/lan9118.c b/hw/lan9118.c
index 7e64c5d..6f2e0b1 100644
--- a/hw/lan9118.c
+++ b/hw/lan9118.c
@@ -1137,7 +1137,7 @@  static int lan9118_init1(SysBusDevice *dev)
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
 
     s->nic = qemu_new_nic(&net_lan9118_info, &s->conf,
-                          dev->qdev.info->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
     s->eeprom[0] = 0xa5;
     for (i = 0; i < 6; i++) {
diff --git a/hw/milkymist-minimac2.c b/hw/milkymist-minimac2.c
index b5e0dac..370f0ec 100644
--- a/hw/milkymist-minimac2.c
+++ b/hw/milkymist-minimac2.c
@@ -478,7 +478,7 @@  static int milkymist_minimac2_init(SysBusDevice *dev)
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_milkymist_minimac2_info, &s->conf,
-                          dev->qdev.info->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
 
     return 0;
diff --git a/hw/mipsnet.c b/hw/mipsnet.c
index b1234b8..f218c6b 100644
--- a/hw/mipsnet.c
+++ b/hw/mipsnet.c
@@ -240,7 +240,7 @@  static int mipsnet_sysbus_init(SysBusDevice *dev)
     sysbus_init_irq(dev, &s->irq);
 
     s->nic = qemu_new_nic(&net_mipsnet_info, &s->conf,
-                          dev->qdev.info->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
 
     return 0;
diff --git a/hw/musicpal.c b/hw/musicpal.c
index 3c6cefe..77814b0 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -383,7 +383,7 @@  static int mv88w8618_eth_init(SysBusDevice *dev)
 
     sysbus_init_irq(dev, &s->irq);
     s->nic = qemu_new_nic(&net_mv88w8618_info, &s->conf,
-                          dev->qdev.info->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     memory_region_init_io(&s->iomem, &mv88w8618_eth_ops, s, "mv88w8618-eth",
                           MP_ETH_SIZE);
     sysbus_init_mmio(dev, &s->iomem);
diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c
index 60dc333..9e89256 100644
--- a/hw/ne2000-isa.c
+++ b/hw/ne2000-isa.c
@@ -76,7 +76,7 @@  static int isa_ne2000_initfn(ISADevice *dev)
     ne2000_reset(s);
 
     s->nic = qemu_new_nic(&net_ne2000_isa_info, &s->c,
-                          qdev_get_info(&dev->qdev)->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->c.macaddr.a);
 
     return 0;
diff --git a/hw/ne2000.c b/hw/ne2000.c
index d016b8e..16dcee2 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -760,7 +760,7 @@  static int pci_ne2000_init(PCIDevice *pci_dev)
     ne2000_reset(s);
 
     s->nic = qemu_new_nic(&net_ne2000_info, &s->c,
-                          qdev_get_info(&pci_dev->qdev)->name, pci_dev->qdev.id, s);
+                          object_get_type(OBJECT(pci_dev)), pci_dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->c.macaddr.a);
 
     if (!pci_dev->qdev.hotplugged) {
diff --git a/hw/opencores_eth.c b/hw/opencores_eth.c
index f7cc1b4..5ce12a0 100644
--- a/hw/opencores_eth.c
+++ b/hw/opencores_eth.c
@@ -717,7 +717,7 @@  static int sysbus_open_eth_init(SysBusDevice *dev)
     sysbus_init_irq(dev, &s->irq);
 
     s->nic = qemu_new_nic(&net_open_eth_info, &s->conf,
-                          s->dev.qdev.info->name, s->dev.qdev.id, s);
+                          object_get_type(OBJECT(s)), s->dev.qdev.id, s);
     return 0;
 }
 
diff --git a/hw/pci.c b/hw/pci.c
index 2c291a8..4fc46c2 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1765,7 +1765,7 @@  static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
     if (qdev_get_info(&pdev->qdev)->vmsd)
         snprintf(name, sizeof(name), "%s.rom", qdev_get_info(&pdev->qdev)->vmsd->name);
     else
-        snprintf(name, sizeof(name), "%s.rom", qdev_get_info(&pdev->qdev)->name);
+        snprintf(name, sizeof(name), "%s.rom", object_get_type(OBJECT(pdev)));
     pdev->has_rom = true;
     memory_region_init_ram(&pdev->rom, &pdev->qdev, name, size);
     ptr = memory_region_get_ram_ptr(&pdev->rom);
diff --git a/hw/pcnet.c b/hw/pcnet.c
index e58b195..c3bf405 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1718,7 +1718,7 @@  int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info)
     s->poll_timer = qemu_new_timer_ns(vm_clock, pcnet_poll_timer, s);
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
-    s->nic = qemu_new_nic(info, &s->conf, qdev_get_info(dev)->name, dev->id, s);
+    s->nic = qemu_new_nic(info, &s->conf, object_get_type(OBJECT(dev)), dev->id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
 
     add_boot_device_path(s->conf.bootindex, dev, "/ethernet-phy@0");
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index a11127f..c9b3423 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -978,16 +978,16 @@  void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
     switch (ret) {
     case -EEXIST:
         error_set(errp, QERR_PROPERTY_VALUE_IN_USE,
-                  qdev_get_info(dev)->name, prop->name, value);
+                  object_get_type(OBJECT(dev)), prop->name, value);
         break;
     default:
     case -EINVAL:
         error_set(errp, QERR_PROPERTY_VALUE_BAD,
-                  qdev_get_info(dev)->name, prop->name, value);
+                  object_get_type(OBJECT(dev)), prop->name, value);
         break;
     case -ENOENT:
         error_set(errp, QERR_PROPERTY_VALUE_NOT_FOUND,
-                  qdev_get_info(dev)->name, prop->name, value);
+                  object_get_type(OBJECT(dev)), prop->name, value);
         break;
     case 0:
         break;
@@ -1007,7 +1007,7 @@  int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
      * removed along with it.
      */
     if (!prop || !prop->info->parse) {
-        qerror_report(QERR_PROPERTY_NOT_FOUND, qdev_get_info(dev)->name, name);
+        qerror_report(QERR_PROPERTY_NOT_FOUND, object_get_type(OBJECT(dev)), name);
         return -1;
     }
     ret = prop->info->parse(dev, prop, value);
@@ -1028,12 +1028,12 @@  void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyT
     prop = qdev_prop_find(dev, name);
     if (!prop) {
         fprintf(stderr, "%s: property \"%s.%s\" not found\n",
-                __FUNCTION__, qdev_get_info(dev)->name, name);
+                __FUNCTION__, object_get_type(OBJECT(dev)), name);
         abort();
     }
     if (prop->info->type != type) {
         fprintf(stderr, "%s: property \"%s.%s\" type mismatch\n",
-                __FUNCTION__, qdev_get_info(dev)->name, name);
+                __FUNCTION__, object_get_type(OBJECT(dev)), name);
         abort();
     }
     qdev_prop_cpy(dev, prop, src);
@@ -1082,7 +1082,7 @@  int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *va
     if (res < 0) {
         error_report("Can't attach drive %s to %s.%s: %s",
                      bdrv_get_device_name(value),
-                     dev->id ? dev->id : qdev_get_info(dev)->name,
+                     dev->id ? dev->id : object_get_type(OBJECT(dev)),
                      name, strerror(-res));
         return -1;
     }
@@ -1154,7 +1154,7 @@  void qdev_prop_set_globals(DeviceState *dev)
     GlobalProperty *prop;
 
     QTAILQ_FOREACH(prop, &global_props, next) {
-        if (strcmp(qdev_get_info(dev)->name, prop->driver) != 0 &&
+        if (strcmp(object_get_type(OBJECT(dev)), prop->driver) != 0 &&
             strcmp(qdev_get_info(dev)->bus_info->name, prop->driver) != 0) {
             continue;
         }
diff --git a/hw/qdev.c b/hw/qdev.c
index 1b25304..5d63c10 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -692,7 +692,7 @@  static void qbus_list_bus(DeviceState *dev)
     const char *sep = " ";
 
     error_printf("child busses at \"%s\":",
-                 dev->id ? dev->id : qdev_get_info(dev)->name);
+                 dev->id ? dev->id : object_get_type(OBJECT(dev)));
     QLIST_FOREACH(child, &dev->child_bus, sibling) {
         error_printf("%s\"%s\"", sep, child->name);
         sep = ", ";
@@ -707,7 +707,7 @@  static void qbus_list_dev(BusState *bus)
 
     error_printf("devices at \"%s\":", bus->name);
     QTAILQ_FOREACH(dev, &bus->children, sibling) {
-        error_printf("%s\"%s\"", sep, qdev_get_info(dev)->name);
+        error_printf("%s\"%s\"", sep, object_get_type(OBJECT(dev)));
         if (dev->id)
             error_printf("/\"%s\"", dev->id);
         sep = ", ";
@@ -743,7 +743,7 @@  static DeviceState *qbus_find_dev(BusState *bus, char *elem)
         }
     }
     QTAILQ_FOREACH(dev, &bus->children, sibling) {
-        if (strcmp(qdev_get_info(dev)->name, elem) == 0) {
+        if (strcmp(object_get_type(OBJECT(dev)), elem) == 0) {
             return dev;
         }
     }
@@ -950,7 +950,7 @@  static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props,
 static void qdev_print(Monitor *mon, DeviceState *dev, int indent)
 {
     BusState *child;
-    qdev_printf("dev: %s, id \"%s\"\n", qdev_get_info(dev)->name,
+    qdev_printf("dev: %s, id \"%s\"\n", object_get_type(OBJECT(dev)),
                 dev->id ? dev->id : "");
     indent += 2;
     if (dev->num_gpio_in) {
@@ -1040,7 +1040,7 @@  static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
             l += snprintf(p + l, size - l, "%s", d);
             g_free(d);
         } else {
-            l += snprintf(p + l, size - l, "%s", qdev_get_info(dev)->name);
+            l += snprintf(p + l, size - l, "%s", object_get_type(OBJECT(dev)));
         }
     }
     l += snprintf(p + l , size - l, "/");
@@ -1062,7 +1062,7 @@  char* qdev_get_fw_dev_path(DeviceState *dev)
 
 char *qdev_get_type(DeviceState *dev, Error **errp)
 {
-    return g_strdup(qdev_get_info(dev)->name);
+    return g_strdup(object_get_type(OBJECT(dev)));
 }
 
 void qdev_ref(DeviceState *dev)
@@ -1264,7 +1264,7 @@  void qdev_property_add_child(DeviceState *dev, const char *name,
 {
     gchar *type;
 
-    type = g_strdup_printf("child<%s>", qdev_get_info(child)->name);
+    type = g_strdup_printf("child<%s>", object_get_type(OBJECT(child)));
 
     qdev_property_add(dev, name, type, qdev_get_child_property,
                       NULL, NULL, child, errp);
@@ -1315,7 +1315,7 @@  static void qdev_set_link_property(DeviceState *dev, Visitor *v, void *opaque,
         if (target) {
             gchar *target_type;
 
-            target_type = g_strdup_printf("link<%s>", qdev_get_info(target)->name);
+            target_type = g_strdup_printf("link<%s>", object_get_type(OBJECT(target)));
             if (strcmp(target_type, type) == 0) {
                 *child = target;
                 qdev_ref(target);
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index 16d948e..55d1d3c 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3478,7 +3478,7 @@  static int pci_rtl8139_init(PCIDevice *dev)
     s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8;
 
     s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf,
-                          qdev_get_info(&dev->qdev)->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
 
     s->cplus_txbuffer = NULL;
diff --git a/hw/smc91c111.c b/hw/smc91c111.c
index 82b8811..ca9ba75 100644
--- a/hw/smc91c111.c
+++ b/hw/smc91c111.c
@@ -752,7 +752,7 @@  static int smc91c111_init1(SysBusDevice *dev)
     sysbus_init_irq(dev, &s->irq);
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_smc91c111_info, &s->conf,
-                          dev->qdev.info->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
     /* ??? Save/restore.  */
     return 0;
diff --git a/hw/spapr_llan.c b/hw/spapr_llan.c
index 45674c4..0a6a21d 100644
--- a/hw/spapr_llan.c
+++ b/hw/spapr_llan.c
@@ -189,7 +189,7 @@  static int spapr_vlan_init(VIOsPAPRDevice *sdev)
     qemu_macaddr_default_if_unset(&dev->nicconf.macaddr);
 
     dev->nic = qemu_new_nic(&net_spapr_vlan_info, &dev->nicconf,
-                            sdev->qdev.info->name, sdev->qdev.id, dev);
+                            object_get_type(OBJECT(sdev)), sdev->qdev.id, dev);
     qemu_format_nic_info_str(&dev->nic->nc, dev->nicconf.macaddr.a);
 
     return 0;
diff --git a/hw/stellaris_enet.c b/hw/stellaris_enet.c
index 866c9a2..e6846f4 100644
--- a/hw/stellaris_enet.c
+++ b/hw/stellaris_enet.c
@@ -411,7 +411,7 @@  static int stellaris_enet_init(SysBusDevice *dev)
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
 
     s->nic = qemu_new_nic(&net_stellaris_enet_info, &s->conf,
-                          dev->qdev.info->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
 
     stellaris_enet_reset(s);
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 71ef794..23691be 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -249,7 +249,7 @@  int usb_claim_port(USBDevice *dev)
             return -1;
         }
     } else {
-        if (bus->nfree == 1 && strcmp(qdev_get_info(&dev->qdev)->name, "usb-hub") != 0) {
+        if (bus->nfree == 1 && strcmp(object_get_type(OBJECT(dev)), "usb-hub") != 0) {
             /* Create a new hub and chain it on */
             usb_create_simple(bus, "usb-hub");
         }
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 710c4d9..9969598 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1351,7 +1351,7 @@  static int usb_net_initfn(USBDevice *dev)
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_usbnet_info, &s->conf,
-                          qdev_get_info(&s->dev.qdev)->name, s->dev.qdev.id, s);
+                          object_get_type(OBJECT(s)), s->dev.qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
     snprintf(s->usbstring_mac, sizeof(s->usbstring_mac),
              "%02x%02x%02x%02x%02x%02x",
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 833fa7c..eb8c8a4 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1775,7 +1775,7 @@  static int usb_ohci_init(OHCIState *ohci, DeviceState *dev,
     memory_region_init_io(&ohci->mem, &ohci_mem_ops, ohci, "ohci", 256);
     ohci->localmem_base = localmem_base;
 
-    ohci->name = qdev_get_info(dev)->name;
+    ohci->name = object_get_type(OBJECT(dev));
     usb_packet_init(&ohci->usb_packet);
 
     ohci->async_td = 0;
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 6c785d0..dd5da0b 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -1030,7 +1030,7 @@  VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
     memcpy(&n->mac[0], &conf->macaddr, sizeof(n->mac));
     n->status = VIRTIO_NET_S_LINK_UP;
 
-    n->nic = qemu_new_nic(&net_virtio_info, conf, qdev_get_info(dev)->name, dev->id, n);
+    n->nic = qemu_new_nic(&net_virtio_info, conf, object_get_type(OBJECT(dev)), dev->id, n);
 
     qemu_format_nic_info_str(&n->nic->nc, conf->macaddr.a);
 
diff --git a/hw/xilinx_axienet.c b/hw/xilinx_axienet.c
index a2eb3e6..f68c4a0 100644
--- a/hw/xilinx_axienet.c
+++ b/hw/xilinx_axienet.c
@@ -856,7 +856,7 @@  static int xilinx_enet_init(SysBusDevice *dev)
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_xilinx_enet_info, &s->conf,
-                          dev->qdev.info->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
 
     tdk_init(&s->TEMAC.phy);
diff --git a/hw/xilinx_ethlite.c b/hw/xilinx_ethlite.c
index 6777254..a0ef139 100644
--- a/hw/xilinx_ethlite.c
+++ b/hw/xilinx_ethlite.c
@@ -221,7 +221,7 @@  static int xilinx_ethlite_init(SysBusDevice *dev)
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf,
-                          dev->qdev.info->name, dev->qdev.id, s);
+                          object_get_type(OBJECT(dev)), dev->qdev.id, s);
     qemu_format_nic_info_str(&s->nic->nc, s->conf.macaddr.a);
     return 0;
 }