From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MoZhW-000294-Ft for qemu-devel@nongnu.org; Fri, 18 Sep 2009 05:24:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MoZhR-000288-Uk for qemu-devel@nongnu.org; Fri, 18 Sep 2009 05:24:21 -0400 Received: from [199.232.76.173] (port=48484 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MoZhR-000283-LL for qemu-devel@nongnu.org; Fri, 18 Sep 2009 05:24:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29507) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MoZhR-0007sB-4R for qemu-devel@nongnu.org; Fri, 18 Sep 2009 05:24:17 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8I9OFSw027531 for ; Fri, 18 Sep 2009 05:24:16 -0400 From: Gerd Hoffmann Date: Fri, 18 Sep 2009 11:24:04 +0200 Message-Id: <1253265851-28919-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1253265851-28919-1-git-send-email-kraxel@redhat.com> References: <1253265851-28919-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 1/8] allow qdev busses allocations be inplace List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/qdev.c | 15 ++++++++++++--- hw/qdev.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 43b1beb..43372c1 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -502,13 +502,12 @@ static BusState *qbus_find(const char *path) } } -BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) +void qbus_create_inplace(BusState *bus, BusInfo *info, + DeviceState *parent, const char *name) { - BusState *bus; char *buf; int i,len; - bus = qemu_mallocz(info->size); bus->info = info; bus->parent = parent; @@ -537,6 +536,16 @@ BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling); parent->num_child_bus++; } + +} + +BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) +{ + BusState *bus; + + bus = qemu_mallocz(info->size); + bus->qdev_allocated = 1; + qbus_create_inplace(bus, info, parent, name); return bus; } diff --git a/hw/qdev.h b/hw/qdev.h index 623ded5..ccc45b9 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -47,6 +47,7 @@ struct BusState { DeviceState *parent; BusInfo *info; const char *name; + int qdev_allocated; QLIST_HEAD(, DeviceState) children; QLIST_ENTRY(BusState) sibling; }; @@ -144,6 +145,8 @@ BusState *qdev_get_parent_bus(DeviceState *dev); /*** BUS API. ***/ +void qbus_create_inplace(BusState *bus, BusInfo *info, + DeviceState *parent, const char *name); BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name); #define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev) -- 1.6.2.5