]> git.proxmox.com Git - mirror_qemu.git/commit - hw/char/serial-pci.c
qom: Less verbose object_initialize_child()
authorMarkus Armbruster <armbru@redhat.com>
Wed, 10 Jun 2020 05:32:25 +0000 (07:32 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 15 Jun 2020 20:05:28 +0000 (22:05 +0200)
commit9fc7fc4d3909817555ce0af6bcb69dff1606140d
tree223b3f8397ee9ee93e6b652daf423f5ec02052ac
parent19dc7e977c145cf3683dc5d18d54ef3629e34619
qom: Less verbose object_initialize_child()

All users of object_initialize_child() pass the obvious child size
argument.  Almost all pass &error_abort and no properties.  Tiresome.

Rename object_initialize_child() to
object_initialize_child_with_props() to free the name.  New
convenience wrapper object_initialize_child() automates the size
argument, and passes &error_abort and no properties.

Rename object_initialize_childv() to
object_initialize_child_with_propsv() for consistency.

Convert callers with this Coccinelle script:

    @@
    expression parent, propname, type;
    expression child, size;
    symbol error_abort;
    @@
    -    object_initialize_child(parent, propname, OBJECT(child), size, type, &error_abort, NULL)
    +    object_initialize_child(parent, propname, child, size, type, &error_abort, NULL)

    @@
    expression parent, propname, type;
    expression child;
    symbol error_abort;
    @@
    -    object_initialize_child(parent, propname, child, sizeof(*child), type, &error_abort, NULL)
    +    object_initialize_child(parent, propname, child, type)

    @@
    expression parent, propname, type;
    expression child;
    symbol error_abort;
    @@
    -    object_initialize_child(parent, propname, &child, sizeof(child), type, &error_abort, NULL)
    +    object_initialize_child(parent, propname, &child, type)

    @@
    expression parent, propname, type;
    expression child, size, err;
    expression list props;
    @@
    -    object_initialize_child(parent, propname, child, size, type, err, props)
    +    object_initialize_child_with_props(parent, propname, child, size, type, err, props)

Note that Coccinelle chokes on ARMSSE typedef vs. macro in
hw/arm/armsse.c.  Worked around by temporarily renaming the macro for
the spatch run.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
[Rebased: machine opentitan is new (commit fe0fe4735e7)]
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-37-armbru@redhat.com>
51 files changed:
hw/arm/allwinner-a10.c
hw/arm/allwinner-h3.c
hw/arm/armsse.c
hw/arm/aspeed.c
hw/arm/aspeed_ast2600.c
hw/arm/aspeed_soc.c
hw/arm/bcm2836.c
hw/arm/digic.c
hw/arm/exynos4210.c
hw/arm/fsl-imx25.c
hw/arm/fsl-imx31.c
hw/arm/fsl-imx6.c
hw/arm/fsl-imx6ul.c
hw/arm/fsl-imx7.c
hw/arm/imx25_pdk.c
hw/arm/kzm.c
hw/arm/mps2-tz.c
hw/arm/musca.c
hw/arm/raspi.c
hw/arm/stm32f405_soc.c
hw/arm/xlnx-versal.c
hw/arm/xlnx-zcu102.c
hw/arm/xlnx-zynqmp.c
hw/char/serial-isa.c
hw/char/serial-pci-multi.c
hw/char/serial-pci.c
hw/char/serial.c
hw/core/sysbus.c
hw/dma/xilinx_axidma.c
hw/intc/pnv_xive.c
hw/intc/spapr_xive.c
hw/microblaze/xlnx-zynqmp-pmu.c
hw/misc/macio/macio.c
hw/net/xilinx_axienet.c
hw/pci-host/designware.c
hw/pci-host/gpex.c
hw/pci-host/pnv_phb3.c
hw/pci-host/pnv_phb4.c
hw/pci-host/pnv_phb4_pec.c
hw/pci-host/q35.c
hw/pci-host/xilinx-pcie.c
hw/ppc/pnv.c
hw/ppc/pnv_psi.c
hw/ppc/spapr.c
hw/riscv/opentitan.c
hw/riscv/riscv_hart.c
hw/riscv/sifive_e.c
hw/riscv/sifive_u.c
hw/virtio/virtio.c
include/qom/object.h
qom/object.c