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/ide/isa.c | |
parent | a3dcca567a1d4a5c79fb9c8fe2d9a21a4a7cebd5 (diff) | |
download | qemu-db895a1e6a97e919f9b86d60c969377357b05066.zip qemu-db895a1e6a97e919f9b86d60c969377357b05066.tar.gz qemu-db895a1e6a97e919f9b86d60c969377357b05066.tar.bz2 |
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/ide/isa.c')
-rw-r--r-- | hw/ide/isa.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/hw/ide/isa.c b/hw/ide/isa.c index 369a7fa..7243c82 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -65,16 +65,16 @@ static const VMStateDescription vmstate_ide_isa = { } }; -static int isa_ide_initfn(ISADevice *dev) +static void isa_ide_realizefn(DeviceState *dev, Error **errp) { + ISADevice *isadev = ISA_DEVICE(dev); ISAIDEState *s = ISA_IDE(dev); - ide_bus_new(&s->bus, DEVICE(dev), 0, 2); - ide_init_ioport(&s->bus, dev, s->iobase, s->iobase2); - isa_init_irq(dev, &s->irq, s->isairq); + ide_bus_new(&s->bus, dev, 0, 2); + ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2); + isa_init_irq(isadev, &s->irq, s->isairq); ide_init2(&s->bus, s->irq); - vmstate_register(&dev->qdev, 0, &vmstate_ide_isa, s); - return 0; + vmstate_register(dev, 0, &vmstate_ide_isa, s); }; ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq, @@ -113,8 +113,8 @@ static Property isa_ide_properties[] = { static void isa_ide_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); - ic->init = isa_ide_initfn; + + dc->realize = isa_ide_realizefn; dc->fw_name = "ide"; dc->reset = isa_ide_reset; dc->props = isa_ide_properties; |