From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTqJP-0004ul-4b for qemu-devel@nongnu.org; Thu, 01 Nov 2012 04:39:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTqJO-0008Je-6R for qemu-devel@nongnu.org; Thu, 01 Nov 2012 04:39:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTqJN-0008JR-Ts for qemu-devel@nongnu.org; Thu, 01 Nov 2012 04:39:38 -0400 Message-ID: <50923544.4090705@redhat.com> Date: Thu, 01 Nov 2012 09:39:32 +0100 From: Gerd Hoffmann MIME-Version: 1.0 References: <1351596522-8142-1-git-send-email-kraxel@redhat.com> <1351596522-8142-4-git-send-email-kraxel@redhat.com> <50914C65.8040303@suse.de> In-Reply-To: <50914C65.8040303@suse.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RfC PATCH 3/5] usb/ehci: seperate out PCIisms List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= Cc: peter.crosthwaite@xilinx.com, qemu-devel@nongnu.org Hi, >> -static int usb_ehci_initfn(PCIDevice *dev) >> +static void usb_ehci_initfn(EHCIState *s, DeviceState *dev) >> { >> - EHCIState *s = DO_UPCAST(EHCIState, dev, dev); >> +static int usb_ehci_pci_initfn(PCIDevice *dev) >> +{ >> + EHCIPCIState *i = DO_UPCAST(EHCIPCIState, pcidev, dev); > > Same as discussed for Peter's patchset, this should be using a QOM cast > macro and may need an abstract base type if there is no unique type > matching EHCIPCIState struct. --verbose please. This is exactly like it used to be. PCIDeviceClass->init() gets passed in a PCIDevice pointer and uses DO_UPCAST to get the container struct carrying the ehci state (EHCIState before the patch, EHCIPCIState now). This is common practice all over the tree. > Should I send you a follow-up to squash if this is the approach we are > going to take? If there is a new, more QOM-ish way to do the same feel free to send patches. I see that as independent cleanup though, not as something which should be squashed into this patch. cheers, Gerd