summaryrefslogtreecommitdiffstats
path: root/hw/sparc64/sun4u.c
diff options
context:
space:
mode:
authorMarkus Armbruster2020-06-10 07:32:08 +0200
committerMarkus Armbruster2020-06-15 22:05:28 +0200
commit96927c744f9cd5205f95ef897c35695038dc2896 (patch)
tree5da3a4cb78c4ea9f2b9ae4c240d3f22d5cd24dae /hw/sparc64/sun4u.c
parentisa: New isa_new(), isa_realize_and_unref() etc. (diff)
downloadqemu-96927c744f9cd5205f95ef897c35695038dc2896.tar.gz
qemu-96927c744f9cd5205f95ef897c35695038dc2896.tar.xz
qemu-96927c744f9cd5205f95ef897c35695038dc2896.zip
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/sparc64/sun4u.c')
-rw-r--r--hw/sparc64/sun4u.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 0b898d6e3d..8470c33f99 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -300,6 +300,7 @@ static void ebus_isa_irq_handler(void *opaque, int n, int level)
static void ebus_realize(PCIDevice *pci_dev, Error **errp)
{
EbusState *s = EBUS(pci_dev);
+ ISADevice *isa_dev;
SysBusDevice *sbd;
DeviceState *dev;
qemu_irq *isa_irq;
@@ -338,7 +339,8 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
for (i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
}
- dev = DEVICE(isa_create(s->isa_bus, TYPE_ISA_FDC));
+ isa_dev = isa_new(TYPE_ISA_FDC);
+ dev = DEVICE(isa_dev);
if (fd[0]) {
qdev_prop_set_drive(dev, "driveA", blk_by_legacy_dinfo(fd[0]),
&error_abort);
@@ -348,7 +350,7 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
&error_abort);
}
qdev_prop_set_uint32(dev, "dma", -1);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, s->isa_bus, &error_fatal);
/* Power */
dev = qdev_new(TYPE_SUN4U_POWER);