From db895a1e6a97e919f9b86d60c969377357b05066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 25 Nov 2012 02:37:14 +0100 Subject: isa: Use realizefn for ISADevice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- hw/intc/i8259_common.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'hw/intc/i8259_common.c') diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c index c2ba6a5..a3dee38 100644 --- a/hw/intc/i8259_common.c +++ b/hw/intc/i8259_common.c @@ -66,7 +66,7 @@ static int pic_dispatch_post_load(void *opaque, int version_id) return 0; } -static int pic_init_common(ISADevice *dev) +static void pic_common_realize(DeviceState *dev, Error **errp) { PICCommonState *s = PIC_COMMON(dev); PICCommonClass *info = PIC_COMMON_GET_CLASS(s); @@ -78,9 +78,7 @@ static int pic_init_common(ISADevice *dev) isa_register_ioport(NULL, &s->elcr_io, s->elcr_addr); } - qdev_set_legacy_instance_id(DEVICE(dev), s->iobase, 1); - - return 0; + qdev_set_legacy_instance_id(dev, s->iobase, 1); } ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master) @@ -135,13 +133,12 @@ static Property pic_properties_common[] = { static void pic_common_class_init(ObjectClass *klass, void *data) { - ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_pic_common; dc->no_user = 1; dc->props = pic_properties_common; - ic->init = pic_init_common; + dc->realize = pic_common_realize; } static const TypeInfo pic_common_type = { -- cgit v1.1