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/isa | |
parent | a3dcca567a1d4a5c79fb9c8fe2d9a21a4a7cebd5 (diff) | |
download | qemu-db895a1e6a97e919f9b86d60c969377357b05066.tar.gz qemu-db895a1e6a97e919f9b86d60c969377357b05066.tar.bz2 qemu-db895a1e6a97e919f9b86d60c969377357b05066.zip |
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/isa')
-rw-r--r-- | hw/isa/isa-bus.c | 13 | ||||
-rw-r--r-- | hw/isa/pc87312.c | 12 |
2 files changed, 5 insertions, 20 deletions
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 7860b17d66..f12b15da32 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -119,18 +119,6 @@ void isa_register_portio_list(ISADevice *dev, uint16_t start, portio_list_add(piolist, isabus->address_space_io, start); } -static int isa_qdev_init(DeviceState *qdev) -{ - ISADevice *dev = ISA_DEVICE(qdev); - ISADeviceClass *klass = ISA_DEVICE_GET_CLASS(dev); - - if (klass->init) { - return klass->init(dev); - } - - return 0; -} - static void isa_device_init(Object *obj) { ISADevice *dev = ISA_DEVICE(obj); @@ -230,7 +218,6 @@ static const TypeInfo isabus_bridge_info = { static void isa_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); - k->init = isa_qdev_init; k->bus_type = TYPE_ISA_BUS; } diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 82f7c80f9c..cc426df7f8 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -264,7 +264,7 @@ static void pc87312_reset(DeviceState *d) pc87312_soft_reset(s); } -static int pc87312_init(ISADevice *dev) +static void pc87312_realize(DeviceState *dev, Error **errp) { PC87312State *s; DeviceState *d; @@ -276,9 +276,10 @@ static int pc87312_init(ISADevice *dev) int i; s = PC87312(dev); - bus = isa_bus_from_device(dev); + isa = ISA_DEVICE(dev); + bus = isa_bus_from_device(isa); + isa_register_ioport(isa, &s->io, s->iobase); pc87312_hard_reset(s); - isa_register_ioport(dev, &s->io, s->iobase); if (is_parallel_enabled(s)) { chr = parallel_hds[0]; @@ -345,8 +346,6 @@ static int pc87312_init(ISADevice *dev) s->ide.dev = isa; trace_pc87312_info_ide(get_ide_iobase(s)); } - - return 0; } static void pc87312_initfn(Object *obj) @@ -378,9 +377,8 @@ static Property pc87312_properties[] = { static void pc87312_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); - ic->init = pc87312_init; + dc->realize = pc87312_realize; dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312; dc->props = pc87312_properties; |