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
This commit is contained in:
Gerd Hoffmann 2020-06-24 15:10:38 +02:00
parent 0f8198f1b2
commit 7ab6e7fcce
4 changed files with 11 additions and 7 deletions

View file

@ -147,6 +147,7 @@ static void qdev_print_devinfos(bool show_no_user)
int i;
bool cat_printed;
module_load_qom_all();
list = object_class_get_list_sorted(TYPE_DEVICE, false);
for (i = 0; i <= DEVICE_CATEGORY_MAX; i++) {
@ -215,13 +216,13 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)
DeviceClass *dc;
const char *original_name = *driver;
oc = object_class_by_name(*driver);
oc = module_object_class_by_name(*driver);
if (!oc) {
const char *typename = find_typename_by_alias(*driver);
if (typename) {
*driver = typename;
oc = object_class_by_name(*driver);
oc = module_object_class_by_name(*driver);
}
}