qdev: Drop legacy hotplug fields/methods
It removes not needed anymore BusState::allow_hotplug field and DeviceClass::unplug callback. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
5f4d917376
commit
2d9a982f37
|
@ -114,7 +114,6 @@ static void qbus_set_hotplug_handler_internal(BusState *bus, Object *handler,
|
||||||
|
|
||||||
object_property_set_link(OBJECT(bus), OBJECT(handler),
|
object_property_set_link(OBJECT(bus), OBJECT(handler),
|
||||||
QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
|
QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
|
||||||
bus->allow_hotplug = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error **errp)
|
void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error **errp)
|
||||||
|
@ -254,10 +253,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
|
||||||
hotplug_handler_unplug(dev->parent_bus->hotplug_handler, dev, errp);
|
hotplug_handler_unplug(dev->parent_bus->hotplug_handler, dev, errp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(dc->unplug != NULL);
|
assert(0);
|
||||||
if (dc->unplug(dev) < 0) { /* legacy handler */
|
|
||||||
error_set(errp, QERR_UNDEFINED_ERROR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,17 +290,11 @@ void qbus_reset_all_fn(void *opaque)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* can be used as ->unplug() callback for the simple cases */
|
/* can be used as ->unplug() callback for the simple cases */
|
||||||
int qdev_simple_unplug_cb(DeviceState *dev)
|
|
||||||
{
|
|
||||||
/* just zap it */
|
|
||||||
object_unparent(OBJECT(dev));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
|
void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
|
||||||
DeviceState *dev, Error **errp)
|
DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
qdev_simple_unplug_cb(dev);
|
/* just zap it */
|
||||||
|
object_unparent(OBJECT(dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Like qdev_init(), but terminate program via error_report() instead of
|
/* Like qdev_init(), but terminate program via error_report() instead of
|
||||||
|
|
|
@ -126,7 +126,6 @@ typedef struct DeviceClass {
|
||||||
|
|
||||||
/* Private to qdev / bus. */
|
/* Private to qdev / bus. */
|
||||||
qdev_initfn init; /* TODO remove, once users are converted to realize */
|
qdev_initfn init; /* TODO remove, once users are converted to realize */
|
||||||
qdev_event unplug;
|
|
||||||
qdev_event exit; /* TODO remove, once users are converted to unrealize */
|
qdev_event exit; /* TODO remove, once users are converted to unrealize */
|
||||||
const char *bus_type;
|
const char *bus_type;
|
||||||
} DeviceClass;
|
} DeviceClass;
|
||||||
|
@ -210,7 +209,6 @@ struct BusState {
|
||||||
Object obj;
|
Object obj;
|
||||||
DeviceState *parent;
|
DeviceState *parent;
|
||||||
const char *name;
|
const char *name;
|
||||||
int allow_hotplug;
|
|
||||||
HotplugHandler *hotplug_handler;
|
HotplugHandler *hotplug_handler;
|
||||||
int max_index;
|
int max_index;
|
||||||
bool realized;
|
bool realized;
|
||||||
|
@ -264,7 +262,6 @@ void qdev_init_nofail(DeviceState *dev);
|
||||||
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
|
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
|
||||||
int required_for_version);
|
int required_for_version);
|
||||||
void qdev_unplug(DeviceState *dev, Error **errp);
|
void qdev_unplug(DeviceState *dev, Error **errp);
|
||||||
int qdev_simple_unplug_cb(DeviceState *dev);
|
|
||||||
void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
|
void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
|
||||||
DeviceState *dev, Error **errp);
|
DeviceState *dev, Error **errp);
|
||||||
void qdev_machine_creation_done(void);
|
void qdev_machine_creation_done(void);
|
||||||
|
@ -370,6 +367,6 @@ void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp);
|
||||||
|
|
||||||
static inline bool qbus_is_hotpluggable(BusState *bus)
|
static inline bool qbus_is_hotpluggable(BusState *bus)
|
||||||
{
|
{
|
||||||
return bus->allow_hotplug || bus->hotplug_handler;
|
return bus->hotplug_handler;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue