From patchwork Tue Jun 4 18:52:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 248846 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8C7C12C0090 for ; Wed, 5 Jun 2013 05:17:04 +1000 (EST) Received: from localhost ([::1]:47828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwXX-00019G-VZ for incoming@patchwork.ozlabs.org; Tue, 04 Jun 2013 15:05:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwMn-0000Nr-W9 for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjwMn-0007t7-93 for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:57 -0400 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:57665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwMn-0007sv-2F for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:57 -0400 Received: by mail-wi0-f182.google.com with SMTP id c10so531477wiw.15 for ; Tue, 04 Jun 2013 11:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=9XEyXZYtVyfo2jWrk9tfPRsjGDe0XYXyjYssJiF5ZHc=; b=0qUxu+nCeVGyTcg25KzrEBbylyCcru5UvSdbYHx2i/I+TqfNlFSnwuncLIqkReXq1g IzaZJuzb7MNOme/0AmnG1cWIdoT6BPw/sl/cNSA5L33TwEvwSthL/2agWX41voZqVjvz cMfEREBY1clG1Hxwws+AP9rabydaPonEIJ7jPKtBkWvgeSpm6Aw9l7CO5ASQ92KGS9rY WwaSwPqwpjAXt6/TQs5uE2epDaXhnvLsrOWGLPkts69FgHVwPgw+bMAAFlSRHc4xAFxY h/tQ0LHYSloIhp1qZ272gPY46RxxvR5odKx2az391FcNYw5tVYgeFrpTk/2TRVxngq2v xJSA== X-Received: by 10.180.97.106 with SMTP id dz10mr2966953wib.2.1370372036377; Tue, 04 Jun 2013 11:53:56 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id fx7sm4590484wic.11.2013.06.04.11.53.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Jun 2013 11:53:55 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 4 Jun 2013 20:52:31 +0200 Message-Id: <1370371954-8479-37-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> References: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::236 Cc: mst@redhat.com Subject: [Qemu-devel] [PATCH 36/39] virtio-pci: split exit and instance_finalize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Paolo Bonzini --- hw/virtio/virtio-pci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index cbfec6b..61f4dcb 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -996,8 +996,14 @@ static void virtio_pci_exit(PCIDevice *pci_dev) { VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev); virtio_pci_stop_ioeventfd(proxy); - memory_region_destroy(&proxy->bar); msix_uninit_exclusive_bar(pci_dev); +} + +static void virtio_pci_instance_finalize(Object *obj) +{ + PCIDevice *pci_dev = PCI_DEVICE(obj); + VirtIOPCIProxy *proxy = VIRTIO_PCI(obj); + memory_region_destroy(&proxy->bar); msix_free(pci_dev); } @@ -1030,6 +1036,7 @@ static const TypeInfo virtio_pci_info = { .instance_size = sizeof(VirtIOPCIProxy), .class_init = virtio_pci_class_init, .class_size = sizeof(VirtioPCIClass), + .instance_finalize = virtio_pci_instance_finalize, .abstract = true, };