From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MuujN-0005zT-0w for qemu-devel@nongnu.org; Mon, 05 Oct 2009 17:04:29 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MuujH-0005wp-LU for qemu-devel@nongnu.org; Mon, 05 Oct 2009 17:04:28 -0400 Received: from [199.232.76.173] (port=40143 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MuujG-0005wa-Qi for qemu-devel@nongnu.org; Mon, 05 Oct 2009 17:04:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48063) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MuujG-0001Jh-6M for qemu-devel@nongnu.org; Mon, 05 Oct 2009 17:04:22 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n95L4LFZ011615 for ; Mon, 5 Oct 2009 17:04:21 -0400 Date: Mon, 5 Oct 2009 23:02:20 +0200 From: "Michael S. Tsirkin" Message-ID: <20091005210220.GA4490@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] qemu/pci: make pci not depend on msix List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kraxel@redhat.com Making pci device cleanup msix automatically makes pci.c depend on msix.c, which is IMO messy. Since devices do msix_init it's easy and natural for them to also do msix_uninit. Signed-off-by: Michael S. Tsirkin Cc: Gerd Hoffmann --- hw/pci.c | 2 -- hw/virtio-pci.c | 10 +++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 196297a..314f826 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -26,7 +26,6 @@ #include "monitor.h" #include "net.h" #include "sysemu.h" -#include "msix.h" //#define DEBUG_PCI #ifdef DEBUG_PCI @@ -442,7 +441,6 @@ static int pci_unregister_device(DeviceState *dev) if (ret) return ret; - msix_uninit(pci_dev); pci_unregister_io_regions(pci_dev); qemu_free_irqs(pci_dev->irq); diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 01782e5..e07a2a7 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -454,12 +454,17 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev) return 0; } +static int virtio_exit_pci(PCIDevice *pci_dev) +{ + return msix_uninit(pci_dev); +} + static int virtio_blk_exit_pci(PCIDevice *pci_dev) { VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); drive_uninit(proxy->dinfo); - return 0; + return virtio_exit_pci(pci_dev); } static int virtio_console_init_pci(PCIDevice *pci_dev) @@ -538,6 +543,7 @@ static PCIDeviceInfo virtio_info[] = { .qdev.name = "virtio-net-pci", .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_net_init_pci, + .exit = virtio_exit_pci, .qdev.props = (Property[]) { DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, NIC_NVECTORS_UNSPECIFIED), @@ -548,6 +554,7 @@ static PCIDeviceInfo virtio_info[] = { .qdev.name = "virtio-console-pci", .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_console_init_pci, + .exit = virtio_exit_pci, .qdev.props = (Property[]) { DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0), DEFINE_PROP_END_OF_LIST(), @@ -557,6 +564,7 @@ static PCIDeviceInfo virtio_info[] = { .qdev.name = "virtio-balloon-pci", .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_balloon_init_pci, + .exit = virtio_exit_pci, .qdev.reset = virtio_pci_reset, },{ /* end of list */ -- 1.6.5.rc2