summaryrefslogtreecommitdiff
path: root/hw/char
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-03-02 13:20:43 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-03-02 13:20:43 +0000
commit5de090464f1ec5360c4f30faa01d8a9f8826cd58 (patch)
tree6ab14c4d57029b50bf6ec08b4b881bfad0625217 /hw/char
parent2dffe5516e74215fadf2e0f5ee401db4d5a86f7a (diff)
parent4bc6a3e54e06c47b8e23bfa3d873fa2f42dfec02 (diff)
downloadqemu-5de090464f1ec5360c4f30faa01d8a9f8826cd58.tar.gz
qemu-5de090464f1ec5360c4f30faa01d8a9f8826cd58.tar.bz2
qemu-5de090464f1ec5360c4f30faa01d8a9f8826cd58.zip
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging
QOM infrastructure fixes and device conversions * Assertion fix for device_add with non-device types * Documentation fix * qdev_init() error reporting cleanups # gpg: Signature made Tue Feb 24 13:56:33 2015 GMT using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: parallel: parallel_hds_isa_init() shouldn't fail parallel: Factor out common parallel_hds_isa_init() serial: serial_hds_isa_init() shouldn't fail serial: Factor out common serial_hds_isa_init() etsec: Replace qdev_init() by qdev_init_nofail() leon3: Replace unchecked qdev_init() by qdev_init_nofail() ide/isa: Replace unchecked qdev_init() by qdev_init_nofail() qdev: Improve qdev_init_nofail()'s error reporting qom: Fix typo, 'my_class_init' -> 'derived_class_init' qdev: Avoid type assertion in qdev_build_hotpluggable_device_list() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/parallel.c25
-rw-r--r--hw/char/serial-isa.c23
2 files changed, 40 insertions, 8 deletions
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index c2b553f0d1..4079554bb9 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -641,3 +641,28 @@ static void parallel_register_types(void)
}
type_init(parallel_register_types)
+
+static void parallel_init(ISABus *bus, int index, CharDriverState *chr)
+{
+ DeviceState *dev;
+ ISADevice *isadev;
+
+ isadev = isa_create(bus, "isa-parallel");
+ dev = DEVICE(isadev);
+ qdev_prop_set_uint32(dev, "index", index);
+ qdev_prop_set_chr(dev, "chardev", chr);
+ qdev_init_nofail(dev);
+}
+
+void parallel_hds_isa_init(ISABus *bus, int n)
+{
+ int i;
+
+ assert(n <= MAX_PARALLEL_PORTS);
+
+ for (i = 0; i < n; i++) {
+ if (parallel_hds[i]) {
+ parallel_init(bus, i, parallel_hds[i]);
+ }
+ }
+}
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index c9fcb2761f..f3db024d06 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -119,20 +119,27 @@ static void serial_register_types(void)
type_init(serial_register_types)
-bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr)
+static void serial_isa_init(ISABus *bus, int index, CharDriverState *chr)
{
DeviceState *dev;
ISADevice *isadev;
- isadev = isa_try_create(bus, TYPE_ISA_SERIAL);
- if (!isadev) {
- return false;
- }
+ isadev = isa_create(bus, TYPE_ISA_SERIAL);
dev = DEVICE(isadev);
qdev_prop_set_uint32(dev, "index", index);
qdev_prop_set_chr(dev, "chardev", chr);
- if (qdev_init(dev) < 0) {
- return false;
+ qdev_init_nofail(dev);
+}
+
+void serial_hds_isa_init(ISABus *bus, int n)
+{
+ int i;
+
+ assert(n <= MAX_SERIAL_PORTS);
+
+ for (i = 0; i < n; ++i) {
+ if (serial_hds[i]) {
+ serial_isa_init(bus, i, serial_hds[i]);
+ }
}
- return true;
}