From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mq1gz-0003nd-WB for qemu-devel@nongnu.org; Tue, 22 Sep 2009 05:29:50 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mq1gq-0003ho-T6 for qemu-devel@nongnu.org; Tue, 22 Sep 2009 05:29:47 -0400 Received: from [199.232.76.173] (port=34983 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mq1gq-0003ha-FD for qemu-devel@nongnu.org; Tue, 22 Sep 2009 05:29:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53816) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mq1gq-00089V-0d for qemu-devel@nongnu.org; Tue, 22 Sep 2009 05:29:40 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8M9TdDZ005864 for ; Tue, 22 Sep 2009 05:29:39 -0400 From: Gerd Hoffmann Date: Tue, 22 Sep 2009 11:29:23 +0200 Message-Id: <1253611767-6483-10-git-send-email-kraxel@redhat.com> In-Reply-To: <1253611767-6483-1-git-send-email-kraxel@redhat.com> References: <1253611767-6483-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 09/13] Add exit callback to DeviceInfo. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann This adds a exit callback for device destruction to DeviceInfo, so we can hook cleanups into qdev device destruction. Followup patches will put that into use. Signed-off-by: Gerd Hoffmann --- hw/qdev.c | 2 ++ hw/qdev.h | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 4931da1..a25245a 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -245,6 +245,8 @@ void qdev_free(DeviceState *dev) #endif if (dev->info->reset) qemu_unregister_reset(dev->info->reset, dev); + if (dev->info->exit) + dev->info->exit(dev); } QLIST_REMOVE(dev, sibling); qemu_free(dev); diff --git a/hw/qdev.h b/hw/qdev.h index c036aff..0db2d32 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -107,6 +107,7 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name); /*** Device API. ***/ typedef int (*qdev_initfn)(DeviceState *dev, DeviceInfo *info); +typedef int (*qdev_exitfn)(DeviceState *dev); struct DeviceInfo { const char *name; @@ -124,6 +125,7 @@ struct DeviceInfo { /* Private to qdev / bus. */ qdev_initfn init; + qdev_exitfn exit; BusInfo *bus_info; struct DeviceInfo *next; }; -- 1.6.2.5