diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2011-09-14 09:28:06 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-10-28 19:25:51 +0200 |
commit | d8bb00d6d72eba317f78501434fc37db4968fa31 (patch) | |
tree | ff256818d8ffb51d20ba626db9a5f20f6e411c1f /hw | |
parent | afd4030c16d290e460cc93f8f9e353516b5451a2 (diff) |
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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/acpi_piix4.c | 4 | ||||
-rw-r--r-- | hw/i2c.c | 2 | ||||
-rw-r--r-- | hw/intel-hda.c | 6 | ||||
-rw-r--r-- | hw/qdev.c | 24 | ||||
-rw-r--r-- | hw/qdev.h | 4 | ||||
-rw-r--r-- | hw/s390-virtio-bus.c | 4 | ||||
-rw-r--r-- | hw/spapr_vio.c | 6 | ||||
-rw-r--r-- | hw/ssi.c | 6 |
8 files changed, 28 insertions, 28 deletions
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index 29f0f76c35..d9075e6611 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -276,7 +276,7 @@ static void piix4_update_hotplug(PIIX4PMState *s) s->pci0_hotplug_enable = ~0; - QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) { + QTAILQ_FOREACH_SAFE(qdev, &bus->children, sibling, next) { PCIDeviceInfo *info = container_of(qdev->info, PCIDeviceInfo, qdev); PCIDevice *pdev = DO_UPCAST(PCIDevice, qdev, qdev); int slot = PCI_SLOT(pdev->devfn); @@ -486,7 +486,7 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val) PCIDeviceInfo *info; int slot = ffs(val) - 1; - QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) { + QTAILQ_FOREACH_SAFE(qdev, &bus->children, sibling, next) { dev = DO_UPCAST(PCIDevice, qdev, qdev); info = container_of(qdev->info, PCIDeviceInfo, qdev); if (PCI_SLOT(dev->devfn) == slot && !info->no_hotplug) { @@ -84,7 +84,7 @@ int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv) DeviceState *qdev; i2c_slave *slave = NULL; - QLIST_FOREACH(qdev, &bus->qbus.children, sibling) { + QTAILQ_FOREACH(qdev, &bus->qbus.children, sibling) { i2c_slave *candidate = I2C_SLAVE_FROM_QDEV(qdev); if (candidate->address == address) { slave = candidate; diff --git a/hw/intel-hda.c b/hw/intel-hda.c index f97775c235..675b6591e9 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -86,7 +86,7 @@ HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad) DeviceState *qdev; HDACodecDevice *cdev; - QLIST_FOREACH(qdev, &bus->qbus.children, sibling) { + QTAILQ_FOREACH(qdev, &bus->qbus.children, sibling) { cdev = DO_UPCAST(HDACodecDevice, qdev, qdev); if (cdev->cad == cad) { return cdev; @@ -490,7 +490,7 @@ static void intel_hda_notify_codecs(IntelHDAState *d, uint32_t stream, bool runn DeviceState *qdev; HDACodecDevice *cdev; - QLIST_FOREACH(qdev, &d->codecs.qbus.children, sibling) { + QTAILQ_FOREACH(qdev, &d->codecs.qbus.children, sibling) { cdev = DO_UPCAST(HDACodecDevice, qdev, qdev); if (cdev->info->stream) { cdev->info->stream(cdev, stream, running, output); @@ -1114,7 +1114,7 @@ static void intel_hda_reset(DeviceState *dev) d->wall_base_ns = qemu_get_clock_ns(vm_clock); /* reset codecs */ - QLIST_FOREACH(qdev, &d->codecs.qbus.children, sibling) { + QTAILQ_FOREACH(qdev, &d->codecs.qbus.children, sibling) { cdev = DO_UPCAST(HDACodecDevice, qdev, qdev); if (qdev->info->reset) { qdev->info->reset(qdev); @@ -91,7 +91,7 @@ static DeviceState *qdev_create_from_info(BusState *bus, DeviceInfo *info) qdev_prop_set_defaults(dev, dev->info->props); qdev_prop_set_defaults(dev, dev->parent_bus->info->props); qdev_prop_set_globals(dev); - QLIST_INSERT_HEAD(&bus->children, dev, sibling); + QTAILQ_INSERT_HEAD(&bus->children, dev, sibling); if (qdev_hotplug) { assert(bus->allow_hotplug); dev->hotplugged = 1; @@ -408,7 +408,7 @@ void qdev_free(DeviceState *dev) if (dev->opts) qemu_opts_del(dev->opts); } - QLIST_REMOVE(dev, sibling); + QTAILQ_REMOVE(&dev->parent_bus->children, dev, sibling); for (prop = dev->info->props; prop && prop->name; prop++) { if (prop->info->free) { prop->info->free(dev, prop); @@ -510,7 +510,7 @@ int qbus_walk_children(BusState *bus, qdev_walkerfn *devfn, } } - QLIST_FOREACH(dev, &bus->children, sibling) { + QTAILQ_FOREACH(dev, &bus->children, sibling) { err = qdev_walk_children(dev, devfn, busfn, opaque); if (err < 0) { return err; @@ -560,7 +560,7 @@ static BusState *qbus_find_recursive(BusState *bus, const char *name, return bus; } - QLIST_FOREACH(dev, &bus->children, sibling) { + QTAILQ_FOREACH(dev, &bus->children, sibling) { QLIST_FOREACH(child, &dev->child_bus, sibling) { ret = qbus_find_recursive(child, name, info); if (ret) { @@ -576,7 +576,7 @@ DeviceState *qdev_find_recursive(BusState *bus, const char *id) DeviceState *dev, *ret; BusState *child; - QLIST_FOREACH(dev, &bus->children, sibling) { + QTAILQ_FOREACH(dev, &bus->children, sibling) { if (dev->id && strcmp(dev->id, id) == 0) return dev; QLIST_FOREACH(child, &dev->child_bus, sibling) { @@ -609,7 +609,7 @@ static void qbus_list_dev(BusState *bus) const char *sep = " "; error_printf("devices at \"%s\":", bus->name); - QLIST_FOREACH(dev, &bus->children, sibling) { + QTAILQ_FOREACH(dev, &bus->children, sibling) { error_printf("%s\"%s\"", sep, dev->info->name); if (dev->id) error_printf("/\"%s\"", dev->id); @@ -640,17 +640,17 @@ static DeviceState *qbus_find_dev(BusState *bus, char *elem) * (2) driver name * (3) driver alias, if present */ - QLIST_FOREACH(dev, &bus->children, sibling) { + QTAILQ_FOREACH(dev, &bus->children, sibling) { if (dev->id && strcmp(dev->id, elem) == 0) { return dev; } } - QLIST_FOREACH(dev, &bus->children, sibling) { + QTAILQ_FOREACH(dev, &bus->children, sibling) { if (strcmp(dev->info->name, elem) == 0) { return dev; } } - QLIST_FOREACH(dev, &bus->children, sibling) { + QTAILQ_FOREACH(dev, &bus->children, sibling) { if (dev->info->alias && strcmp(dev->info->alias, elem) == 0) { return dev; } @@ -774,7 +774,7 @@ void qbus_create_inplace(BusState *bus, BusInfo *info, bus->name = buf; } - QLIST_INIT(&bus->children); + QTAILQ_INIT(&bus->children); if (parent) { QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling); parent->num_child_bus++; @@ -809,7 +809,7 @@ void qbus_free(BusState *bus) { DeviceState *dev; - while ((dev = QLIST_FIRST(&bus->children)) != NULL) { + while ((dev = QTAILQ_FIRST(&bus->children)) != NULL) { qdev_free(dev); } if (bus->parent) { @@ -878,7 +878,7 @@ static void qbus_print(Monitor *mon, BusState *bus, int indent) qdev_printf("bus: %s\n", bus->name); indent += 2; qdev_printf("type %s\n", bus->info->name); - QLIST_FOREACH(dev, &bus->children, sibling) { + QTAILQ_FOREACH(dev, &bus->children, sibling) { qdev_print(mon, dev, indent); } } @@ -42,7 +42,7 @@ struct DeviceState { qemu_irq *gpio_in; QLIST_HEAD(, BusState) child_bus; int num_child_bus; - QLIST_ENTRY(DeviceState) sibling; + QTAILQ_ENTRY(DeviceState) sibling; int instance_id_alias; int alias_required_for_version; }; @@ -73,7 +73,7 @@ struct BusState { const char *name; int allow_hotplug; int qdev_allocated; - QLIST_HEAD(, DeviceState) children; + QTAILQ_HEAD(, DeviceState) children; QLIST_ENTRY(BusState) sibling; }; diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c index e2f3e32aca..0ce6406b6d 100644 --- a/hw/s390-virtio-bus.c +++ b/hw/s390-virtio-bus.c @@ -274,7 +274,7 @@ VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus, DeviceState *dev; int i; - QLIST_FOREACH(dev, &bus->bus.children, sibling) { + QTAILQ_FOREACH(dev, &bus->bus.children, sibling) { _dev = (VirtIOS390Device *)dev; for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { if (!virtio_queue_get_addr(_dev->vdev, i)) @@ -297,7 +297,7 @@ VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus, ram_addr_t mem) VirtIOS390Device *_dev; DeviceState *dev; - QLIST_FOREACH(dev, &bus->bus.children, sibling) { + QTAILQ_FOREACH(dev, &bus->bus.children, sibling) { _dev = (VirtIOS390Device *)dev; if (_dev->dev_offs == mem) { return _dev; diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index 35818e18f1..977603f81e 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -63,7 +63,7 @@ VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg) DeviceState *qdev; VIOsPAPRDevice *dev = NULL; - QLIST_FOREACH(qdev, &bus->bus.children, sibling) { + QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) { dev = (VIOsPAPRDevice *)qdev; if (dev->reg == reg) { break; @@ -588,7 +588,7 @@ static void rtas_quiesce(sPAPREnvironment *spapr, uint32_t token, return; } - QLIST_FOREACH(qdev, &bus->bus.children, sibling) { + QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) { dev = (VIOsPAPRDevice *)qdev; spapr_vio_quiesce_one(dev); } @@ -726,7 +726,7 @@ int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt) DeviceState *qdev; int ret = 0; - QLIST_FOREACH(qdev, &bus->bus.children, sibling) { + QTAILQ_FOREACH(qdev, &bus->bus.children, sibling) { VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev; ret = vio_make_devnode(dev, fdt); @@ -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; } |