From patchwork Wed Sep 16 20:25:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 33729 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0495DB7B70 for ; Thu, 17 Sep 2009 06:26:58 +1000 (EST) Received: from localhost ([127.0.0.1]:52365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mo15b-00074q-4F for incoming@patchwork.ozlabs.org; Wed, 16 Sep 2009 16:26:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mo14R-0006ih-Q0 for qemu-devel@nongnu.org; Wed, 16 Sep 2009 16:25:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mo14N-0006gM-DS for qemu-devel@nongnu.org; Wed, 16 Sep 2009 16:25:43 -0400 Received: from [199.232.76.173] (port=60807 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mo14N-0006gI-5m for qemu-devel@nongnu.org; Wed, 16 Sep 2009 16:25:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29359) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mo14M-0001Rn-ML for qemu-devel@nongnu.org; Wed, 16 Sep 2009 16:25:39 -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 n8GKPc9q023478 for ; Wed, 16 Sep 2009 16:25:38 -0400 Received: from zweiblum.home.kraxel.org (vpn2-9-132.ams2.redhat.com [10.36.9.132]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n8GKPZ9I017192; Wed, 16 Sep 2009 16:25:35 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 0A4ED700E0; Wed, 16 Sep 2009 22:25:33 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 16 Sep 2009 22:25:27 +0200 Message-Id: <1253132733-10409-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1253132733-10409-1-git-send-email-kraxel@redhat.com> References: <1253132733-10409-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 1/7] allow qdev busses allocations be inplace X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)