From 4ce5dae88ecf2bafa0cd663de7e923728b1b3672 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 15 Mar 2013 14:34:19 +0000 Subject: sysbus: make SysBusDeviceClass::init optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the SysBusDeviceClass::init optional, for devices which genuinely don't need to do anything here. In particular, simple devices which can do all their initialization in their instance_init method don't need either a DeviceClass::realize or SysBusDeviceClass::init method. Signed-off-by: Peter Maydell Acked-by: Andreas Färber Reviewed-by: Peter Crosthwaite Message-id: 1363358063-23973-2-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori --- hw/sysbus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/sysbus.c b/hw/sysbus.c index 702fc728f4..9a19468347 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -137,6 +137,9 @@ static int sysbus_device_init(DeviceState *dev) SysBusDevice *sd = SYS_BUS_DEVICE(dev); SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd); + if (!sbc->init) { + return 0; + } return sbc->init(sd); } -- cgit v1.2.3