object_property_set_link(OBJECT(bus), OBJECT(handler),
QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
- bus->allow_hotplug = 1;
}
void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error **errp)
hotplug_handler_unplug(dev->parent_bus->hotplug_handler, dev, errp);
}
} else {
- assert(dc->unplug != NULL);
- if (dc->unplug(dev) < 0) { /* legacy handler */
- error_set(errp, QERR_UNDEFINED_ERROR);
- }
+ assert(0);
}
}
}
/* 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,
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
/* Private to qdev / bus. */
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 */
const char *bus_type;
} DeviceClass;
Object obj;
DeviceState *parent;
const char *name;
- int allow_hotplug;
HotplugHandler *hotplug_handler;
int max_index;
bool realized;
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
int required_for_version);
void qdev_unplug(DeviceState *dev, Error **errp);
-int qdev_simple_unplug_cb(DeviceState *dev);
void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp);
void qdev_machine_creation_done(void);
static inline bool qbus_is_hotpluggable(BusState *bus)
{
- return bus->allow_hotplug || bus->hotplug_handler;
+ return bus->hotplug_handler;
}
#endif