@@ -328,8 +328,9 @@ void qdev_reset_all(DeviceState *dev)
qdev_walk_children(dev, qdev_reset_one, qbus_reset_one, NULL);
}
-void qbus_reset_all(BusState *bus)
+void qbus_reset_all(void *opaque)
{
+ BusState *bus = opaque;
qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL);
}
@@ -755,9 +756,9 @@ void qbus_create_inplace(BusState *bus, BusInfo *info,
QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling);
parent->num_child_bus++;
} else if (bus != main_system_bus) {
- /* TODO: once all device is qdevified,
- reset handler for main_system_bus should also be registered here */
- qemu_register_reset((void *)qbus_reset_all, bus);
+ /* TODO: once all bus devices are qdevified,
+ only reset handler for main_system_bus should be registered here. */
+ qemu_register_reset(qbus_reset_all, bus);
}
}
@@ -781,6 +782,10 @@ void qbus_free(BusState *bus)
if (bus->parent) {
QLIST_REMOVE(bus, sibling);
bus->parent->num_child_bus--;
+ } else {
+ /* TODO: once all bus devices are qdevified, only reset handler for
+ * main_system_bus should be unregistered here. */
+ qemu_unregister_reset(qbus_reset_all, bus);
}
qemu_free((void*)bus->name);
if (bus->qdev_allocated) {
@@ -198,7 +198,7 @@ int qbus_walk_children(BusState *bus, qdev_walkerfn *devfn,
int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn,
qbus_walkerfn *busfn, void *opaque);
void qdev_reset_all(DeviceState *dev);
-void qbus_reset_all(BusState *bus);
+void qbus_reset_all(void *opaque);
void qbus_free(BusState *bus);
#define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev)
@@ -3088,9 +3088,9 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
- /* TODO: once all device is qdevified, this should be done by
- qbus_create_inplace() */
- qemu_register_reset((void *)qbus_reset_all, sysbus_get_default());
+ /* TODO: once all bus devices are qdevified, this should be done
+ * when bus is created by qdev.c */
+ qemu_register_reset(qbus_reset_all, sysbus_get_default());
qemu_run_machine_init_done_notifiers();
qemu_system_reset();