From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrGhB-0006Qz-F3 for qemu-devel@nongnu.org; Fri, 25 Sep 2009 15:43:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrGh4-0006L9-6a for qemu-devel@nongnu.org; Fri, 25 Sep 2009 15:43:07 -0400 Received: from [199.232.76.173] (port=56042 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrGh3-0006Ko-Px for qemu-devel@nongnu.org; Fri, 25 Sep 2009 15:43:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19380) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MrGh3-0004d9-81 for qemu-devel@nongnu.org; Fri, 25 Sep 2009 15:43:01 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8PJh05N024375 for ; Fri, 25 Sep 2009 15:43:00 -0400 From: Gerd Hoffmann Date: Fri, 25 Sep 2009 21:42:35 +0200 Message-Id: <1253907769-1067-11-git-send-email-kraxel@redhat.com> In-Reply-To: <1253907769-1067-1-git-send-email-kraxel@redhat.com> References: <1253907769-1067-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 10/24] 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