qemu/include/hw/ssi
Markus Armbruster 7f16c76e83 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>
2020-06-15 22:05:28 +02:00
..
aspeed_smc.h aspeed/smc: Add AST2600 timings registers 2019-12-16 10:46:34 +00:00
imx_spi.h i.MX: Add the Freescale SPI Controller 2016-05-12 13:22:29 +01:00
mss-spi.h msf2: Add Smartfusion2 SPI controller 2017-09-21 16:36:56 +01:00
pl022.h hw/ssi/pl022: Allow use as embedded-struct device 2018-08-24 13:17:44 +01:00
ssi.h ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00
stm32f2xx_spi.h Include hw/hw.h exactly where needed 2019-08-16 13:31:52 +02:00
xilinx_spips.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00