[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 80/84] qdev: Make qdev_realize() support bus-less devices
From: |
Markus Armbruster |
Subject: |
[PULL 80/84] qdev: Make qdev_realize() support bus-less devices |
Date: |
Mon, 15 Jun 2020 22:40:04 +0200 |
So far, qdev_realize() supports only devices that plug into a bus:
argument @bus cannot be null. Extend it to support bus-less devices,
too.
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-55-armbru@redhat.com>
---
hw/core/qdev.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 78a06db76e..50336168f2 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -408,7 +408,7 @@ void qdev_init_nofail(DeviceState *dev)
/*
* Realize @dev.
* @dev must not be plugged into a bus.
- * Plug @dev into @bus. This takes a reference to @dev.
+ * If @bus, plug @dev into @bus. This takes a reference to @dev.
* If @dev has no QOM parent, make one up, taking another reference.
* On success, return true.
* On failure, store an error through @errp and return false.
@@ -418,9 +418,12 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error
**errp)
Error *err = NULL;
assert(!dev->realized && !dev->parent_bus);
- assert(bus);
- qdev_set_parent_bus(dev, bus);
+ if (bus) {
+ qdev_set_parent_bus(dev, bus);
+ } else {
+ assert(!DEVICE_GET_CLASS(dev)->bus_type);
+ }
object_property_set_bool(OBJECT(dev), true, "realized", &err);
if (err) {
--
2.26.2
- [PULL 43/84] pci: pci_create(), pci_create_multifunction() are now unused, drop, (continued)
- [PULL 43/84] pci: pci_create(), pci_create_multifunction() are now unused, drop, Markus Armbruster, 2020/06/15
- [PULL 13/84] pnv/phb4: Delete unused "pnv-phb4-pec-stack" devices, Markus Armbruster, 2020/06/15
- [PULL 55/84] usb: Eliminate usb_try_create_simple(), Markus Armbruster, 2020/06/15
- [PULL 63/84] macio: Convert use of qdev_set_parent_bus(), Markus Armbruster, 2020/06/15
- [PULL 84/84] MAINTAINERS: Make section QOM cover hw/core/*bus.c as well, Markus Armbruster, 2020/06/15
- [PULL 74/84] sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 2, Markus Armbruster, 2020/06/15
- [PULL 28/84] Revert "hw/prep: realize the PCI root bus as part of the prep init", Markus Armbruster, 2020/06/15
- [PULL 81/84] qdev: Use qdev_realize() in qdev_device_add(), Markus Armbruster, 2020/06/15
- [PULL 12/84] macio: Delete unused "macio-gpio" devices, Markus Armbruster, 2020/06/15
- [PULL 78/84] microbit: Eliminate two local variables in microbit_init(), Markus Armbruster, 2020/06/15
- [PULL 80/84] qdev: Make qdev_realize() support bus-less devices,
Markus Armbruster <=
- [PULL 76/84] sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 4, Markus Armbruster, 2020/06/15
- [PULL 70/84] sysbus: New sysbus_realize(), sysbus_realize_and_unref(), Markus Armbruster, 2020/06/15
- [PULL 67/84] sysbus: Tidy up sysbus_init_child_obj()'s @childsize arg, part 1, Markus Armbruster, 2020/06/15
- [PULL 82/84] qdev: Convert bus-less devices to qdev_realize() with Coccinelle, Markus Armbruster, 2020/06/15
- [PULL 79/84] s390x/event-facility: Simplify creation of SCLP event devices, Markus Armbruster, 2020/06/15
- [PULL 48/84] ssi: ssi_auto_connect_slaves() never does anything, drop, Markus Armbruster, 2020/06/15
- [PULL 61/84] qom: Tidy up a few object_initialize_child() calls, Markus Armbruster, 2020/06/15
- [PULL 60/84] auxbus: Eliminate aux_create_slave(), Markus Armbruster, 2020/06/15
- [PULL 59/84] auxbus: Convert a use of qdev_set_parent_bus(), Markus Armbruster, 2020/06/15
- [PULL 75/84] sysbus: Convert qdev_set_parent_bus() use with Coccinelle, part 3, Markus Armbruster, 2020/06/15