Пример #1
0
static void btusb_disconnect(struct usb_interface *intf)
{
	struct btusb_data *data = usb_get_intfdata(intf);
	struct hci_dev *hdev;

	BT_DBG("intf %p", intf);

	if (!data)
		return;

	hdev = data->hdev;

	__hci_dev_hold(hdev);

	usb_set_intfdata(data->intf, NULL);

	if (data->isoc)
		usb_set_intfdata(data->isoc, NULL);

	hci_unregister_dev(hdev);

	if (intf == data->isoc)
		usb_driver_release_interface(&btusb_driver, data->intf);
	else if (data->isoc)
		usb_driver_release_interface(&btusb_driver, data->isoc);

	__hci_dev_put(hdev);

	hci_free_dev(hdev);
}
static void btusb_disconnect(struct usb_interface *intf)
{
    struct btusb_data *data = usb_get_intfdata(intf);
    struct hci_dev *hdev;
    struct usb_device *udev;
    udev = interface_to_usbdev(intf);

    if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
        return;

    if (!data)
        return;

    RTKBT_DBG("btusb_disconnect");
    /*******************************/
    patch_remove(intf);
    /*******************************/

    hdev = data->hdev;

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
    __hci_dev_hold(hdev);
#endif

    usb_set_intfdata(data->intf, NULL);

    if (data->isoc)
        usb_set_intfdata(data->isoc, NULL);

    hci_unregister_dev(hdev);

    if (intf == data->isoc)
        usb_driver_release_interface(&btusb_driver, data->intf);
    else if (data->isoc)
        usb_driver_release_interface(&btusb_driver, data->isoc);

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
    __hci_dev_put(hdev);
#endif

    hci_free_dev(hdev);
    kfree(data);
}