[PATCH v3 08/39] qdev: Convert to qdev_unrealize() manually

Markus Armbruster posted 39 patches 5 years, 8 months ago
Maintainers: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Leif Lindholm <leif@nuviainc.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Juan Quintela <quintela@redhat.com>, Peter Chubb <peter.chubb@nicta.com.au>, "Hervé Poussineau" <hpoussin@reactos.org>, Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>, Samuel Thibault <samuel.thibault@ens-lyon.org>, Max Reitz <mreitz@redhat.com>, Helge Deller <deller@gmx.de>, Aurelien Jarno <aurelien@aurel32.net>, "Cédric Le Goater" <clg@kaod.org>, Thomas Huth <huth@tuxfamily.org>, Andrew Jeffery <andrew@aj.id.au>, Stafford Horne <shorne@gmail.com>, Magnus Damm <magnus.damm@gmail.com>, Chris Wulff <crwulff@gmail.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Max Filippov <jcmvbkbc@gmail.com>, Halil Pasic <pasic@linux.ibm.com>, Jason Wang <jasowang@redhat.com>, John Snow <jsnow@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Artyom Tarasenko <atar4qemu@gmail.com>, BALATON Zoltan <balaton@eik.bme.hu>, Rob Herring <robh@kernel.org>, Peter Maydell <peter.maydell@linaro.org>, Cornelia Huck <cohuck@redhat.com>, Fabien Chouteau <chouteau@adacore.com>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, Matthew Rosato <mjrosato@linux.ibm.com>, Beniamino Galvani <b.galvani@gmail.com>, Sagar Karandikar <sagark@eecs.berkeley.edu>, "Daniel P. Berrangé" <berrange@redhat.com>, Huacai Chen <chenhc@lemote.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Jan Kiszka <jan.kiszka@web.de>, Igor Mammedov <imammedo@redhat.com>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Tony Krowiak <akrowiak@linux.ibm.com>, Stefano Stabellini <sstabellini@kernel.org>, Christian Borntraeger <borntraeger@de.ibm.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Jia Liu <proljc@gmail.com>, Laurent Vivier <laurent@vivier.eu>, KONRAD Frederic <frederic.konrad@adacore.com>, Paul Durrant <paul@xen.org>, Jean-Christophe Dubois <jcd@tribudubois.net>, Igor Mitsyanko <i.mitsyanko@gmail.com>, Fam Zheng <fam@euphon.net>, Andrew Baumann <Andrew.Baumann@microsoft.com>, Paul Burton <pburton@wavecomp.com>, Anthony Perard <anthony.perard@citrix.com>, Alistair Francis <alistair@alistair23.me>, Palmer Dabbelt <palmer@dabbelt.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Corey Minyard <cminyard@mvista.com>, Marek Vasut <marex@denx.de>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Richard Henderson <rth@twiddle.net>, Michael Walle <michael@walle.cc>, Antony Pavlov <antonynpavlov@gmail.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, Eduardo Habkost <ehabkost@redhat.com>, Andrzej Zaborowski <balrogg@gmail.com>, Pierre Morel <pmorel@linux.ibm.com>, Joel Stanley <joel@jms.id.au>, Laszlo Ersek <lersek@redhat.com>, Radoslaw Biernacki <radoslaw.biernacki@linaro.org>, Kevin Wolf <kwolf@redhat.com>, Niek Linnenbank <nieklinnenbank@gmail.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Thomas Huth <thuth@redhat.com>, David Hildenbrand <david@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
[PATCH v3 08/39] qdev: Convert to qdev_unrealize() manually
Posted by Markus Armbruster 5 years, 8 months ago
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/qdev-core.h | 1 -
 hw/core/qdev.c         | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index fba29308f7..be6f7c4736 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -328,7 +328,6 @@ void qdev_init_nofail(DeviceState *dev);
 bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp);
 bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp);
 void qdev_unrealize(DeviceState *dev);
-
 void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
                                  int required_for_version);
 HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev);
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index b7355fbcd0..4768244f31 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -421,7 +421,7 @@ static void device_reset_child_foreach(Object *obj, ResettableChildCallback cb,
 void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
                                   DeviceState *dev, Error **errp)
 {
-    object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
+    qdev_unrealize(dev);
 }
 
 /*
@@ -1183,7 +1183,7 @@ static void device_unparent(Object *obj)
     BusState *bus;
 
     if (dev->realized) {
-        object_property_set_bool(obj, false, "realized", &error_abort);
+        qdev_unrealize(dev);
     }
     while (dev->num_child_bus) {
         bus = QLIST_FIRST(&dev->child_bus);
-- 
2.26.2