aboutsummaryrefslogtreecommitdiff
path: root/hw/ssi.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-23 15:34:39 -0600
committerAndreas Färber <afaerber@suse.de>2012-06-18 15:14:38 +0200
commit0866aca1de15a12547f52ff8563cf7c163e1898e (patch)
tree511c043eb3de19d479f708209e588d828b751903 /hw/ssi.c
parentf968fc6892daf02865cce8af277cc755be690eda (diff)
qbus: Make child devices links
Make qbus children show up as link<> properties. There is no stable addressing for qbus children so we use an unstable naming convention. This is okay in QOM though because the composition name is expected to be what's stable. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/ssi.c')
-rw-r--r--hw/ssi.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/ssi.c b/hw/ssi.c
index 8db99c29e4..e5f14a0cef 100644
--- a/hw/ssi.c
+++ b/hw/ssi.c
@@ -30,10 +30,11 @@ static int ssi_slave_init(DeviceState *dev)
SSISlave *s = SSI_SLAVE(dev);
SSISlaveClass *ssc = SSI_SLAVE_GET_CLASS(s);
SSIBus *bus;
+ BusChild *kid;
bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(dev));
- if (QTAILQ_FIRST(&bus->qbus.children) != dev
- || QTAILQ_NEXT(dev, sibling) != NULL) {
+ kid = QTAILQ_FIRST(&bus->qbus.children);
+ if (kid->child != dev || QTAILQ_NEXT(kid, sibling) != NULL) {
hw_error("Too many devices on SSI bus");
}
@@ -72,14 +73,15 @@ SSIBus *ssi_create_bus(DeviceState *parent, const char *name)
uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
{
- DeviceState *dev;
+ BusChild *kid;
SSISlave *slave;
SSISlaveClass *ssc;
- dev = QTAILQ_FIRST(&bus->qbus.children);
- if (!dev) {
+
+ kid = QTAILQ_FIRST(&bus->qbus.children);
+ if (!kid) {
return 0;
}
- slave = SSI_SLAVE(dev);
+ slave = SSI_SLAVE(kid->child);
ssc = SSI_SLAVE_GET_CLASS(slave);
return ssc->transfer(slave, val);
}