]> xenbits.xensource.com Git - qemu-upstream-4.4-testing.git/commitdiff
sysbus: make SysBusDeviceClass::init optional
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 15 Mar 2013 14:34:19 +0000 (14:34 +0000)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 1 Apr 2013 14:08:33 +0000 (09:08 -0500)
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 <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 1363358063-23973-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/sysbus.c

index 702fc728f4ca32285af2b2f8b338a95487faed87..9a194683479078b36d8ee03c780740b98f861acc 100644 (file)
@@ -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);
 }