mirror of
https://github.com/qemu/qemu.git
synced 2024-12-29 07:03:40 +08:00
96927c744f
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>
43 lines
982 B
C
43 lines
982 B
C
/*
|
|
* QEMU Parallel PORT (ISA bus helpers)
|
|
*
|
|
* These functions reside in a separate file since they also might be
|
|
* required for linking when compiling QEMU without CONFIG_PARALLEL.
|
|
*
|
|
* Copyright (c) 2003 Fabrice Bellard
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "sysemu/sysemu.h"
|
|
#include "hw/isa/isa.h"
|
|
#include "hw/qdev-properties.h"
|
|
#include "hw/char/parallel.h"
|
|
#include "qapi/error.h"
|
|
|
|
static void parallel_init(ISABus *bus, int index, Chardev *chr)
|
|
{
|
|
DeviceState *dev;
|
|
ISADevice *isadev;
|
|
|
|
isadev = isa_new("isa-parallel");
|
|
dev = DEVICE(isadev);
|
|
qdev_prop_set_uint32(dev, "index", index);
|
|
qdev_prop_set_chr(dev, "chardev", chr);
|
|
isa_realize_and_unref(isadev, bus, &error_fatal);
|
|
}
|
|
|
|
void parallel_hds_isa_init(ISABus *bus, int n)
|
|
{
|
|
int i;
|
|
|
|
assert(n <= MAX_PARALLEL_PORTS);
|
|
|
|
for (i = 0; i < n; i++) {
|
|
if (parallel_hds[i]) {
|
|
parallel_init(bus, i, parallel_hds[i]);
|
|
}
|
|
}
|
|
}
|