mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
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]
|
||
|---|---|---|
| .. | ||
| macio | ||
| a9scu.h | ||
| allwinner-cpucfg.h | ||
| allwinner-h3-ccu.h | ||
| allwinner-h3-dramc.h | ||
| allwinner-h3-sysctrl.h | ||
| allwinner-sid.h | ||
| arm11scu.h | ||
| arm_integrator_debug.h | ||
| armsse-cpuid.h | ||
| armsse-mhu.h | ||
| aspeed_scu.h | ||
| aspeed_sdmc.h | ||
| aspeed_xdma.h | ||
| auxbus.h | ||
| bcm2835_mbox.h | ||
| bcm2835_mbox_defs.h | ||
| bcm2835_mphi.h | ||
| bcm2835_property.h | ||
| bcm2835_rng.h | ||
| bcm2835_thermal.h | ||
| cbus.h | ||
| empty_slot.h | ||
| grlib_ahb_apb_pnp.h | ||
| imx6_ccm.h | ||
| imx6_src.h | ||
| imx6ul_ccm.h | ||
| imx7_ccm.h | ||
| imx7_gpr.h | ||
| imx7_snvs.h | ||
| imx25_ccm.h | ||
| imx31_ccm.h | ||
| imx_ccm.h | ||
| imx_rngc.h | ||
| iotkit-secctl.h | ||
| iotkit-sysctl.h | ||
| iotkit-sysinfo.h | ||
| ivshmem.h | ||
| mac_via.h | ||
| mips_cmgcr.h | ||
| mips_cpc.h | ||
| mips_itu.h | ||
| mos6522.h | ||
| mps2-fpgaio.h | ||
| mps2-scc.h | ||
| msf2-sysreg.h | ||
| nrf51_rng.h | ||
| pca9552.h | ||
| pca9552_regs.h | ||
| pvpanic.h | ||
| stm32f2xx_syscfg.h | ||
| stm32f4xx_exti.h | ||
| stm32f4xx_syscfg.h | ||
| tmp105_regs.h | ||
| tz-mpc.h | ||
| tz-msc.h | ||
| tz-ppc.h | ||
| unimp.h | ||
| vmcoreinfo.h | ||
| zynq-xadc.h | ||