diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-12-15 16:31:06 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-01-27 10:50:49 -0600 |
commit | 3954d33ab7f82f5a5fa0ced231849920265a5fec (patch) | |
tree | 2535349de87b099d02c5bf6cb328191ef23f593b /hw/spapr_vty.c | |
parent | b9eea3e6a435a79fe308212157e0875442b760e4 (diff) | |
download | qemu-3954d33ab7f82f5a5fa0ced231849920265a5fec.tar.gz qemu-3954d33ab7f82f5a5fa0ced231849920265a5fec.tar.bz2 qemu-3954d33ab7f82f5a5fa0ced231849920265a5fec.zip |
spapr: convert to QEMU Object Model (v2)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
- use QOM to check for the default console
Diffstat (limited to 'hw/spapr_vty.c')
-rw-r--r-- | hw/spapr_vty.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index 3d5c579311..1780ffea32 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -135,18 +135,27 @@ void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev) qdev_init_nofail(dev); } -static VIOsPAPRDeviceInfo spapr_vty_info = { - .init = spapr_vty_init, - .dt_name = "vty", - .dt_type = "serial", - .dt_compatible = "hvterm1", - .qdev.name = "spapr-vty", - .qdev.size = sizeof(VIOsPAPRVTYDevice), - .qdev.props = (Property[]) { - DEFINE_SPAPR_PROPERTIES(VIOsPAPRVTYDevice, sdev, SPAPR_VTY_BASE_ADDRESS, 0), - DEFINE_PROP_CHR("chardev", VIOsPAPRVTYDevice, chardev), - DEFINE_PROP_END_OF_LIST(), - }, +static Property spapr_vty_properties[] = { + DEFINE_SPAPR_PROPERTIES(VIOsPAPRVTYDevice, sdev, SPAPR_VTY_BASE_ADDRESS, 0), + DEFINE_PROP_CHR("chardev", VIOsPAPRVTYDevice, chardev), + DEFINE_PROP_END_OF_LIST(), +}; + +static void spapr_vty_class_init(ObjectClass *klass, void *data) +{ + VIOsPAPRDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass); + + k->init = spapr_vty_init; + k->dt_name = "vty"; + k->dt_type = "serial"; + k->dt_compatible = "hvterm1"; +} + +static DeviceInfo spapr_vty_info = { + .name = "spapr-vty", + .size = sizeof(VIOsPAPRVTYDevice), + .props = spapr_vty_properties, + .class_init = spapr_vty_class_init, }; VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) @@ -163,7 +172,7 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) selected = NULL; QTAILQ_FOREACH(iter, &bus->bus.children, sibling) { /* Only look at VTY devices */ - if (qdev_get_info(iter) != &spapr_vty_info.qdev) { + if (!object_dynamic_cast(OBJECT(iter), "spapr-vty")) { continue; } |