prepare pci nic init path for qdev property configuration.
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 21 Oct 2009 13:25:29 +0000 (15:25 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 27 Oct 2009 17:28:38 +0000 (12:28 -0500)
Initialization path will work with both converted and not-converted
drivers, so we can convert drivers one by one.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/pci.c

index abf07ca..fe2c4bd 100644 (file)
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -859,10 +859,16 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
     dev = &pci_dev->qdev;
     if (nd->name)
         dev->id = qemu_strdup(nd->name);
-    dev->nd = nd;
+    if (qdev_prop_exists(dev, "mac")) {
+        /* qdev-ified */
+        qdev_set_nic_properties(dev, nd);
+    } else {
+        /* legacy */
+        dev->nd = nd;
+        nd->private = dev;
+    }
     if (qdev_init(dev) < 0)
         return NULL;
-    nd->private = dev;
     return pci_dev;
 }