mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-25 02:41:45 +00:00
DM USB: xHCI: refine the de-init logic of xHCI vdevice
Add 'full' and 'non-full' de-initialize support for xHCI virtual device. The non-full de-initialization mainly release usb_dev structure and unbind the usbfs with native device. And the full de-initialize will release all the resources allocated for xHCI virtual device including the unbinding operation mentioned above Tracked-On: #2576 Signed-off-by: Conghui Chen <conghui.chen@intel.com> Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
@@ -1054,22 +1054,27 @@ errout:
|
||||
}
|
||||
|
||||
void
|
||||
usb_dev_deinit(void *pdata)
|
||||
usb_dev_deinit(void *pdata, bool full)
|
||||
{
|
||||
int rc = 0;
|
||||
struct usb_dev *udev;
|
||||
|
||||
udev = pdata;
|
||||
if (udev) {
|
||||
if (udev->handle) {
|
||||
rc = usb_dev_native_toggle_if_drivers(udev, 1);
|
||||
if (rc)
|
||||
UPRINTF(LWRN, "fail to attach if drv rc:%d\r\n",
|
||||
rc);
|
||||
libusb_close(udev->handle);
|
||||
}
|
||||
if (!udev)
|
||||
return;
|
||||
|
||||
if (!udev->handle)
|
||||
goto out;
|
||||
|
||||
rc = usb_dev_native_toggle_if_drivers(udev, 1);
|
||||
if (rc)
|
||||
UPRINTF(LWRN, "fail to attach if drv rc:%d\r\n", rc);
|
||||
|
||||
libusb_close(udev->handle);
|
||||
udev->handle = NULL;
|
||||
out:
|
||||
if (full)
|
||||
free(udev);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
Reference in New Issue
Block a user