aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc
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/ppc
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/ppc')
-rw-r--r--hw/ppc/prep.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index c7af0e1..73a40b2 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -244,6 +244,7 @@ static void ibm_40p_init(MachineState *machine)
SysBusDevice *pcihost, *s;
Nvram *m48t59 = NULL;
PCIBus *pci_bus;
+ ISADevice *isa_dev;
ISABus *isa_bus;
void *fw_cfg;
int i;
@@ -292,14 +293,16 @@ static void ibm_40p_init(MachineState *machine)
isa_bus = ISA_BUS(qdev_get_child_bus(i82378_dev, "isa.0"));
/* Memory controller */
- dev = DEVICE(isa_create(isa_bus, "rs6000-mc"));
+ isa_dev = isa_new("rs6000-mc");
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "ram-size", machine->ram_size);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
/* RTC */
- dev = DEVICE(isa_create(isa_bus, TYPE_MC146818_RTC));
+ isa_dev = isa_new(TYPE_MC146818_RTC);
+ dev = DEVICE(isa_dev);
qdev_prop_set_int32(dev, "base_year", 1900);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
/* initialize CMOS checksums */
cmos_checksum = 0x6aa9;
@@ -310,19 +313,22 @@ static void ibm_40p_init(MachineState *machine)
if (defaults_enabled()) {
m48t59 = NVRAM(isa_create_simple(isa_bus, "isa-m48t59"));
- dev = DEVICE(isa_create(isa_bus, "cs4231a"));
+ isa_dev = isa_new("cs4231a");
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "iobase", 0x830);
qdev_prop_set_uint32(dev, "irq", 10);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
- dev = DEVICE(isa_create(isa_bus, "pc87312"));
+ isa_dev = isa_new("pc87312");
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "config", 12);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
- dev = DEVICE(isa_create(isa_bus, "prep-systemio"));
+ isa_dev = isa_new("prep-systemio");
+ dev = DEVICE(isa_dev);
qdev_prop_set_uint32(dev, "ibm-planar-id", 0xfc);
qdev_prop_set_uint32(dev, "equipment", 0xc0);
- qdev_init_nofail(dev);
+ isa_realize_and_unref(isa_dev, isa_bus, &error_fatal);
dev = DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(1, 0),
"lsi53c810"));