From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnrWm-0000yW-Dv for qemu-devel@nongnu.org; Wed, 16 Sep 2009 06:14:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnrWh-0000xG-8T for qemu-devel@nongnu.org; Wed, 16 Sep 2009 06:14:19 -0400 Received: from [199.232.76.173] (port=35567 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnrWg-0000xB-Vk for qemu-devel@nongnu.org; Wed, 16 Sep 2009 06:14:15 -0400 Message-ID: <4AB0BA4B.2080503@redhat.com> Date: Wed, 16 Sep 2009 12:13:31 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <20090915143319.GB24708@redhat.com> <20090915204205.GB27954@redhat.com> <4AB0043A.3040507@gnu.org> <20090915213754.GD27954@redhat.com> In-Reply-To: <20090915213754.GD27954@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: "Michael S. Tsirkin" Cc: Carsten Otte , Paolo Bonzini , markmc@redhat.com, qemu-devel@nongnu.org, Blue Swirl , Christian Borntraeger , Avi Kivity , Paul Brook 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