From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqUGv-0004wz-Hn for qemu-devel@nongnu.org; Wed, 23 Sep 2009 12:00:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqUGq-0004wL-Bs for qemu-devel@nongnu.org; Wed, 23 Sep 2009 12:00:48 -0400 Received: from [199.232.76.173] (port=32951 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqUGp-0004w5-Pb for qemu-devel@nongnu.org; Wed, 23 Sep 2009 12:00:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31076) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqUGp-00062Q-2c for qemu-devel@nongnu.org; Wed, 23 Sep 2009 12:00:43 -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 n8NG0fqH007137 for ; Wed, 23 Sep 2009 12:00:41 -0400 Date: Wed, 23 Sep 2009 18:58:45 +0300 From: "Michael S. Tsirkin" Subject: Re: [Qemu-devel] [PATCH 12/13] pci: move unregister from PCIDevice to PCIDeviceInfo Message-ID: <20090923155844.GB18203@redhat.com> References: <1253611767-6483-1-git-send-email-kraxel@redhat.com> <1253611767-6483-13-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1253611767-6483-13-git-send-email-kraxel@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On Tue, Sep 22, 2009 at 11:29:26AM +0200, Gerd Hoffmann wrote: > diff --git a/hw/pci.c b/hw/pci.c > index a6cd630..3221a6c 100644 > --- a/hw/pci.c > +++ b/hw/pci.c > @@ -26,6 +26,7 @@ > #include "monitor.h" > #include "net.h" > #include "sysemu.h" > +#include "msix.h" > > //#define DEBUG_PCI > #ifdef DEBUG_PCI > @@ -402,13 +403,15 @@ static void pci_unregister_io_regions(PCIDevice *pci_dev) > static int pci_unregister_device(DeviceState *dev) > { > PCIDevice *pci_dev = DO_UPCAST(PCIDevice, qdev, dev); > + PCIDeviceInfo *info = DO_UPCAST(PCIDeviceInfo, qdev, dev->info); > int ret = 0; > > - if (pci_dev->unregister) > - ret = pci_dev->unregister(pci_dev); > + if (info->exit) > + ret = info->exit(pci_dev); > if (ret) > return ret; > > + msix_uninit(pci_dev); > pci_unregister_io_regions(pci_dev); > > qemu_free_irqs(pci_dev->irq); Since devices call msix_add, I think it is cleaner to have them uninit it as well in their exit routines. -- MST