diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-05-02 12:06:55 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-06-18 15:14:38 +0200 |
commit | 8185d21639ab749979445734ec671122aa96e805 (patch) | |
tree | 3864a9d2837a5c43ed3e7230a671e5af4f01a005 /hw/qdev.c | |
parent | 09e5ab6360ce78fc0acbfe29ac100f8148397ca6 (diff) |
qdev: Move SysBus initialization to sysbus.c
TYPE_SYSTEM_BUS will be local to hw/sysbus.c, so move existing references
to main_system_bus and system_bus_info there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r-- | hw/qdev.c | 26 |
1 files changed, 2 insertions, 24 deletions
@@ -34,10 +34,6 @@ int qdev_hotplug = 0; static bool qdev_hot_added = false; static bool qdev_hot_removed = false; -/* This is a nasty hack to allow passing a NULL bus to qdev_create. */ -static BusState *main_system_bus; -static void main_system_bus_create(void); - /* Register a new device type. */ const VMStateDescription *qdev_get_vmsd(DeviceState *dev) { @@ -188,14 +184,6 @@ static int qdev_reset_one(DeviceState *dev, void *opaque) return 0; } -BusState *sysbus_get_default(void) -{ - if (!main_system_bus) { - main_system_bus_create(); - } - return main_system_bus; -} - static int qbus_reset_one(BusState *bus, void *opaque) { if (bus->info->reset) { @@ -415,7 +403,7 @@ void qbus_create_inplace(BusState *bus, BusInfo *info, if (parent) { QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling); parent->num_child_bus++; - } else if (bus != main_system_bus) { + } else if (bus != sysbus_get_default()) { /* TODO: once all bus devices are qdevified, only reset handler for main_system_bus should be registered here. */ qemu_register_reset(qbus_reset_all_fn, bus); @@ -432,16 +420,6 @@ BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) return bus; } -static void main_system_bus_create(void) -{ - /* assign main_system_bus before qbus_create_inplace() - * in order to make "if (bus != main_system_bus)" work */ - main_system_bus = g_malloc0(system_bus_info.size); - main_system_bus->qdev_allocated = 1; - qbus_create_inplace(main_system_bus, &system_bus_info, NULL, - "main-system-bus"); -} - void qbus_free(BusState *bus) { DeviceState *dev; @@ -453,7 +431,7 @@ void qbus_free(BusState *bus) QLIST_REMOVE(bus, sibling); bus->parent->num_child_bus--; } else { - assert(bus != main_system_bus); /* main_system_bus is never freed */ + assert(bus != sysbus_get_default()); /* main_system_bus is never freed */ qemu_unregister_reset(qbus_reset_all_fn, bus); } g_free((void*)bus->name); |