Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqtH5-0006mF-7p for qemu-devel@nongnu.org; Thu, 24 Sep 2009 14:42:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqtH0-0006lx-PG for qemu-devel@nongnu.org; Thu, 24 Sep 2009 14:42:38 -0400 Received: from [199.232.76.173] (port=49065 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqtH0-0006lu-J1 for qemu-devel@nongnu.org; Thu, 24 Sep 2009 14:42:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31516) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqtH0-0005bs-4B for qemu-devel@nongnu.org; Thu, 24 Sep 2009 14:42:34 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8OIgX6U003605 for ; Thu, 24 Sep 2009 14:42:33 -0400 Subject: Re: [Qemu-devel] [PATCH 07/13] piix_pci: kill PIIX3IrqState References: <1253611767-6483-1-git-send-email-kraxel@redhat.com> <1253611767-6483-8-git-send-email-kraxel@redhat.com> From: Markus Armbruster Date: Thu, 24 Sep 2009 20:42:31 +0200 In-Reply-To: <1253611767-6483-8-git-send-email-kraxel@redhat.com> (Gerd Hoffmann's message of "Tue\, 22 Sep 2009 11\:29\:21 +0200") Message-ID: <87my4kb2w8.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Gerd Hoffmann writes: > The splitted init + irq setup for the pci bus untangles a initialization > order issue and allows to remove the PIIX3IrqState struct. We can > carry the state directly in PIIX3State insted. > > Signed-off-by: Gerd Hoffmann > --- > hw/piix_pci.c | 37 +++++++++++++++++-------------------- > 1 files changed, 17 insertions(+), 20 deletions(-) > > diff --git a/hw/piix_pci.c b/hw/piix_pci.c > index edd6df0..0be3b02 100644 > --- a/hw/piix_pci.c > +++ b/hw/piix_pci.c [...] > @@ -232,23 +228,24 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq * > PCIBus *b; > PCIDevice *d; > I440FXState *s; > - PIIX3IrqState *irq_state = qemu_malloc(sizeof(*irq_state)); > + PIIX3State *piix3; > > - irq_state->pic = pic; > dev = qdev_create(NULL, "i440FX-pcihost"); > s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev)); > - b = pci_register_bus(&s->busdev.qdev, "pci.0", > - piix3_set_irq, pci_slot_get_pirq, irq_state, 0, 4); > + b = pci_bus_new(&s->busdev.qdev, NULL, 0); Passes null name to pci_bus_new(). Intentional? Before, we passed "pci.0" to pci_register_bus(). > s->bus = b; > qdev_init(dev); > > d = pci_create_simple(b, 0, "i440FX"); > *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d); > - (*pi440fx_state)->irq_state = irq_state; > > - irq_state->piix3 = DO_UPCAST(PIIX3State, dev, > + piix3 = DO_UPCAST(PIIX3State, dev, > pci_create_simple(b, -1, "PIIX3")); > - *piix3_devfn = irq_state->piix3->dev.devfn; > + piix3->pic = pic; > + pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3, 4); > + (*pi440fx_state)->piix3 = piix3; > + > + *piix3_devfn = piix3->dev.devfn; > > return b; > } [...]