summaryrefslogtreecommitdiffstats
path: root/hw/core/qdev.c
diff options
context:
space:
mode:
authorGerd Hoffmann2020-06-24 15:10:38 +0200
committerGerd Hoffmann2020-07-07 14:54:29 +0200
commit7ab6e7fcce9729d3a85e7e04737bc64a45a08772 (patch)
tree2afcf9df8ed7b8dca696eba4e5b677d516afbf43 /hw/core/qdev.c
parentobject: qom module support (diff)
downloadqemu-7ab6e7fcce9729d3a85e7e04737bc64a45a08772.tar.gz
qemu-7ab6e7fcce9729d3a85e7e04737bc64a45a08772.tar.xz
qemu-7ab6e7fcce9729d3a85e7e04737bc64a45a08772.zip
qdev: device module support
Hook module loading into the places where we need it when building devices as modules. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200624131045.14512-4-kraxel@redhat.com
Diffstat (limited to 'hw/core/qdev.c')
-rw-r--r--hw/core/qdev.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 2131c7f951..9de16eae05 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -137,6 +137,9 @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
*/
DeviceState *qdev_new(const char *name)
{
+ if (!object_class_by_name(name)) {
+ module_load_qom_one(name);
+ }
return DEVICE(object_new(name));
}
@@ -147,10 +150,9 @@ DeviceState *qdev_new(const char *name)
*/
DeviceState *qdev_try_new(const char *name)
{
- if (!object_class_by_name(name)) {
+ if (!module_object_class_by_name(name)) {
return NULL;
}
-
return DEVICE(object_new(name));
}