From patchwork Wed Sep 9 14:45:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 33185 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 78F96B708C for ; Thu, 10 Sep 2009 01:00:33 +1000 (EST) Received: from localhost ([127.0.0.1]:40252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlOes-0004GS-Ic for incoming@patchwork.ozlabs.org; Wed, 09 Sep 2009 11:00:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MlOQt-000318-Bd for qemu-devel@nongnu.org; Wed, 09 Sep 2009 10:46:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MlOQn-0002xM-Vj for qemu-devel@nongnu.org; Wed, 09 Sep 2009 10:46:02 -0400 Received: from [199.232.76.173] (port=59672 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlOQn-0002x9-Bt for qemu-devel@nongnu.org; Wed, 09 Sep 2009 10:45:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52680) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MlOQm-0004fZ-Rl for qemu-devel@nongnu.org; Wed, 09 Sep 2009 10:45:57 -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 n89Eju2D013315 for ; Wed, 9 Sep 2009 10:45:56 -0400 Received: from zweiblum.home.kraxel.org (vpn2-9-67.ams2.redhat.com [10.36.9.67]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n89Ejrs0023714; Wed, 9 Sep 2009 10:45:54 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 8B68B700E5; Wed, 9 Sep 2009 16:45:48 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 9 Sep 2009 16:45:41 +0200 Message-Id: <1252507547-11398-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1252507547-11398-1-git-send-email-kraxel@redhat.com> References: <1252507547-11398-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 06/12] qdev: add isa_create() function 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 Like isa_create_simple, but doesn't call qdev_init, so one can set properties after creating and before initializing the device. Signed-off-by: Gerd Hoffmann --- hw/isa-bus.c | 15 +++++++++++++-- hw/isa.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 3cc17b2..4ecc0f8 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -109,7 +109,7 @@ void isa_qdev_register(ISADeviceInfo *info) qdev_register(&info->qdev); } -ISADevice *isa_create_simple(const char *name) +ISADevice *isa_create(const char *name) { DeviceState *dev; @@ -118,10 +118,21 @@ ISADevice *isa_create_simple(const char *name) return NULL; } dev = qdev_create(&isabus->qbus, name); - qdev_init(dev); return DO_UPCAST(ISADevice, qdev, dev); } +ISADevice *isa_create_simple(const char *name) +{ + ISADevice *dev; + + dev = isa_create(name); + if (qdev_init(&dev->qdev) != 0) { + qdev_free(&dev->qdev); + return NULL; + } + return dev; +} + static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent) { ISADevice *d = DO_UPCAST(ISADevice, qdev, dev); diff --git a/hw/isa.h b/hw/isa.h index 4582ff9..655ad62 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -27,6 +27,7 @@ void isa_bus_irqs(qemu_irq *irqs); qemu_irq isa_reserve_irq(int isairq); void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); void isa_qdev_register(ISADeviceInfo *info); +ISADevice *isa_create(const char *name); ISADevice *isa_create_simple(const char *name); extern target_phys_addr_t isa_mem_base;