diff options
author | Andreas Färber <afaerber@suse.de> | 2012-11-25 02:37:14 +0100 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-06-07 12:14:45 +0200 |
commit | db895a1e6a97e919f9b86d60c969377357b05066 (patch) | |
tree | 72f6786abe90f7fa77d2f10416df73cb9d62e35a /hw/i386/pc.c | |
parent | a3dcca567a1d4a5c79fb9c8fe2d9a21a4a7cebd5 (diff) |
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>
Diffstat (limited to 'hw/i386/pc.c')
-rw-r--r-- | hw/i386/pc.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 4844a6b370..e9c91e44a1 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -522,23 +522,29 @@ static const MemoryRegionOps port92_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static int port92_initfn(ISADevice *dev) +static void port92_initfn(Object *obj) { - Port92State *s = PORT92(dev); + Port92State *s = PORT92(obj); memory_region_init_io(&s->io, &port92_ops, s, "port92", 1); - isa_register_ioport(dev, &s->io, 0x92); s->outport = 0; - return 0; +} + +static void port92_realizefn(DeviceState *dev, Error **errp) +{ + ISADevice *isadev = ISA_DEVICE(dev); + Port92State *s = PORT92(dev); + + isa_register_ioport(isadev, &s->io, 0x92); } static void port92_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); - ic->init = port92_initfn; + dc->no_user = 1; + dc->realize = port92_realizefn; dc->reset = port92_reset; dc->vmsd = &vmstate_port92_isa; } @@ -547,6 +553,7 @@ static const TypeInfo port92_info = { .name = TYPE_PORT92, .parent = TYPE_ISA_DEVICE, .instance_size = sizeof(Port92State), + .instance_init = port92_initfn, .class_init = port92_class_initfn, }; |