aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/versatilepb.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-10 07:31:58 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-15 22:00:10 +0200
commit3e80f6902c13f6edb6675c0f33edcbbf0163ec32 (patch)
treec96a01def8de48a3fc1721bfe6344b9993bfaecf /hw/arm/versatilepb.c
parentdc3edf8d8a544dbf21e1cb63339e42806470d5d9 (diff)
qdev: Convert uses of qdev_create() with Coccinelle
This is the transformation explained in the commit before previous. Takes care of just one pattern that needs conversion. More to come in this series. Coccinelle script: @ depends on !(file in "hw/arm/highbank.c")@ expression bus, type_name, dev, expr; @@ - dev = qdev_create(bus, type_name); + dev = qdev_new(type_name); ... when != dev = expr - qdev_init_nofail(dev); + qdev_realize_and_unref(dev, bus, &error_fatal); @@ expression bus, type_name, dev, expr; identifier DOWN; @@ - dev = DOWN(qdev_create(bus, type_name)); + dev = DOWN(qdev_new(type_name)); ... when != dev = expr - qdev_init_nofail(DEVICE(dev)); + qdev_realize_and_unref(DEVICE(dev), bus, &error_fatal); @@ expression bus, type_name, expr; identifier dev; @@ - DeviceState *dev = qdev_create(bus, type_name); + DeviceState *dev = qdev_new(type_name); ... when != dev = expr - qdev_init_nofail(dev); + qdev_realize_and_unref(dev, bus, &error_fatal); @@ expression bus, type_name, dev, expr, errp; symbol true; @@ - dev = qdev_create(bus, type_name); + dev = qdev_new(type_name); ... when != dev = expr - object_property_set_bool(OBJECT(dev), true, "realized", errp); + qdev_realize_and_unref(dev, bus, errp); @@ expression bus, type_name, expr, errp; identifier dev; symbol true; @@ - DeviceState *dev = qdev_create(bus, type_name); + DeviceState *dev = qdev_new(type_name); ... when != dev = expr - object_property_set_bool(OBJECT(dev), true, "realized", errp); + qdev_realize_and_unref(dev, bus, errp); The first rule exempts hw/arm/highbank.c, because it matches along two control flow paths there, with different @type_name. Covered by the next commit's manual conversions. Missing #include "qapi/error.h" added manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-10-armbru@redhat.com> [Conflicts in hw/misc/empty_slot.c and hw/sparc/leon3.c resolved]
Diffstat (limited to 'hw/arm/versatilepb.c')
-rw-r--r--hw/arm/versatilepb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index f3c4a50b19..154fa72f33 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -223,10 +223,10 @@ static void versatile_init(MachineState *machine, int board_id)
/* SDRAM at address zero. */
memory_region_add_subregion(sysmem, 0, machine->ram);
- sysctl = qdev_create(NULL, "realview_sysctl");
+ sysctl = qdev_new("realview_sysctl");
qdev_prop_set_uint32(sysctl, "sys_id", 0x41007004);
qdev_prop_set_uint32(sysctl, "proc_id", 0x02000000);
- qdev_init_nofail(sysctl);
+ qdev_realize_and_unref(sysctl, NULL, &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, 0x10000000);
dev = sysbus_create_varargs("pl190", 0x10140000,
@@ -245,9 +245,9 @@ static void versatile_init(MachineState *machine, int board_id)
sysbus_create_simple("pl050_keyboard", 0x10006000, sic[3]);
sysbus_create_simple("pl050_mouse", 0x10007000, sic[4]);
- dev = qdev_create(NULL, "versatile_pci");
+ dev = qdev_new("versatile_pci");
busdev = SYS_BUS_DEVICE(dev);
- qdev_init_nofail(dev);
+ qdev_realize_and_unref(dev, NULL, &error_fatal);
sysbus_mmio_map(busdev, 0, 0x10001000); /* PCI controller regs */
sysbus_mmio_map(busdev, 1, 0x41000000); /* PCI self-config */
sysbus_mmio_map(busdev, 2, 0x42000000); /* PCI config */
@@ -286,10 +286,10 @@ static void versatile_init(MachineState *machine, int board_id)
pl011_create(0x101f3000, pic[14], serial_hd(2));
pl011_create(0x10009000, sic[6], serial_hd(3));
- dev = qdev_create(NULL, "pl080");
+ dev = qdev_new("pl080");
object_property_set_link(OBJECT(dev), OBJECT(sysmem), "downstream",
&error_fatal);
- qdev_init_nofail(dev);
+ qdev_realize_and_unref(dev, NULL, &error_fatal);
busdev = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(busdev, 0, 0x10130000);
sysbus_connect_irq(busdev, 0, pic[17]);
@@ -319,9 +319,9 @@ static void versatile_init(MachineState *machine, int board_id)
i2c_create_slave(i2c, "ds1338", 0x68);
/* Add PL041 AACI Interface to the LM4549 codec */
- pl041 = qdev_create(NULL, "pl041");
+ pl041 = qdev_new("pl041");
qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512);
- qdev_init_nofail(pl041);
+ qdev_realize_and_unref(pl041, NULL, &error_fatal);
sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, 0x10004000);
sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, sic[24]);