mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
isa: Use realizefn for ISADevice
Drop ISADeviceClass::init and the resulting no-op initfn and let children implement their own realizefn. Adapt error handling. Split off an instance_init where sensible. Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
a3dcca567a
commit
db895a1e6a
34 changed files with 292 additions and 243 deletions
|
@ -137,25 +137,25 @@ static const MemoryRegionOps vmport_ops = {
|
|||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
static int vmport_initfn(ISADevice *dev)
|
||||
static void vmport_realizefn(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ISADevice *isadev = ISA_DEVICE(dev);
|
||||
VMPortState *s = VMPORT(dev);
|
||||
|
||||
memory_region_init_io(&s->io, &vmport_ops, s, "vmport", 1);
|
||||
isa_register_ioport(dev, &s->io, 0x5658);
|
||||
isa_register_ioport(isadev, &s->io, 0x5658);
|
||||
|
||||
port_state = s;
|
||||
/* Register some generic port commands */
|
||||
vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
|
||||
vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vmport_class_initfn(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
|
||||
ic->init = vmport_initfn;
|
||||
|
||||
dc->realize = vmport_realizefn;
|
||||
dc->no_user = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue