From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MHI3r-0006bu-Cu for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:53:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MHI3m-0006Ue-L1 for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:53:51 -0400 Received: from [199.232.76.173] (port=53219 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MHI3m-0006UJ-Ed for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:53:46 -0400 Received: from mx2.redhat.com ([66.187.237.31]:35431) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MHI3l-0001mx-OV for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:53:46 -0400 Date: Thu, 18 Jun 2009 10:59:50 -0300 From: Glauber Costa Subject: Re: [Qemu-devel] [PATCH] replace duplicated code. Message-ID: <20090618135950.GF3517@poweredge.glommer> References: <1245279129-6768-1-git-send-email-glommer@redhat.com> <4A3A0D6C.9080002@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A3A0D6C.9080002@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Thu, Jun 18, 2009 at 11:48:28AM +0200, Gerd Hoffmann wrote: >> - dev = qdev_create(&bus->qbus, pci_nic_names[i]); >> - qdev_set_prop_int(dev, "devfn", devfn); >> - qdev_set_prop_ptr(dev, "name", (void *)pci_nic_names[i]); >> - qdev_set_netdev(dev, nd); >> - qdev_init(dev); > >> + d = pci_create_simple(bus, devfn, pci_nic_names[i]); >> + qdev_set_netdev((DeviceState *)d, nd); > > You have changed the ordering of the qdev_set_netdev and qdev_init > calls. I don't think this is correct, the init callback will not see > the nicinfo then. I see. How would you feel about changing the nd field of qdev for a void * one, call it private, or whatever? then we could have a generic qdev_set_private(dev, p), that does it for everybody. I must say I kinda dislike that specific dependency on nd for net devices. Ideally, all devices should be treated as the same.