From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nea80-0006zH-4q for qemu-devel@nongnu.org; Mon, 08 Feb 2010 15:22:40 -0500 Received: from [199.232.76.173] (port=56775 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nea7z-0006z6-4o for qemu-devel@nongnu.org; Mon, 08 Feb 2010 15:22:39 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nea7x-0008Ek-J3 for qemu-devel@nongnu.org; Mon, 08 Feb 2010 15:22:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51107) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nea7x-0008E4-6F for qemu-devel@nongnu.org; Mon, 08 Feb 2010 15:22:37 -0500 Date: Mon, 8 Feb 2010 22:19:19 +0200 From: "Michael S. Tsirkin" Subject: Re: [Qemu-devel] Re: [PATCH] pci: initialize header type register. Message-ID: <20100208201919.GA17088@redhat.com> References: <20100208101753.GA14662@redhat.com> <4B6FF203.6010304@redhat.com> <20100208162753.GA28230@redhat.com> <4B7048E9.6000706@redhat.com> <20100208173204.GA10716@redhat.com> <4B704BE5.9010205@redhat.com> <20100208173741.GB10716@redhat.com> <20100208182624.GD10716@redhat.com> <4B706C4E.2010508@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B706C4E.2010508@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Blue Swirl , Isaku Yamahata , qemu-devel@nongnu.org On Mon, Feb 08, 2010 at 08:55:58PM +0100, Gerd Hoffmann wrote: > Hi, > >> This still means we have two copies of same data >> and need to maintain code that keeps them in sync, >> even if that is called just at init time. > > No. There is nothing to keep in sync. And there is no extra copy of data. > > Today you have pci_set_*() calls somewhere in PCIDeviceInfo->init(). > I'd like to see them replaced with PCIDeviceInfo->$field + setup in > common code. The information that device $foo has vendor id 42 and > device id 4711 (and other properties) just moves from code to data. We still need it in config array which is read by guest. So that is two places. > It is static information, it should be static data. And having the > information in a well defined place in a data structure instead of > hidden somewhere in the ->init() code makes it alot easier to reuse the > information for something else. That is the whole point. > > cheers, > Gerd more important IMO is making code easier to follow. -- MST