From f6102c329c43d7d5e0bee1fc2fe4043e05f9810c Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Thu, 21 May 2015 12:43:31 +0200 Subject: s390/sclp: rework sclp event facility initialization + device realization The current code only works by chance. The event facility is a sysbus device, but specifies in its class structure as parent the DeviceClass (instead of a device class). The init function in return lies therefore at the same position as the init function of SysBusDeviceClass and gets triggered instead - a very bad idea of doing that (e.g. the parameter types don't match). Let's bring the initialization code up to date, initializing the event facility + child events in .instance_init and moving the realization of the child events out of the init call, into the realization step. Device realization is now automatically performed when the event facility itself is realized. That realization implicitly triggers realization of the child bus, which in turn initializes the events. Please note that we have to manually propagate the realization of the bus children, common code still has a TODO set for that task. Reviewed-by: Matthew Rosato Signed-off-by: David Hildenbrand Signed-off-by: Cornelia Huck --- include/hw/s390x/event-facility.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h index 871f3e7..eae3b3b 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -191,8 +191,7 @@ typedef struct SCLPEventClass { typedef struct SCLPEventFacility SCLPEventFacility; typedef struct SCLPEventFacilityClass { - DeviceClass parent_class; - int (*init)(SCLPEventFacility *ef); + SysBusDeviceClass parent_class; void (*command_handler)(SCLPEventFacility *ef, SCCB *sccb, uint64_t code); bool (*event_pending)(SCLPEventFacility *ef); } SCLPEventFacilityClass; -- cgit v1.1