aboutsummaryrefslogtreecommitdiff
path: root/hw/pci
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-10 07:31:56 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-06-15 21:36:30 +0200
commit981c3dcd948907f1127bc1d85b6e455dce687096 (patch)
treeba8b8731ecb8be71cf5b1402f8a7c7b251ffbcce /hw/pci
parentf1483b466d7b607d45606a4287fea79380b7900d (diff)
downloadqemu-981c3dcd948907f1127bc1d85b6e455dce687096.zip
qemu-981c3dcd948907f1127bc1d85b6e455dce687096.tar.gz
qemu-981c3dcd948907f1127bc1d85b6e455dce687096.tar.bz2
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>
Diffstat (limited to 'hw/pci')
-rw-r--r--hw/pci/pcie.c2
-rw-r--r--hw/pci/shpc.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 5b9c022..086d0df 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -460,7 +460,7 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
void pcie_cap_slot_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
- object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
+ qdev_unrealize(dev);
}
static void pcie_unplug_device(PCIBus *bus, PCIDevice *dev, void *opaque)
diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
index b76d3d2..99d65d5 100644
--- a/hw/pci/shpc.c
+++ b/hw/pci/shpc.c
@@ -547,7 +547,7 @@ void shpc_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
void shpc_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp)
{
- object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
+ qdev_unrealize(dev);
}
void shpc_device_unplug_request_cb(HotplugHandler *hotplug_dev,