diff options
author | Markus Armbruster | 2020-06-10 07:32:11 +0200 |
---|---|---|
committer | Markus Armbruster | 2020-06-15 22:05:28 +0200 |
commit | 7f16c76e83cedeea0e4cec8942c974885a216865 (patch) | |
tree | c52e23a1a8d116c1e63af16265a0f04d4d02b495 /hw/ssi/imx_spi.c | |
parent | isa: isa_create(), isa_try_create() are now unused, drop (diff) | |
download | qemu-7f16c76e83cedeea0e4cec8942c974885a216865.tar.gz qemu-7f16c76e83cedeea0e4cec8942c974885a216865.tar.xz qemu-7f16c76e83cedeea0e4cec8942c974885a216865.zip |
ssi: ssi_auto_connect_slaves() never does anything, drop
ssi_auto_connect_slaves(parent, cs_line, bus) iterates over @parent's
QOM children @dev of type TYPE_SSI_SLAVE. It puts these on @bus, and
sets cs_line[] to qdev_get_gpio_in_named(dev, SSI_GPIO_CS, 0).
Suspicious: there is no protection against overrunning cs_line[].
Turns out it's safe because ssi_auto_connect_slaves() never finds any
such children. Its called by realize methods of some (but not all)
devices providing an SSI bus, and gets passed the device.
SSI slave devices are always created with ssi_create_slave_no_init(),
optionally via ssi_create_slave(). This adds them to their SSI bus.
It doesn't set their QOM parent.
ssi_create_slave_no_init() is always immediately followed by
qdev_init_nofail(), with no QOM parent assigned, so
device_set_realized() puts the device into the /machine/unattached/
orphanage. None become QOM children of a device providing an SSI bus.
ssi_auto_connect_slaves() was added in commit b4ae3cfa57 "ssi: Add
slave autoconnect helper". I can't see which slaves it was supposed
to connect back then.
Cc: Alistair Francis <alistair@alistair23.me>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-23-armbru@redhat.com>
Diffstat (limited to 'hw/ssi/imx_spi.c')
-rw-r--r-- | hw/ssi/imx_spi.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c index 43b2f14dd2..7f703d8328 100644 --- a/hw/ssi/imx_spi.c +++ b/hw/ssi/imx_spi.c @@ -424,8 +424,6 @@ static void imx_spi_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); - ssi_auto_connect_slaves(dev, s->cs_lines, s->bus); - for (i = 0; i < 4; ++i) { sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->cs_lines[i]); } |