提交 e5a9bece 编写于 作者: G Gonglei 提交者: Gerd Hoffmann

usb: add usb_bus_release function

add global variables releasing logic when the usb buses
were removed or hot-unpluged.
Signed-off-by: NGonglei <arei.gonglei@huawei.com>
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 f90e160b
...@@ -87,6 +87,13 @@ void usb_bus_new(USBBus *bus, size_t bus_size, ...@@ -87,6 +87,13 @@ void usb_bus_new(USBBus *bus, size_t bus_size,
QTAILQ_INSERT_TAIL(&busses, bus, next); QTAILQ_INSERT_TAIL(&busses, bus, next);
} }
void usb_bus_release(USBBus *bus)
{
assert(next_usb_bus > 0);
QTAILQ_REMOVE(&busses, bus, next);
}
USBBus *usb_bus_find(int busnr) USBBus *usb_bus_find(int busnr)
{ {
USBBus *bus; USBBus *bus;
......
...@@ -529,6 +529,7 @@ struct USBBusOps { ...@@ -529,6 +529,7 @@ struct USBBusOps {
void usb_bus_new(USBBus *bus, size_t bus_size, void usb_bus_new(USBBus *bus, size_t bus_size,
USBBusOps *ops, DeviceState *host); USBBusOps *ops, DeviceState *host);
void usb_bus_release(USBBus *bus);
USBBus *usb_bus_find(int busnr); USBBus *usb_bus_find(int busnr);
void usb_legacy_register(const char *typename, const char *usbdevice_name, void usb_legacy_register(const char *typename, const char *usbdevice_name,
USBDevice *(*usbdevice_init)(USBBus *bus, USBDevice *(*usbdevice_init)(USBBus *bus,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册