mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-14 08:59:05 +00:00
usb: Convert usb devices to hotplug handler API
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
138d587afb
commit
5f4d917376
@ -24,10 +24,12 @@ static Property usb_props[] = {
|
||||
static void usb_bus_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
BusClass *k = BUS_CLASS(klass);
|
||||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||
|
||||
k->print_dev = usb_bus_dev_print;
|
||||
k->get_dev_path = usb_get_dev_path;
|
||||
k->get_fw_dev_path = usb_get_fw_dev_path;
|
||||
hc->unplug = qdev_simple_device_unplug_cb;
|
||||
}
|
||||
|
||||
static const TypeInfo usb_bus_info = {
|
||||
@ -35,6 +37,10 @@ static const TypeInfo usb_bus_info = {
|
||||
.parent = TYPE_BUS,
|
||||
.instance_size = sizeof(USBBus),
|
||||
.class_init = usb_bus_class_init,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
{ TYPE_HOTPLUG_HANDLER },
|
||||
{ }
|
||||
}
|
||||
};
|
||||
|
||||
static int next_usb_bus = 0;
|
||||
@ -79,9 +85,9 @@ void usb_bus_new(USBBus *bus, size_t bus_size,
|
||||
USBBusOps *ops, DeviceState *host)
|
||||
{
|
||||
qbus_create_inplace(bus, bus_size, TYPE_USB_BUS, host, NULL);
|
||||
qbus_set_bus_hotplug_handler(BUS(bus), &error_abort);
|
||||
bus->ops = ops;
|
||||
bus->busnr = next_usb_bus++;
|
||||
bus->qbus.allow_hotplug = 1; /* Yes, we can */
|
||||
QTAILQ_INIT(&bus->free);
|
||||
QTAILQ_INIT(&bus->used);
|
||||
QTAILQ_INSERT_TAIL(&busses, bus, next);
|
||||
@ -701,7 +707,6 @@ static void usb_device_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *k = DEVICE_CLASS(klass);
|
||||
k->bus_type = TYPE_USB_BUS;
|
||||
k->unplug = qdev_simple_unplug_cb;
|
||||
k->realize = usb_qdev_realize;
|
||||
k->unrealize = usb_qdev_unrealize;
|
||||
k->props = usb_props;
|
||||
|
Loading…
x
Reference in New Issue
Block a user