From patchwork Fri Oct 16 13:42:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RfC,v3,08/10] prepare pci nic init path for qdev conversion Date: Fri, 16 Oct 2009 03:42:01 -0000 From: Gerd Hoffmann X-Patchwork-Id: 36221 Message-Id: <1255700523-15270-9-git-send-email-kraxel@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/pci.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index abf07ca..fe8e939 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -859,10 +859,20 @@ 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_prop_set_macaddr(dev, "mac", nd->macaddr); + if (nd->vlan) + qdev_prop_set_vlan(dev, "vlan", nd->vlan); + if (nd->netdev) + qdev_prop_set_netdev(dev, "netdev", nd->netdev); + } else { + /* legacy */ + dev->nd = nd; + nd->private = dev; + } if (qdev_init(dev) < 0) return NULL; - nd->private = dev; return pci_dev; }