qdev: switch children device list to QTAILQ

SCSI buses will need to read the children list first-to-last.  This
requires using a QTAILQ, because hell breaks loose if you just try
inserting at the tail (thus reversing the order of all existing
visits from last-to-first to first-to-tail).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Paolo Bonzini 2011-09-14 09:28:06 +02:00 committed by Kevin Wolf
parent afd4030c16
commit d8bb00d6d7
8 changed files with 28 additions and 28 deletions

View file

@ -25,8 +25,8 @@ static int ssi_slave_init(DeviceState *dev, DeviceInfo *base_info)
SSIBus *bus;
bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(dev));
if (QLIST_FIRST(&bus->qbus.children) != dev
|| QLIST_NEXT(dev, sibling) != NULL) {
if (QTAILQ_FIRST(&bus->qbus.children) != dev
|| QTAILQ_NEXT(dev, sibling) != NULL) {
hw_error("Too many devices on SSI bus");
}
@ -61,7 +61,7 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
{
DeviceState *dev;
SSISlave *slave;
dev = QLIST_FIRST(&bus->qbus.children);
dev = QTAILQ_FIRST(&bus->qbus.children);
if (!dev) {
return 0;
}