From patchwork Thu Feb 3 21:01:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 81722 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]) by ozlabs.org (Postfix) with ESMTP id 48BEEB70B3 for ; Fri, 4 Feb 2011 08:18:21 +1100 (EST) Received: from localhost ([127.0.0.1]:58311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pl6TM-0004bZ-Lj for incoming@patchwork.ozlabs.org; Thu, 03 Feb 2011 16:12:12 -0500 Received: from [140.186.70.92] (port=43538 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pl6Js-0000hE-G1 for qemu-devel@nongnu.org; Thu, 03 Feb 2011 16:02:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pl6Ja-00054X-QE for qemu-devel@nongnu.org; Thu, 03 Feb 2011 16:02:07 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]:37153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pl6Ja-00054O-KS for qemu-devel@nongnu.org; Thu, 03 Feb 2011 16:02:06 -0500 Received: by pwj6 with SMTP id 6so405076pwj.4 for ; Thu, 03 Feb 2011 13:02:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=u82z/pt9zxhSXi7s3iBCYFV4ojxbXE5RPFe/Nij42sA=; b=gstT77CnMgmkVPAuQg4wm4QzsjuJCr+xlmnOEVFs0oRGdbnKmK+TxQfGlFelnYxKf1 srAfcZ082/CiUQ+V3z2V3HbHgt5RF98sEU0qDDDYWl9AJXhzIm+/tCrKus/tcWdrwEXq Z2z14RR27f4fWmXohkkaFv6ulATnWGDxo4jvI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=oKJq1pVl7w62dUYFXXulmd9zeCdPyIogpdGycpCR//lRVitvAJhDC3XBmCDJ47D/nY qmyNeYhfj8jC8cxJmjCyMqCc5cXvYeOcXMyc2bW2E1wJPsIF2zXNx+P65bn6Du7zcs6+ je13EnBKtlyZ+8RuCIGOa6f0UCyGS7fZotAdI= Received: by 10.142.142.13 with SMTP id p13mr10725334wfd.118.1296766925830; Thu, 03 Feb 2011 13:02:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.52.1 with HTTP; Thu, 3 Feb 2011 13:01:44 -0800 (PST) From: Blue Swirl Date: Thu, 3 Feb 2011 21:01:44 +0000 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.160.45 Subject: [Qemu-devel] [PATCH 07/10] isa: add creation function that may fail 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: Blue Swirl --- hw/isa-bus.c | 12 ++++++++++++ hw/isa.h | 1 + 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 0cb1afb..6f349a5 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -146,6 +146,18 @@ ISADevice *isa_create(const char *name) return DO_UPCAST(ISADevice, qdev, dev); } +ISADevice *isa_try_create(const char *name) +{ + DeviceState *dev; + + if (!isabus) { + hw_error("Tried to create isa device %s with no isa bus present.", + name); + } + dev = qdev_try_create(&isabus->qbus, name); + return DO_UPCAST(ISADevice, qdev, dev); +} + ISADevice *isa_create_simple(const char *name) { ISADevice *dev; diff --git a/hw/isa.h b/hw/isa.h index 19aa94c..e26abfa 100644 --- a/hw/isa.h +++ b/hw/isa.h @@ -32,6 +32,7 @@ void isa_init_ioport(ISADevice *dev, uint16_t ioport); void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length); void isa_qdev_register(ISADeviceInfo *info); ISADevice *isa_create(const char *name); +ISADevice *isa_try_create(const char *name); ISADevice *isa_create_simple(const char *name); extern target_phys_addr_t isa_mem_base;