sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 3

These are init/realize pairs produced by the previous commit's
Coccinelle script where the argument test doesn't quite match.  They
need even more careful review.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-50-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2020-06-10 07:32:38 +02:00
parent db873cc5d1
commit 5a147c8c51
8 changed files with 35 additions and 44 deletions

View file

@ -39,21 +39,21 @@ static void microbit_init(MachineState *machine)
Object *soc = OBJECT(&s->nrf51);
Object *i2c = OBJECT(&s->i2c);
sysbus_init_child_obj(OBJECT(machine), "nrf51", &s->nrf51, sizeof(s->nrf51),
TYPE_NRF51_SOC);
object_initialize_child(OBJECT(machine), "nrf51", &s->nrf51,
TYPE_NRF51_SOC);
qdev_prop_set_chr(DEVICE(&s->nrf51), "serial0", serial_hd(0));
object_property_set_link(soc, OBJECT(system_memory), "memory",
&error_fatal);
object_property_set_bool(soc, true, "realized", &error_fatal);
sysbus_realize(SYS_BUS_DEVICE(soc), &error_fatal);
/*
* Overlap the TWI stub device into the SoC. This is a microbit-specific
* hack until we implement the nRF51 TWI controller properly and the
* magnetometer/accelerometer devices.
*/
sysbus_init_child_obj(OBJECT(machine), "microbit.twi", &s->i2c,
sizeof(s->i2c), TYPE_MICROBIT_I2C);
object_property_set_bool(i2c, true, "realized", &error_fatal);
object_initialize_child(OBJECT(machine), "microbit.twi", &s->i2c,
TYPE_MICROBIT_I2C);
sysbus_realize(SYS_BUS_DEVICE(i2c), &error_fatal);
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(i2c), 0);
memory_region_add_subregion_overlap(&s->nrf51.container, NRF51_TWI_BASE,
mr, -1);