diff options
author | Anthony Liguori | 2011-12-16 20:36:39 +0100 |
---|---|---|
committer | Anthony Liguori | 2012-01-27 17:50:47 +0100 |
commit | cd6c4cf28b529aaee0367256d37f349e3b125818 (patch) | |
tree | a13e1eee93c85362ef4ce4c33cc3608412c64f7a /hw/ssi.c | |
parent | ccid: convert to QEMU Object Model (diff) | |
download | qemu-cd6c4cf28b529aaee0367256d37f349e3b125818.tar.gz qemu-cd6c4cf28b529aaee0367256d37f349e3b125818.tar.xz qemu-cd6c4cf28b529aaee0367256d37f349e3b125818.zip |
ssi: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/ssi.c')
-rw-r--r-- | hw/ssi.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -23,8 +23,8 @@ static struct BusInfo ssi_bus_info = { static int ssi_slave_init(DeviceState *dev, DeviceInfo *base_info) { - SSISlaveInfo *info = container_of(base_info, SSISlaveInfo, qdev); - SSISlave *s = SSI_SLAVE_FROM_QDEV(dev); + SSISlave *s = SSI_SLAVE(dev); + SSISlaveClass *ssc = SSI_SLAVE_GET_CLASS(s); SSIBus *bus; bus = FROM_QBUS(SSIBus, qdev_get_parent_bus(dev)); @@ -33,16 +33,15 @@ static int ssi_slave_init(DeviceState *dev, DeviceInfo *base_info) hw_error("Too many devices on SSI bus"); } - s->info = info; - return info->init(s); + return ssc->init(s); } -void ssi_register_slave(SSISlaveInfo *info) +void ssi_register_slave(DeviceInfo *info) { - assert(info->qdev.size >= sizeof(SSISlave)); - info->qdev.init = ssi_slave_init; - info->qdev.bus_info = &ssi_bus_info; - qdev_register(&info->qdev); + assert(info->size >= sizeof(SSISlave)); + info->init = ssi_slave_init; + info->bus_info = &ssi_bus_info; + qdev_register(info); } DeviceState *ssi_create_slave(SSIBus *bus, const char *name) @@ -64,10 +63,12 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val) { DeviceState *dev; SSISlave *slave; + SSISlaveClass *ssc; dev = QTAILQ_FIRST(&bus->qbus.children); if (!dev) { return 0; } - slave = SSI_SLAVE_FROM_QDEV(dev); - return slave->info->transfer(slave, val); + slave = SSI_SLAVE(dev); + ssc = SSI_SLAVE_GET_CLASS(slave); + return ssc->transfer(slave, val); } |