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..d54f1d729f28 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1027,7 +1027,7 @@ 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, + printk("%#llx orig refcnt %d, put", d, kref_read(&d->dev.kobj.kref)); put_device(&d->dev); @@ -1035,7 +1035,7 @@ static inline void hci_dev_put(struct hci_dev *d) static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) { - BT_DBG("%s orig refcnt %d", d->name, + printk("%#llx orig refcnt %d, get", d, kref_read(&d->dev.kobj.kref)); get_device(&d->dev); 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_sysfs.c b/net/bluetooth/hci_sysfs.c index 9874844a95a9..efffccdc0101 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -83,6 +83,8 @@ 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); + destroy_workqueue(hdev->workqueue); + destroy_workqueue(hdev->req_workqueue); kfree(hdev); module_put(THIS_MODULE); }