mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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:
parent
0f8198f1b2
commit
7ab6e7fcce
4 changed files with 11 additions and 7 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue