aboutsummaryrefslogtreecommitdiff
path: root/hw/isa
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-10 07:32:08 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-15 22:05:28 +0200
commit96927c744f9cd5205f95ef897c35695038dc2896 (patch)
tree5da3a4cb78c4ea9f2b9ae4c240d3f22d5cd24dae /hw/isa
parent0fe9d9011971820b2dab27aa49cfb957b91cc3e2 (diff)
downloadqemu-96927c744f9cd5205f95ef897c35695038dc2896.zip
qemu-96927c744f9cd5205f95ef897c35695038dc2896.tar.gz
qemu-96927c744f9cd5205f95ef897c35695038dc2896.tar.bz2
isa: Convert uses of isa_create() with Coccinelle
Replace dev = isa_create(bus, type_name); ... qdev_init_nofail(dev); by dev = isa_new(type_name); ... isa_realize_and_unref(dev, bus, &error_fatal); Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains why. Coccinelle script: @@ expression dev, bus, expr; expression list args; expression d; @@ - dev = isa_create(bus, args); + dev = isa_new(args); ( d = &dev->qdev; | d = DEVICE(dev); ) ... when != dev = expr - qdev_init_nofail(d); + isa_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev = isa_create(bus, args); + dev = isa_new(args); ... when != dev = expr - qdev_init_nofail(DEVICE(dev)); + isa_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev = DEVICE(isa_create(bus, args)); + ISADevice *isa_dev; // TODO move + isa_dev = isa_new(args); + dev = DEVICE(isa_dev); ... when != dev = expr - qdev_init_nofail(dev); + isa_realize_and_unref(isa_dev, bus, &error_fatal); Missing #include "qapi/error.h" added manually, whitespace changes minimized manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-20-armbru@redhat.com>
Diffstat (limited to 'hw/isa')
-rw-r--r--hw/isa/isa-bus.c4
-rw-r--r--hw/isa/isa-superio.c20
2 files changed, 12 insertions, 12 deletions
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index e6412d3..9a95ac3 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -190,8 +190,8 @@ ISADevice *isa_create_simple(ISABus *bus, const char *name)
{
ISADevice *dev;
- dev = isa_create(bus, name);
- qdev_init_nofail(DEVICE(dev));
+ dev = isa_new(name);
+ isa_realize_and_unref(dev, bus, &error_fatal);
return dev;
}
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index 3dcdc23..d3d58f9 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -51,7 +51,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
} else {
name = g_strdup_printf("parallel%d", i);
}
- isa = isa_create(bus, "isa-parallel");
+ isa = isa_new("isa-parallel");
d = DEVICE(isa);
qdev_prop_set_uint32(d, "index", i);
if (k->parallel.get_iobase) {
@@ -63,7 +63,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
}
qdev_prop_set_chr(d, "chardev", chr);
object_property_add_child(OBJECT(dev), name, OBJECT(isa));
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa, bus, &error_fatal);
sio->parallel[i] = isa;
trace_superio_create_parallel(i,
k->parallel.get_iobase ?
@@ -90,7 +90,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
} else {
name = g_strdup_printf("serial%d", i);
}
- isa = isa_create(bus, TYPE_ISA_SERIAL);
+ isa = isa_new(TYPE_ISA_SERIAL);
d = DEVICE(isa);
qdev_prop_set_uint32(d, "index", i);
if (k->serial.get_iobase) {
@@ -102,7 +102,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
}
qdev_prop_set_chr(d, "chardev", chr);
object_property_add_child(OBJECT(dev), name, OBJECT(isa));
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa, bus, &error_fatal);
sio->serial[i] = isa;
trace_superio_create_serial(i,
k->serial.get_iobase ?
@@ -115,7 +115,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
/* Floppy disc */
if (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0)) {
- isa = isa_create(bus, "isa-fdc");
+ isa = isa_new("isa-fdc");
d = DEVICE(isa);
if (k->floppy.get_iobase) {
qdev_prop_set_uint32(d, "iobase", k->floppy.get_iobase(sio, 0));
@@ -136,7 +136,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
&error_fatal);
}
object_property_add_child(OBJECT(sio), "isa-fdc", OBJECT(isa));
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa, bus, &error_fatal);
sio->floppy = isa;
trace_superio_create_floppy(0,
k->floppy.get_iobase ?
@@ -146,14 +146,14 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
}
/* Keyboard, mouse */
- isa = isa_create(bus, TYPE_I8042);
+ isa = isa_new(TYPE_I8042);
object_property_add_child(OBJECT(sio), TYPE_I8042, OBJECT(isa));
- qdev_init_nofail(DEVICE(isa));
+ isa_realize_and_unref(isa, bus, &error_fatal);
sio->kbc = isa;
/* IDE */
if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled(sio, 0))) {
- isa = isa_create(bus, "isa-ide");
+ isa = isa_new("isa-ide");
d = DEVICE(isa);
if (k->ide.get_iobase) {
qdev_prop_set_uint32(d, "iobase", k->ide.get_iobase(sio, 0));
@@ -164,7 +164,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
if (k->ide.get_irq) {
qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0));
}
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa, bus, &error_fatal);
object_property_add_child(OBJECT(sio), "isa-ide", OBJECT(isa));
sio->ide = isa;
trace_superio_create_ide(0,