diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-07-07 18:05:54 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-07-10 15:18:08 +0200 |
commit | 5325cc34a2ca985283134c7e264be7851b112d4e (patch) | |
tree | ba4fb68122e2dcf8860552167c56f97dc962cb00 /hw/arm/mps2-tz.c | |
parent | 1c94a351644fb2555f34e63c8ddc29f70bd4803a (diff) | |
download | qemu-5325cc34a2ca985283134c7e264be7851b112d4e.zip |
qom: Put name parameter before value / visitor parameter
The object_property_set_FOO() setters take property name and value in
an unusual order:
void object_property_set_FOO(Object *obj, FOO_TYPE value,
const char *name, Error **errp)
Having to pass value before name feels grating. Swap them.
Same for object_property_set(), object_property_get(), and
object_property_parse().
Convert callers with this Coccinelle script:
@@
identifier fun = {
object_property_get, object_property_parse, object_property_set_str,
object_property_set_link, object_property_set_bool,
object_property_set_int, object_property_set_uint, object_property_set,
object_property_set_qobject
};
expression obj, v, name, errp;
@@
- fun(obj, v, name, errp)
+ fun(obj, name, v, errp)
Chokes on hw/arm/musicpal.c's lcd_refresh() with the unhelpful error
message "no position information". Convert that one manually.
Fails to convert hw/arm/armsse.c, because Coccinelle gets confused by
ARMSSE being used both as typedef and function-like macro there.
Convert manually.
Fails to convert hw/rx/rx-gdbsim.c, because Coccinelle gets confused
by RXCPU being used both as typedef and function-like macro there.
Convert manually. The other files using RXCPU that way don't need
conversion.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200707160613.848843-27-armbru@redhat.com>
[Straightforwad conflict with commit 2336172d9b "audio: set default
value for pcspk.iobase property" resolved]
Diffstat (limited to 'hw/arm/mps2-tz.c')
-rw-r--r-- | hw/arm/mps2-tz.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index a4fd5ddede..28d9e8bfac 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -265,8 +265,8 @@ static MemoryRegion *make_mpc(MPS2TZMachineState *mms, void *opaque, memory_region_init_ram(ssram, NULL, name, ramsize[i], &error_fatal); object_initialize_child(OBJECT(mms), mpcname, mpc, TYPE_TZ_MPC); - object_property_set_link(OBJECT(mpc), OBJECT(ssram), - "downstream", &error_fatal); + object_property_set_link(OBJECT(mpc), "downstream", OBJECT(ssram), + &error_fatal); sysbus_realize(SYS_BUS_DEVICE(mpc), &error_fatal); /* Map the upstream end of the MPC into system memory */ upstream = sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 1); @@ -308,10 +308,9 @@ static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque, */ object_initialize_child(OBJECT(mms), mscname, msc, TYPE_TZ_MSC); msc_downstream = sysbus_mmio_get_region(SYS_BUS_DEVICE(&mms->iotkit), 0); - object_property_set_link(OBJECT(msc), OBJECT(msc_downstream), - "downstream", &error_fatal); - object_property_set_link(OBJECT(msc), OBJECT(mms), - "idau", &error_fatal); + object_property_set_link(OBJECT(msc), "downstream", + OBJECT(msc_downstream), &error_fatal); + object_property_set_link(OBJECT(msc), "idau", OBJECT(mms), &error_fatal); sysbus_realize(SYS_BUS_DEVICE(msc), &error_fatal); qdev_connect_gpio_out_named(DEVICE(msc), "irq", 0, @@ -330,8 +329,8 @@ static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque, msc_upstream = sysbus_mmio_get_region(SYS_BUS_DEVICE(msc), 0); object_initialize_child(OBJECT(mms), name, dma, TYPE_PL081); - object_property_set_link(OBJECT(dma), OBJECT(msc_upstream), - "downstream", &error_fatal); + object_property_set_link(OBJECT(dma), "downstream", OBJECT(msc_upstream), + &error_fatal); sysbus_realize(SYS_BUS_DEVICE(dma), &error_fatal); s = SYS_BUS_DEVICE(dma); @@ -404,8 +403,8 @@ static void mps2tz_common_init(MachineState *machine) object_initialize_child(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, mmc->armsse_type); iotkitdev = DEVICE(&mms->iotkit); - object_property_set_link(OBJECT(&mms->iotkit), OBJECT(system_memory), - "memory", &error_abort); + object_property_set_link(OBJECT(&mms->iotkit), "memory", + OBJECT(system_memory), &error_abort); qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); qdev_prop_set_uint32(iotkitdev, "MAINCLK", SYSCLK_FRQ); sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); @@ -425,7 +424,7 @@ static void mps2tz_common_init(MachineState *machine) NULL); g_free(name); - object_property_set_int(OBJECT(splitter), 2, "num-lines", + object_property_set_int(OBJECT(splitter), "num-lines", 2, &error_fatal); qdev_realize(DEVICE(splitter), NULL, &error_fatal); qdev_connect_gpio_out(DEVICE(splitter), 0, @@ -442,9 +441,9 @@ static void mps2tz_common_init(MachineState *machine) */ object_initialize_child(OBJECT(machine), "sec-resp-splitter", &mms->sec_resp_splitter, TYPE_SPLIT_IRQ); - object_property_set_int(OBJECT(&mms->sec_resp_splitter), + object_property_set_int(OBJECT(&mms->sec_resp_splitter), "num-lines", ARRAY_SIZE(mms->ppc) + ARRAY_SIZE(mms->msc), - "num-lines", &error_fatal); + &error_fatal); qdev_realize(DEVICE(&mms->sec_resp_splitter), NULL, &error_fatal); dev_splitter = DEVICE(&mms->sec_resp_splitter); qdev_connect_gpio_out_named(iotkitdev, "sec_resp_cfg", 0, @@ -475,7 +474,7 @@ static void mps2tz_common_init(MachineState *machine) */ object_initialize_child(OBJECT(mms), "uart-irq-orgate", &mms->uart_irq_orgate, TYPE_OR_IRQ); - object_property_set_int(OBJECT(&mms->uart_irq_orgate), 10, "num-lines", + object_property_set_int(OBJECT(&mms->uart_irq_orgate), "num-lines", 10, &error_fatal); qdev_realize(DEVICE(&mms->uart_irq_orgate), NULL, &error_fatal); qdev_connect_gpio_out(DEVICE(&mms->uart_irq_orgate), 0, @@ -568,8 +567,8 @@ static void mps2tz_common_init(MachineState *machine) mr = pinfo->devfn(mms, pinfo->opaque, pinfo->name, pinfo->size); portname = g_strdup_printf("port[%d]", port); - object_property_set_link(OBJECT(ppc), OBJECT(mr), - portname, &error_fatal); + object_property_set_link(OBJECT(ppc), portname, OBJECT(mr), + &error_fatal); g_free(portname); } |