mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
qdev: hotplug: Introduce HotplugHandler.pre_plug() callback
pre_plug callback is to be called before device.realize() is executed. This would allow to check/set device's properties from HotplugHandler. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
2e11b15dff
commit
41346263c4
3 changed files with 32 additions and 2 deletions
|
@ -902,6 +902,14 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
|||
g_free(name);
|
||||
}
|
||||
|
||||
hotplug_ctrl = qdev_get_hotplug_handler(dev);
|
||||
if (hotplug_ctrl) {
|
||||
hotplug_handler_pre_plug(hotplug_ctrl, dev, &local_err);
|
||||
if (local_err != NULL) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (dc->realize) {
|
||||
dc->realize(dev, &local_err);
|
||||
}
|
||||
|
@ -912,7 +920,6 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
|||
|
||||
DEVICE_LISTENER_CALL(realize, Forward, dev);
|
||||
|
||||
hotplug_ctrl = qdev_get_hotplug_handler(dev);
|
||||
if (hotplug_ctrl) {
|
||||
hotplug_handler_plug(hotplug_ctrl, dev, &local_err);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue