From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnrYu-0001dg-3l for qemu-devel@nongnu.org; Wed, 16 Sep 2009 06:16:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnrYp-0001cw-94 for qemu-devel@nongnu.org; Wed, 16 Sep 2009 06:16:31 -0400 Received: from [199.232.76.173] (port=45191 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnrYp-0001cs-2S for qemu-devel@nongnu.org; Wed, 16 Sep 2009 06:16:27 -0400 Date: Wed, 16 Sep 2009 13:14:03 +0300 From: "Michael S. Tsirkin" Message-ID: <20090916101403.GA4315@redhat.com> References: <20090915143319.GB24708@redhat.com> <20090915204205.GB27954@redhat.com> <4AB0043A.3040507@gnu.org> <20090915213754.GD27954@redhat.com> <4AB0BA4B.2080503@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AB0BA4B.2080503@redhat.com> Subject: [Qemu-devel] Re: [PATCH 1/2] qemu/qdev: type safety in reset handler List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Carsten Otte , Paolo Bonzini , markmc@redhat.com, qemu-devel@nongnu.org, Blue Swirl , Christian Borntraeger , Avi Kivity , Paul Brook On Wed, Sep 16, 2009 at 12:13:31PM +0200, Gerd Hoffmann wrote: > On 09/15/09 23:37, Michael S. Tsirkin wrote: >> On Tue, Sep 15, 2009 at 11:16:42PM +0200, Paolo Bonzini wrote: >>> >>> He means not introducing pci_rtl8139_reset. >>> >>> Paolo >> >> Several places in this file use the variant that gets RTL8139State, >> to me it seems nicer to have that in a single place. > > How about creating a helper macro to go from ${device}State to > DeviceState, then kill the wrapper function? i.e something like this: > > #define TO_QDEV_STATE(state) (&((state)->dev.qdev)) > > Then have one reset function which accepts DeviceState. The call sites > which have RTL8139State at hand can use rtl8139_reset(TO_QDEV_STATE(s)); > > cheers, > Gerd OK, since people feel strongly about it, I killed the reset function.