diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 85a30fb9177b..0b2f6be7b820 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -541,9 +541,10 @@ static void hci_uart_tty_close(struct tty_struct *tty) cancel_work_sync(&hu->write_work); if (hdev) { - if (test_bit(HCI_UART_REGISTERED, &hu->flags)) + if (test_bit(HCI_UART_REGISTERED, &hu->flags)) { hci_unregister_dev(hdev); - hci_free_dev(hdev); + hci_free_dev(hdev); + } } hu->proto->close(hu); } diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index dcc0dc6e2624..2749cbbf6cc4 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1027,17 +1027,11 @@ static inline void hci_conn_drop(struct hci_conn *conn) /* ----- HCI Devices ----- */ static inline void hci_dev_put(struct hci_dev *d) { - BT_DBG("%s orig refcnt %d", d->name, - kref_read(&d->dev.kobj.kref)); - put_device(&d->dev); } static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) { - BT_DBG("%s orig refcnt %d", d->name, - kref_read(&d->dev.kobj.kref)); - get_device(&d->dev); return d; } diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index cbbc34a006d1..4e2d6e647c1f --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3495,8 +3495,8 @@ void hci_unregister_dev(struct hci_dev *hdev) kfree_const(hdev->hw_info); kfree_const(hdev->fw_info); - destroy_workqueue(hdev->workqueue); - destroy_workqueue(hdev->req_workqueue); + //destroy_workqueue(hdev->workqueue); + //destroy_workqueue(hdev->req_workqueue); hci_dev_lock(hdev); hci_bdaddr_list_clear(&hdev->blacklist); diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 9c4a093f8960..95dd1d4dc72b --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -1207,6 +1207,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, * channel and HCI_AUTO_OFF grace period * is still active. */ + printk("haley: catch the case\n"); err = 0; } else { hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 9874844a95a9..d560c8181c1d --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -83,6 +83,10 @@ void hci_conn_del_sysfs(struct hci_conn *conn) static void bt_host_release(struct device *dev) { struct hci_dev *hdev = to_hci_dev(dev); + if (hdev->workqueue) { + destroy_workqueue(hdev->workqueue); + destroy_workqueue(hdev->req_workqueue); + } kfree(hdev); module_put(THIS_MODULE); }