From db895a1e6a97e919f9b86d60c969377357b05066 Mon Sep 17 00:00:00 2001 From: Andreas Färber 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/misc/pc-testdev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'hw/misc/pc-testdev.c') diff --git a/hw/misc/pc-testdev.c b/hw/misc/pc-testdev.c index 32df175c10..e6707d69d4 100644 --- a/hw/misc/pc-testdev.c +++ b/hw/misc/pc-testdev.c @@ -142,9 +142,10 @@ static const MemoryRegionOps test_iomem_ops = { .endianness = DEVICE_LITTLE_ENDIAN, }; -static int init_test_device(ISADevice *isa) +static void testdev_realizefn(DeviceState *d, Error **errp) { - PCTestdev *dev = TESTDEV(isa); + ISADevice *isa = ISA_DEVICE(d); + PCTestdev *dev = TESTDEV(d); MemoryRegion *mem = isa_address_space(isa); MemoryRegion *io = isa_address_space_io(isa); @@ -161,15 +162,13 @@ static int init_test_device(ISADevice *isa) memory_region_add_subregion(io, 0xe4, &dev->flush); memory_region_add_subregion(io, 0x2000, &dev->irq); memory_region_add_subregion(mem, 0xff000000, &dev->iomem); - - return 0; } static void testdev_class_init(ObjectClass *klass, void *data) { - ISADeviceClass *k = ISA_DEVICE_CLASS(klass); + DeviceClass *dc = DEVICE_CLASS(klass); - k->init = init_test_device; + dc->realize = testdev_realizefn; } static const TypeInfo testdev_info = { -- cgit 1.4.1