summaryrefslogtreecommitdiff
path: root/hw/ssi.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ssi.c')
-rw-r--r--hw/ssi.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/hw/ssi.c b/hw/ssi.c
index 8f2d9bc034..8db99c29e4 100644
--- a/hw/ssi.c
+++ b/hw/ssi.c
@@ -16,9 +16,13 @@ struct SSIBus {
BusState qbus;
};
-static struct BusInfo ssi_bus_info = {
- .name = "SSI",
- .size = sizeof(SSIBus),
+#define TYPE_SSI_BUS "SSI"
+#define SSI_BUS(obj) OBJECT_CHECK(SSIBus, (obj), TYPE_SSI_BUS)
+
+static const TypeInfo ssi_bus_info = {
+ .name = TYPE_SSI_BUS,
+ .parent = TYPE_BUS,
+ .instance_size = sizeof(SSIBus),
};
static int ssi_slave_init(DeviceState *dev)
@@ -40,7 +44,7 @@ static void ssi_slave_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->init = ssi_slave_init;
- dc->bus_info = &ssi_bus_info;
+ dc->bus_type = TYPE_SSI_BUS;
}
static TypeInfo ssi_slave_info = {
@@ -62,7 +66,7 @@ DeviceState *ssi_create_slave(SSIBus *bus, const char *name)
SSIBus *ssi_create_bus(DeviceState *parent, const char *name)
{
BusState *bus;
- bus = qbus_create(&ssi_bus_info, parent, name);
+ bus = qbus_create(TYPE_SSI_BUS, parent, name);
return FROM_QBUS(SSIBus, bus);
}
@@ -82,6 +86,7 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
static void ssi_slave_register_types(void)
{
+ type_register_static(&ssi_bus_info);
type_register_static(&ssi_slave_info);
}