mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
ssi: Convert uses of ssi_create_slave_no_init() with Coccinelle
Replace dev = ssi_create_slave_no_init(bus, type_name); ... qdev_init_nofail(dev); by dev = qdev_new(type_name); ... qdev_realize_and_unref(dev, bus, &error_fatal); Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains why. @@ type SSIBus; identifier bus; expression dev, qbus, expr; expression list args; @@ - bus = (SSIBus *)qbus; + bus = qbus; // TODO fix up decl ... - dev = ssi_create_slave_no_init(bus, args); + dev = qdev_new(args); ... when != dev = expr - qdev_init_nofail(dev); + qdev_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev = ssi_create_slave_no_init(bus, args); + dev = qdev_new(args); ... when != dev = expr - qdev_init_nofail(dev); + qdev_realize_and_unref(dev, BUS(bus), &error_fatal); Bus declarations fixed up manually. Cc: Alistair Francis <alistair@alistair23.me> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-24-armbru@redhat.com>
This commit is contained in:
parent
7f16c76e83
commit
57d479c9c6
6 changed files with 20 additions and 20 deletions
|
@ -47,7 +47,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
|
|||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
DriveInfo *dinfo = drive_get_next(IF_MTD);
|
||||
qemu_irq cs_line;
|
||||
SSIBus *spi_bus;
|
||||
BusState *spi_bus;
|
||||
MemoryRegion *sysmem = get_system_memory();
|
||||
MemoryRegion *ddr = g_new(MemoryRegion, 1);
|
||||
|
||||
|
@ -82,14 +82,14 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
|
|||
soc = MSF2_SOC(dev);
|
||||
|
||||
/* Attach SPI flash to SPI0 controller */
|
||||
spi_bus = (SSIBus *)qdev_get_child_bus(dev, "spi0");
|
||||
spi_flash = ssi_create_slave_no_init(spi_bus, "s25sl12801");
|
||||
spi_bus = qdev_get_child_bus(dev, "spi0");
|
||||
spi_flash = qdev_new("s25sl12801");
|
||||
qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 1);
|
||||
if (dinfo) {
|
||||
qdev_prop_set_drive(spi_flash, "drive", blk_by_legacy_dinfo(dinfo),
|
||||
&error_fatal);
|
||||
}
|
||||
qdev_init_nofail(spi_flash);
|
||||
qdev_realize_and_unref(spi_flash, spi_bus, &error_fatal);
|
||||
cs_line = qdev_get_gpio_in_named(spi_flash, SSI_GPIO_CS, 0);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&soc->spi[0]), 1, cs_line);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue