mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
sysbus: make SysBusDeviceClass::init optional
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 <[email protected]> Acked-by: Andreas Färber <[email protected]> Reviewed-by: Peter Crosthwaite <[email protected]> Message-id: [email protected] Signed-off-by: Anthony Liguori <[email protected]>
This commit is contained in:
1 parent
5357406415
commit
4ce5dae88e
1 file changed
+3
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user