aboutsummaryrefslogtreecommitdiff
path: root/hw/sysbus.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-06-10 09:41:42 +0200
committerPaul Brook <paul@codesourcery.com>2009-06-11 13:47:36 +0100
commit074f2fff798cb8f9588080b740dc356217a24720 (patch)
tree4a7267d64bbe8d679627699b6545c9fcd23bb270 /hw/sysbus.c
parent57b452a8487df30d084ce2b56a993ba7473469e3 (diff)
qdev: move name+size into DeviceInfo (v2)
Rationale: move device information from code to data structures. v2: Adapt the drivers missed in the first version. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/sysbus.c')
-rw-r--r--hw/sysbus.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/sysbus.c b/hw/sysbus.c
index fbd2ddf394..ef3a7011e9 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -105,14 +105,13 @@ static void sysbus_device_init(DeviceState *dev, DeviceInfo *base)
info->init(sysbus_from_qdev(dev));
}
-void sysbus_register_withprop(const char *name, size_t size,
- SysBusDeviceInfo *info)
+void sysbus_register_withprop(SysBusDeviceInfo *info)
{
info->qdev.init = sysbus_device_init;
info->qdev.bus_type = BUS_TYPE_SYSTEM;
- assert(size >= sizeof(SysBusDevice));
- qdev_register(name, size, &info->qdev);
+ assert(info->qdev.size >= sizeof(SysBusDevice));
+ qdev_register(&info->qdev);
}
void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init)
@@ -120,8 +119,10 @@ void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init)
SysBusDeviceInfo *info;
info = qemu_mallocz(sizeof(*info));
+ info->qdev.name = qemu_strdup(name);
+ info->qdev.size = size;
info->init = init;
- sysbus_register_withprop(name, size, info);
+ sysbus_register_withprop(info);
}
DeviceState *sysbus_create_varargs(const char *name,