static void hci_smd_deregister_dev(struct hci_smd_data *hsmd) { tasklet_kill(&hs.rx_task); if (!test_and_clear_bit(HCI_REGISTER_SET, &hsmd->flags)) { BT_ERR("HCI device un-registered already"); return; } else BT_INFO("HCI device un-registration going on"); if (hsmd->hdev) { if (hci_unregister_dev(hsmd->hdev) < 0) BT_ERR("Can't unregister HCI device %s", hsmd->hdev->name); hci_free_dev(hsmd->hdev); hsmd->hdev = NULL; } smd_close(hs.event_channel); smd_close(hs.data_channel); if (wake_lock_active(&hs.wake_lock_rx)) wake_unlock(&hs.wake_lock_rx); if (wake_lock_active(&hs.wake_lock_tx)) wake_unlock(&hs.wake_lock_tx); /*Destroy the timer used to monitor the Rx queue for emptiness */ if (hs.rx_q_timer.function) { del_timer_sync(&hs.rx_q_timer); hs.rx_q_timer.function = NULL; hs.rx_q_timer.data = 0; } }
/* hci_uart_tty_close() * * Called when the line discipline is changed to something * else, the tty is closed, or the tty detects a hangup. */ static void hci_uart_tty_close(struct tty_struct *tty) { struct hci_uart *hu = (void *)tty->disc_data; BT_DBG("tty %p", tty); /* Detach from the tty */ tty->disc_data = NULL; if (hu) { struct hci_dev *hdev = hu->hdev; if (hdev) hci_uart_close(hdev); if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { if (hdev) { hci_unregister_dev(hdev); hci_free_dev(hdev); } hu->proto->close(hu); } kfree(hu); } }
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); }
/* hci_uart_tty_close() * * Called when the line discipline is changed to something * else, the tty is closed, or the tty detects a hangup. */ static void hci_uart_tty_close(struct tty_struct *tty) { struct hci_uart *hu = tty->disc_data; struct hci_dev *hdev; BT_DBG("tty %p", tty); /* Detach from the tty */ tty->disc_data = NULL; if (!hu) return; hdev = hu->hdev; if (hdev) hci_uart_close(hdev); cancel_work_sync(&hu->write_work); if (test_and_clear_bit(HCI_UART_PROTO_READY, &hu->flags)) { if (hdev) { if (test_bit(HCI_UART_REGISTERED, &hu->flags)) hci_unregister_dev(hdev); hci_free_dev(hdev); } hu->proto->close(hu); } clear_bit(HCI_UART_PROTO_SET, &hu->flags); kfree(hu); }
static void __exit bt_drv_exit(void) { BTDRV_API_START(); /* Deallocate local resource's memory */ if (hst) { struct hci_dev *hdev = hst->hdev; if (hdev == NULL) { BT_DRV_ERR("Invalid hdev memory"); kfree(hst); } else { hci_st_close(hdev); if (test_and_clear_bit(BT_DRV_RUNNING, &hst->flags)) { /* Remove HCI device (hciX) created * in module init. */ hci_unregister_dev(hdev); /* Free HCI device memory */ hci_free_dev(hdev); } } } BTDRV_API_EXIT(0); }
int btmrvl_remove_card(struct btmrvl_private *priv) { struct hci_dev *hdev; hdev = priv->btmrvl_dev.hcidev; wake_up_interruptible(&priv->adapter->cmd_wait_q); kthread_stop(priv->main_thread.task); #ifdef CONFIG_DEBUG_FS btmrvl_debugfs_remove(hdev); #endif hci_unregister_dev(hdev); hci_free_dev(hdev); priv->btmrvl_dev.hcidev = NULL; btmrvl_free_adapter(priv); kfree(priv); return 0; }
static void hci_smd_deregister_dev(struct hci_smd_data *hsmd) { tasklet_kill(&hs.rx_task); if (hsmd->hdev) { if (hci_unregister_dev(hsmd->hdev) < 0) BT_ERR("Can't unregister HCI device %s", hsmd->hdev->name); hci_free_dev(hsmd->hdev); hsmd->hdev = NULL; } smd_close(hs.event_channel); smd_close(hs.data_channel); if (wake_lock_active(&hs.wake_lock_rx)) wake_unlock(&hs.wake_lock_rx); if (wake_lock_active(&hs.wake_lock_tx)) wake_unlock(&hs.wake_lock_tx); /*Destroy the timer used to monitor the Rx queue for emptiness */ if (hs.rx_q_timer.function) { del_timer_sync(&hs.rx_q_timer); hs.rx_q_timer.function = NULL; hs.rx_q_timer.data = 0; } }
static int bluecard_close(bluecard_info_t *info) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) unsigned int iobase = info->p_dev->resource[0]->start; #else unsigned int iobase = info->p_dev->io.BasePort1; #endif struct hci_dev *hdev = info->hdev; if (!hdev) return -ENODEV; bluecard_hci_close(hdev); clear_bit(CARD_READY, &(info->hw_state)); /* Reset card */ info->ctrl_reg = REG_CONTROL_BT_RESET | REG_CONTROL_CARD_RESET; outb(info->ctrl_reg, iobase + REG_CONTROL); /* Turn FPGA off */ outb(0x80, iobase + 0x30); hci_unregister_dev(hdev); hci_free_dev(hdev); return 0; }
static void btqcomsmd_remove(struct qcom_smd_device *sdev) { struct hci_dev *hdev = dev_get_drvdata(&sdev->dev);; hci_unregister_dev(hdev); hci_free_dev(hdev); }
/* hci_uart_tty_close() * * Called when the line discipline is changed to something * else, the tty is closed, or the tty detects a hangup. */ static void hci_uart_tty_close(struct tty_struct *tty) { struct hci_uart *hu = (void *)tty->disc_data; BT_DBG("tty %p", tty); /* Detach from the tty */ tty->disc_data = NULL; if (hu) { struct hci_dev *hdev = hu->hdev; if (hdev) hci_uart_close(hdev); cancel_work_sync(&hu->write_work); tasklet_kill(&hu->tty_wakeup_task); cancel_work_sync(&hu->write_work); if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { hu->proto->close(hu); if (hdev) { hci_unregister_dev(hdev); hci_free_dev(hdev); } } } }
static int btuart_close(btuart_info_t *info) { unsigned long flags; unsigned int iobase = info->p_dev->io.BasePort1; struct hci_dev *hdev = info->hdev; if (!hdev) return -ENODEV; btuart_hci_close(hdev); spin_lock_irqsave(&(info->lock), flags); /* Reset UART */ outb(0, iobase + UART_MCR); /* Turn off interrupts */ outb(0, iobase + UART_IER); spin_unlock_irqrestore(&(info->lock), flags); if (hci_unregister_dev(hdev) < 0) BT_ERR("Can't unregister HCI device %s", hdev->name); hci_free_dev(hdev); return 0; }
static int dtl1_close(dtl1_info_t *info) { unsigned long flags; unsigned int iobase = info->p_dev->resource[0]->start; struct hci_dev *hdev = info->hdev; if (!hdev) return -ENODEV; dtl1_hci_close(hdev); spin_lock_irqsave(&(info->lock), flags); /* Reset UART */ outb(0, iobase + UART_MCR); /* Turn off interrupts */ outb(0, iobase + UART_IER); spin_unlock_irqrestore(&(info->lock), flags); hci_unregister_dev(hdev); hci_free_dev(hdev); return 0; }
static int btuart_close(btuart_info_t *info) { unsigned long flags; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) unsigned int iobase = info->p_dev->resource[0]->start; #else unsigned int iobase = info->p_dev->io.BasePort1; #endif struct hci_dev *hdev = info->hdev; if (!hdev) return -ENODEV; btuart_hci_close(hdev); spin_lock_irqsave(&(info->lock), flags); /* Reset UART */ outb(0, iobase + UART_MCR); /* Turn off interrupts */ outb(0, iobase + UART_IER); spin_unlock_irqrestore(&(info->lock), flags); if (hci_unregister_dev(hdev) < 0) BT_ERR("Can't unregister HCI device %s", hdev->name); hci_free_dev(hdev); return 0; }
/* hci_uart_tty_close() * * Called when the line discipline is changed to something * else, the tty is closed, or the tty detects a hangup. */ static void hci_uart_tty_close(struct tty_struct *tty) { struct hci_uart *hu = (void *)tty->disc_data; BT_DBG("tty %p", tty); /* Detach from the tty */ tty->disc_data = NULL; #ifdef CONFIG_TROUT_UART_TRANSPORT_DEBUG if(NULL != &timer_retransmit) { del_timer(&timer_retransmit); } #endif if (hu) { struct hci_dev *hdev = hu->hdev; if (hdev) hci_uart_close(hdev); if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { hu->proto->close(hu); if (hdev) { hci_unregister_dev(hdev); hci_free_dev(hdev); } } } }
static int bluecard_close(bluecard_info_t *info) { unsigned int iobase = info->p_dev->io.BasePort1; struct hci_dev *hdev = info->hdev; if (!hdev) return -ENODEV; bluecard_hci_close(hdev); clear_bit(CARD_READY, &(info->hw_state)); /* Reset card */ info->ctrl_reg = REG_CONTROL_BT_RESET | REG_CONTROL_CARD_RESET; outb(info->ctrl_reg, iobase + REG_CONTROL); /* Turn FPGA off */ outb(0x80, iobase + 0x30); if (hci_unregister_dev(hdev) < 0) BT_ERR("Can't unregister HCI device %s", hdev->name); hci_free_dev(hdev); return 0; }
static int hci_vhci_chr_close(struct inode *inode, struct file *file) { struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data; if (hci_unregister_dev(&hci_vhci->hdev) < 0) { BT_ERR("Can't unregister HCI device %s", hci_vhci->hdev.name); } file->private_data = NULL; return 0; }
int bt3c_close(bt3c_info_t *info) { struct hci_dev *hdev = &(info->hdev); bt3c_hci_close(hdev); if (hci_unregister_dev(hdev) < 0) printk(KERN_WARNING "bt3c_cs: Can't unregister HCI device %s.\n", hdev->name); return 0; }
void hci_uart_unregister_device(struct hci_uart *hu) { struct hci_dev *hdev = hu->hdev; hci_unregister_dev(hdev); hci_free_dev(hdev); cancel_work_sync(&hu->write_work); hu->proto->close(hu); }
static int vhci_release(struct inode *inode, struct file *file) { struct vhci_data *data = file->private_data; struct hci_dev *hdev = data->hdev; hci_unregister_dev(hdev); hci_free_dev(hdev); file->private_data = NULL; return 0; }
void hci_uart_unregister_device(struct hci_uart *hu) { struct hci_dev *hdev = hu->hdev; clear_bit(HCI_UART_PROTO_READY, &hu->flags); hci_unregister_dev(hdev); hci_free_dev(hdev); cancel_work_sync(&hu->write_work); hu->proto->close(hu); serdev_device_close(hu->serdev); }
static void nokia_bluetooth_serdev_remove(struct serdev_device *serdev) { struct nokia_bt_dev *btdev = serdev_device_get_drvdata(serdev); struct hci_uart *hu = &btdev->hu; struct hci_dev *hdev = hu->hdev; cancel_work_sync(&hu->write_work); hci_unregister_dev(hdev); hci_free_dev(hdev); hu->proto->close(hu); pm_runtime_disable(&btdev->serdev->dev); }
static int vhci_release(struct inode *inode, struct file *file) { struct vhci_data *data = file->private_data; struct hci_dev *hdev = data->hdev; hci_unregister_dev(hdev); hci_free_dev(hdev); skb_queue_purge(&data->readq); file->private_data = NULL; kfree(data); return 0; }
static void bpa10x_disconnect(struct usb_interface *intf) { struct bpa10x_data *data = usb_get_intfdata(intf); BT_DBG("intf %p", intf); if (!data) return; usb_set_intfdata(intf, NULL); hci_unregister_dev(data->hdev); hci_free_dev(data->hdev); }
static int vhci_release(struct inode *inode, struct file *file) { struct vhci_data *data = file->private_data; struct hci_dev *hdev = data->hdev; if (hci_unregister_dev(hdev) < 0) { BT_ERR("Can't unregister HCI device %s", hdev->name); } hci_free_dev(hdev); file->private_data = NULL; return 0; }
int bt3c_close(bt3c_info_t *info) { struct hci_dev *hdev = info->hdev; if (!hdev) return -ENODEV; bt3c_hci_close(hdev); if (hci_unregister_dev(hdev) < 0) BT_ERR("Can't unregister HCI device %s", hdev->name); hci_free_dev(hdev); return 0; }
static void bfusb_disconnect(struct usb_interface *intf) { struct bfusb_data *data = usb_get_intfdata(intf); struct hci_dev *hdev = data->hdev; BT_DBG("intf %p", intf); if (!hdev) return; usb_set_intfdata(intf, NULL); bfusb_close(hdev); hci_unregister_dev(hdev); hci_free_dev(hdev); }
static int vhci_release(struct inode *inode, struct file *file) { struct vhci_data *data = file->private_data; struct hci_dev *hdev = data->hdev; cancel_delayed_work_sync(&data->open_timeout); if (hdev) { hci_unregister_dev(hdev); hci_free_dev(hdev); } file->private_data = NULL; kfree(data); return 0; }
static void bpa10x_disconnect(struct usb_interface *intf) { struct bpa10x_data *data = usb_get_intfdata(intf); struct hci_dev *hdev = data->hdev; BT_DBG("intf %p", intf); if (!hdev) return; usb_set_intfdata(intf, NULL); if (hci_unregister_dev(hdev) < 0) BT_ERR("Can't unregister HCI device %s", hdev->name); hci_free_dev(hdev); }
static int hci_h4p_remove(struct platform_device *pdev) { struct hci_h4p_info *info; info = platform_get_drvdata(pdev); hci_h4p_hci_close(info->hdev); free_irq(gpio_to_irq(info->host_wakeup_gpio), info); hci_unregister_dev(info->hdev); hci_free_dev(info->hdev); gpio_free(info->reset_gpio); gpio_free(info->bt_wakeup_gpio); gpio_free(info->host_wakeup_gpio); free_irq(info->irq, (void *) info); kfree(info); return 0; }
/** * unregisters with the bluetooth-hci(BlueZ) interface * * @adapter - pointer to bluetooth asset's adapter * @return - 0 on success */ int bluez_deinit(PONEBOX_ADAPTER adapter) { struct hci_dev *hdev; if (!(hdev = adapter->hdev)) return -EFAULT; ONEBOX_DEBUG(ONEBOX_ZONE_INFO, (TEXT("%s: deregistering `%s'\n"), __func__, hdev->name)); onebox_hci_dev_hold(hdev); hci_unregister_dev(hdev); onebox_hci_dev_put(hdev); hci_free_dev(hdev); return ONEBOX_STATUS_SUCCESS; }