aboutsummaryrefslogtreecommitdiff
path: root/hw/dma
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-10 07:32:08 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-15 22:05:28 +0200
commit96927c744f9cd5205f95ef897c35695038dc2896 (patch)
tree5da3a4cb78c4ea9f2b9ae4c240d3f22d5cd24dae /hw/dma
parent0fe9d9011971820b2dab27aa49cfb957b91cc3e2 (diff)
isa: Convert uses of isa_create() with Coccinelle
Replace dev = isa_create(bus, type_name); ... qdev_init_nofail(dev); by dev = isa_new(type_name); ... isa_realize_and_unref(dev, bus, &error_fatal); Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains why. Coccinelle script: @@ expression dev, bus, expr; expression list args; expression d; @@ - dev = isa_create(bus, args); + dev = isa_new(args); ( d = &dev->qdev; | d = DEVICE(dev); ) ... when != dev = expr - qdev_init_nofail(d); + isa_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev = isa_create(bus, args); + dev = isa_new(args); ... when != dev = expr - qdev_init_nofail(DEVICE(dev)); + isa_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev = DEVICE(isa_create(bus, args)); + ISADevice *isa_dev; // TODO move + isa_dev = isa_new(args); + dev = DEVICE(isa_dev); ... when != dev = expr - qdev_init_nofail(dev); + isa_realize_and_unref(isa_dev, bus, &error_fatal); Missing #include "qapi/error.h" added manually, whitespace changes minimized manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200610053247.1583243-20-armbru@redhat.com>
Diffstat (limited to 'hw/dma')
-rw-r--r--hw/dma/i8257.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index 1b3435ab58..db808029b0 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -27,6 +27,7 @@
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "hw/dma/i8257.h"
+#include "qapi/error.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"
#include "qemu/log.h"
@@ -638,21 +639,21 @@ void i8257_dma_init(ISABus *bus, bool high_page_enable)
ISADevice *isa1, *isa2;
DeviceState *d;
- isa1 = isa_create(bus, TYPE_I8257);
+ isa1 = isa_new(TYPE_I8257);
d = DEVICE(isa1);
qdev_prop_set_int32(d, "base", 0x00);
qdev_prop_set_int32(d, "page-base", 0x80);
qdev_prop_set_int32(d, "pageh-base", high_page_enable ? 0x480 : -1);
qdev_prop_set_int32(d, "dshift", 0);
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa1, bus, &error_fatal);
- isa2 = isa_create(bus, TYPE_I8257);
+ isa2 = isa_new(TYPE_I8257);
d = DEVICE(isa2);
qdev_prop_set_int32(d, "base", 0xc0);
qdev_prop_set_int32(d, "page-base", 0x88);
qdev_prop_set_int32(d, "pageh-base", high_page_enable ? 0x488 : -1);
qdev_prop_set_int32(d, "dshift", 1);
- qdev_init_nofail(d);
+ isa_realize_and_unref(isa2, bus, &error_fatal);
isa_bus_dma(bus, ISADMA(isa1), ISADMA(isa2));
}