summaryrefslogtreecommitdiff
path: root/hw/dma
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-11-25 02:37:14 +0100
committerAndreas Färber <afaerber@suse.de>2013-06-07 12:14:45 +0200
commitdb895a1e6a97e919f9b86d60c969377357b05066 (patch)
tree72f6786abe90f7fa77d2f10416df73cb9d62e35a /hw/dma
parenta3dcca567a1d4a5c79fb9c8fe2d9a21a4a7cebd5 (diff)
downloadqemu-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/dma')
-rw-r--r--hw/dma/i82374.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index f3d1924109..6192780fda 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -98,7 +98,7 @@ static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport)
return val;
}
-static void i82374_init(I82374State *s)
+static void i82374_realize(I82374State *s, Error **errp)
{
DMA_init(1, &s->out);
memset(s->commands, 0, sizeof(s->commands));
@@ -124,7 +124,7 @@ static const VMStateDescription vmstate_isa_i82374 = {
},
};
-static int i82374_isa_init(ISADevice *dev)
+static void i82374_isa_realize(DeviceState *dev, Error **errp)
{
ISAi82374State *isa = I82374(dev);
I82374State *s = &isa->state;
@@ -135,11 +135,9 @@ static int i82374_isa_init(ISADevice *dev)
register_ioport_write(isa->iobase + 0x20, 0x20, 1, i82374_write_descriptor, s);
register_ioport_read(isa->iobase + 0x20, 0x20, 1, i82374_read_descriptor, s);
- i82374_init(s);
+ i82374_realize(s, errp);
- qdev_init_gpio_out(&dev->qdev, &s->out, 1);
-
- return 0;
+ qdev_init_gpio_out(dev, &s->out, 1);
}
static Property i82374_properties[] = {
@@ -149,10 +147,9 @@ static Property i82374_properties[] = {
static void i82374_class_init(ObjectClass *klass, void *data)
{
- ISADeviceClass *k = ISA_DEVICE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
- k->init = i82374_isa_init;
+ dc->realize = i82374_isa_realize;
dc->vmsd = &vmstate_isa_i82374;
dc->props = i82374_properties;
}