diff options
author | Heinz Graalfs <graalfs@linux.vnet.ibm.com> | 2013-12-20 12:02:17 +0100 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-02-27 09:51:25 +0100 |
commit | c804c2a71752dd1e150cde768d8c54b02fa8bad9 (patch) | |
tree | b92938796fb9f61dd17638b967f00be01bf438aa /hw/s390x/event-facility.c | |
parent | 6fbef18a4c8b3cd9c3da4772ed5ddaec9be06fac (diff) | |
download | qemu-c804c2a71752dd1e150cde768d8c54b02fa8bad9.zip qemu-c804c2a71752dd1e150cde768d8c54b02fa8bad9.tar.gz qemu-c804c2a71752dd1e150cde768d8c54b02fa8bad9.tar.bz2 |
s390x/event-facility: exploit realize/unrealize
init/exit functionality of abstract SCLPEvent class is now exploiting
realize/unrealize.
Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'hw/s390x/event-facility.c')
-rw-r--r-- | hw/s390x/event-facility.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 5b6d5c6..0777a93 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -377,22 +377,31 @@ static const TypeInfo sclp_event_facility_info = { .class_size = sizeof(SCLPEventFacilityClass), }; -static int event_qdev_init(DeviceState *qdev) +static void event_realize(DeviceState *qdev, Error **errp) { - SCLPEvent *event = DO_UPCAST(SCLPEvent, qdev, qdev); + SCLPEvent *event = SCLP_EVENT(qdev); SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event); - return child->init(event); + if (child->init) { + int rc = child->init(event); + if (rc < 0) { + error_setg(errp, "SCLP event initialization failed."); + return; + } + } } -static int event_qdev_exit(DeviceState *qdev) +static void event_unrealize(DeviceState *qdev, Error **errp) { - SCLPEvent *event = DO_UPCAST(SCLPEvent, qdev, qdev); + SCLPEvent *event = SCLP_EVENT(qdev); SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event); if (child->exit) { - child->exit(event); + int rc = child->exit(event); + if (rc < 0) { + error_setg(errp, "SCLP event exit failed."); + return; + } } - return 0; } static void event_class_init(ObjectClass *klass, void *data) @@ -401,8 +410,8 @@ static void event_class_init(ObjectClass *klass, void *data) dc->bus_type = TYPE_SCLP_EVENTS_BUS; dc->unplug = qdev_simple_unplug_cb; - dc->init = event_qdev_init; - dc->exit = event_qdev_exit; + dc->realize = event_realize; + dc->unrealize = event_unrealize; } static const TypeInfo sclp_event_type_info = { |