qemu-e2k/hw
Markus Armbruster 3e80f6902c qdev: Convert uses of qdev_create() with Coccinelle
This is the transformation explained in the commit before previous.
Takes care of just one pattern that needs conversion.  More to come in
this series.

Coccinelle script:

    @ depends on !(file in "hw/arm/highbank.c")@
    expression bus, type_name, dev, expr;
    @@
    -    dev = qdev_create(bus, type_name);
    +    dev = qdev_new(type_name);
         ... when != dev = expr
    -    qdev_init_nofail(dev);
    +    qdev_realize_and_unref(dev, bus, &error_fatal);

    @@
    expression bus, type_name, dev, expr;
    identifier DOWN;
    @@
    -    dev = DOWN(qdev_create(bus, type_name));
    +    dev = DOWN(qdev_new(type_name));
         ... when != dev = expr
    -    qdev_init_nofail(DEVICE(dev));
    +    qdev_realize_and_unref(DEVICE(dev), bus, &error_fatal);

    @@
    expression bus, type_name, expr;
    identifier dev;
    @@
    -    DeviceState *dev = qdev_create(bus, type_name);
    +    DeviceState *dev = qdev_new(type_name);
         ... when != dev = expr
    -    qdev_init_nofail(dev);
    +    qdev_realize_and_unref(dev, bus, &error_fatal);

    @@
    expression bus, type_name, dev, expr, errp;
    symbol true;
    @@
    -    dev = qdev_create(bus, type_name);
    +    dev = qdev_new(type_name);
         ... when != dev = expr
    -    object_property_set_bool(OBJECT(dev), true, "realized", errp);
    +    qdev_realize_and_unref(dev, bus, errp);

    @@
    expression bus, type_name, expr, errp;
    identifier dev;
    symbol true;
    @@
    -    DeviceState *dev = qdev_create(bus, type_name);
    +    DeviceState *dev = qdev_new(type_name);
         ... when != dev = expr
    -    object_property_set_bool(OBJECT(dev), true, "realized", errp);
    +    qdev_realize_and_unref(dev, bus, errp);

The first rule exempts hw/arm/highbank.c, because it matches along two
control flow paths there, with different @type_name.  Covered by the
next commit's manual conversions.

Missing #include "qapi/error.h" added manually.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-10-armbru@redhat.com>
[Conflicts in hw/misc/empty_slot.c and hw/sparc/leon3.c resolved]
2020-06-15 22:00:10 +02:00
..
9pfs
acpi qdev: Convert to qdev_unrealize() with Coccinelle 2020-06-15 21:36:30 +02:00
adc
alpha qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
arm qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
audio qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
block qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
char qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
core qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
cpu
cris qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
display qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
dma qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
gpio hw/unicore32/puv3: Use qemu_log_mask(ERROR) instead of debug printf() 2020-06-09 19:01:56 +02:00
hppa qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
hyperv vmbus: add infrastructure to save/load vmbus requests 2020-06-10 12:09:41 -04:00
i2c qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
i386 qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
ide qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
input
intc qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
ipack
ipmi
isa qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
lm32 qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
m68k qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
mem
microblaze qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
mips qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
misc qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
moxie
net qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
nios2 qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
nubus
nvram qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
openrisc qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
pci qdev: Convert to qdev_unrealize() with Coccinelle 2020-06-15 21:36:30 +02:00
pci-bridge qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
pci-host qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
pcmcia qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
ppc qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
rdma
riscv qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
rtc qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
s390x qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
scsi qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
sd qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
semihosting semihosting: remove the pthread include which seems unused 2020-06-10 11:29:44 +02:00
sh4 qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
smbios
sparc qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
sparc64 qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
ssi
timer Trivial branch pull request 20200610 2020-06-11 19:22:52 +01:00
tpm
tricore
unicore32 hw/unicore32/puv3: Use qemu_log_mask(ERROR) instead of debug printf() 2020-06-09 19:01:56 +02:00
usb exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h' 2020-06-12 11:20:15 -04:00
vfio * Miscellaneous fixes and feature enablement (many) 2020-06-12 23:06:22 +01:00
virtio virtio,acpi,pci: features, fixes, cleanups, tests 2020-06-12 15:53:49 +01:00
watchdog
xen qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
xenpv
xtensa qdev: Convert uses of qdev_create() with Coccinelle 2020-06-15 22:00:10 +02:00
Kconfig
Makefile.objs xen: fix build without pci passthrough 2020-06-12 11:20:12 -04:00