From patchwork Fri Oct 16 13:42:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 36221 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E2DD2B7BB4 for ; Sat, 17 Oct 2009 01:27:25 +1100 (EST) Received: from localhost ([127.0.0.1]:37737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mynm5-0004Ac-M2 for incoming@patchwork.ozlabs.org; Fri, 16 Oct 2009 10:27:21 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Myn4Y-0001uZ-BS for qemu-devel@nongnu.org; Fri, 16 Oct 2009 09:42:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Myn4Q-0001qy-BU for qemu-devel@nongnu.org; Fri, 16 Oct 2009 09:42:19 -0400 Received: from [199.232.76.173] (port=40521 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Myn4P-0001qZ-L7 for qemu-devel@nongnu.org; Fri, 16 Oct 2009 09:42:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17420) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Myn4P-0007nd-8B for qemu-devel@nongnu.org; Fri, 16 Oct 2009 09:42:13 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9GDgCfO029389 for ; Fri, 16 Oct 2009 09:42:12 -0400 Received: from zweiblum.home.kraxel.org (vpn2-9-112.ams2.redhat.com [10.36.9.112]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n9GDg9xs028750; Fri, 16 Oct 2009 09:42:10 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 1A8E470104; Fri, 16 Oct 2009 15:42:04 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Oct 2009 15:42:01 +0200 Message-Id: <1255700523-15270-9-git-send-email-kraxel@redhat.com> In-Reply-To: <1255700523-15270-1-git-send-email-kraxel@redhat.com> References: <1255700523-15270-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [RfC PATCH v3 08/10] prepare pci nic init path for qdev conversion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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; }