From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QINuE-0006UA-1s for qemu-devel@nongnu.org; Fri, 06 May 2011 12:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QINuD-0002aE-28 for qemu-devel@nongnu.org; Fri, 06 May 2011 12:29:30 -0400 Received: from mail.codesourcery.com ([38.113.113.100]:59767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QINuC-0002Zr-KM for qemu-devel@nongnu.org; Fri, 06 May 2011 12:29:29 -0400 From: Paul Brook Date: Fri, 6 May 2011 17:29:24 +0100 References: <1304683237-26177-1-git-send-email-agraf@suse.de> <1304683237-26177-8-git-send-email-agraf@suse.de> <201105061536.13783.paul@codesourcery.com> In-Reply-To: <201105061536.13783.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201105061729.25117.paul@codesourcery.com> Subject: Re: [Qemu-devel] [PATCH 7/7] PPC: Qdev'ify e500 pci List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Scott Wood , "Edgar E. Iglesias" , Liu Yu , Alexander Graf > > PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t > > registers) { > > - PPCE500PCIState *controller; > > + DeviceState *dev; > > + PCIBus *b; > > + PCIHostState *h; > > + PPCE500PCIState *s; > > > > PCIDevice *d; > > > > - int index; > > > > static int ppce500_pci_id; > > > > + SysBusDevice *sb; > > + > > + dev = qdev_create(NULL, "e500-pcihost"); > > + sb = sysbus_from_qdev(dev); > > + h = FROM_SYSBUS(PCIHostState, sb); > > + s = DO_UPCAST(PPCE500PCIState, pci_state, h); > > + > > + b = pci_register_bus(&s->pci_state.busdev.qdev, NULL, > > No. This function should not exist. All this should be done in > e500_pcihost_initfn. Please do the qdev conversion properly. Or more precicely it should not depend on the internals of ppce500_pci.c. In principle the only public entry point in that file should be device_init(...). If used by multiple boards a simple helper function may be appropriate (e.g. smc91c111_init). Note that this helper function has no ties to the rest of that file, and could be trivially moved into a different file or replaced with a macro/inline funciton. ppce500_pci_init definitely should not be creating the PCI bus. Paul