3e80f6902c
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.c | ||
allwinner-cpucfg.c | ||
allwinner-h3-ccu.c | ||
allwinner-h3-dramc.c | ||
allwinner-h3-sysctrl.c | ||
allwinner-sid.c | ||
applesmc.c | ||
arm11scu.c | ||
arm_integrator_debug.c | ||
arm_l2x0.c | ||
arm_sysctl.c | ||
armsse-cpuid.c | ||
armsse-mhu.c | ||
aspeed_scu.c | ||
aspeed_sdmc.c | ||
aspeed_xdma.c | ||
auxbus.c | ||
bcm2835_mbox.c | ||
bcm2835_mphi.c | ||
bcm2835_property.c | ||
bcm2835_rng.c | ||
bcm2835_thermal.c | ||
cbus.c | ||
debugexit.c | ||
eccmemctl.c | ||
edu.c | ||
empty_slot.c | ||
exynos4210_clk.c | ||
exynos4210_pmu.c | ||
exynos4210_rng.c | ||
grlib_ahb_apb_pnp.c | ||
imx6_ccm.c | ||
imx6_src.c | ||
imx6ul_ccm.c | ||
imx7_ccm.c | ||
imx7_gpr.c | ||
imx7_snvs.c | ||
imx25_ccm.c | ||
imx31_ccm.c | ||
imx_ccm.c | ||
imx_rngc.c | ||
iotkit-secctl.c | ||
iotkit-sysctl.c | ||
iotkit-sysinfo.c | ||
ivshmem.c | ||
Kconfig | ||
mac_via.c | ||
Makefile.objs | ||
max111x.c | ||
milkymist-hpdmc.c | ||
milkymist-pfpu.c | ||
mips_cmgcr.c | ||
mips_cpc.c | ||
mips_itu.c | ||
mos6522.c | ||
mps2-fpgaio.c | ||
mps2-scc.c | ||
msf2-sysreg.c | ||
mst_fpga.c | ||
nrf51_rng.c | ||
omap_clk.c | ||
omap_gpmc.c | ||
omap_l4.c | ||
omap_sdrc.c | ||
omap_tap.c | ||
pc-testdev.c | ||
pca9552.c | ||
pci-testdev.c | ||
puv3_pm.c | ||
pvpanic.c | ||
sga.c | ||
slavio_misc.c | ||
stm32f2xx_syscfg.c | ||
stm32f4xx_exti.c | ||
stm32f4xx_syscfg.c | ||
tmp105.c | ||
tmp105.h | ||
tmp421.c | ||
trace-events | ||
tz-mpc.c | ||
tz-msc.c | ||
tz-ppc.c | ||
unimp.c | ||
vmcoreinfo.c | ||
zynq_slcr.c | ||
zynq-xadc.c |