On Tue, May 15, 2012 at 7:15 PM, Stefano Stabellini <stefano.stabell...@eu.citrix.com> wrote: > On Tue, 15 May 2012, Anthony PERARD wrote: >> This function will be use to force a device to be ejected without the guest >> cooperation. >> >> Signed-off-by: Anthony PERARD <anthony.per...@citrix.com> >> --- >> hw/qdev.c | 23 ++++++++++++++++++++--- >> hw/qdev.h | 3 +++ >> 2 files changed, 23 insertions(+), 3 deletions(-) >> >> diff --git a/hw/qdev.c b/hw/qdev.c >> index 6a8f6bd..c95d4c2 100644 >> --- a/hw/qdev.c >> +++ b/hw/qdev.c >> @@ -184,24 +184,41 @@ void qdev_set_legacy_instance_id(DeviceState *dev, int >> alias_id, >> dev->alias_required_for_version = required_for_version; >> } >> >> -void qdev_unplug(DeviceState *dev, Error **errp) >> +static void qdev_unplug_common(DeviceState *dev, Error **errp, bool force) >> { >> DeviceClass *dc = DEVICE_GET_CLASS(dev); >> + qdev_event unplug; >> >> if (!dev->parent_bus->allow_hotplug) { >> error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name); >> return; >> } >> - assert(dc->unplug != NULL); >> + >> + if (force) { >> + unplug = dc->force_unplug; >> + } else { >> + unplug = dc->unplug; >> + } >> + assert(unplug != NULL); > > unplug needs to be initialized to NULL above
Why? unplug is not used before to be set. But I can do that for the next version if there is one. -- Anthony PERARD