qdev: Convert to qdev_unrealize() with Coccinelle
commit981c3dcd948907f1127bc1d85b6e455dce687096
authorMarkus Armbruster <armbru@redhat.com>
Wed, 10 Jun 2020 05:31:56 +0000 (10 07:31 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 15 Jun 2020 19:36:30 +0000 (15 21:36 +0200)
treeba8b8731ecb8be71cf5b1402f8a7c7b251ffbcce
parentf1483b466d7b607d45606a4287fea79380b7900d
qdev: Convert to qdev_unrealize() with Coccinelle

For readability, and consistency with qbus_realize().

Coccinelle script:

    @ depends on !(file in "hw/core/qdev.c")@
    typedef DeviceState;
    DeviceState *dev;
    symbol false, error_abort;
    @@
    -    object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
    +    qdev_unrealize(dev);

    @ depends on !(file in "hw/core/qdev.c") && !(file in "hw/core/bus.c")@
    expression dev;
    symbol false, error_abort;
    @@
    -    object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
    +    qdev_unrealize(DEVICE(dev));

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200610053247.1583243-8-armbru@redhat.com>
hw/acpi/pcihp.c
hw/char/serial-pci-multi.c
hw/char/serial-pci.c
hw/core/bus.c
hw/i386/pc.c
hw/pci/pcie.c
hw/pci/shpc.c
hw/ppc/spapr.c
hw/ppc/spapr_pci.c
hw/s390x/css-bridge.c
hw/s390x/s390-pci-bus.c