From: Blue Swirl Date: Sat, 5 Feb 2011 14:34:48 +0000 (+0000) Subject: isa: add creation function that may fail X-Git-Tag: v0.15.0-rc0~924 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86f4a9a5c7f1d98b73520ff9f396206ebc5ddb71;p=thirdparty%2Fqemu.git isa: add creation function that may fail Signed-off-by: Blue Swirl --- diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 0cb1afbf2e4..6f349a574a2 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 19aa94c9fd5..e26abfa0639 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;