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..2ce956be598e --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1029,6 +1029,9 @@ static inline void hci_dev_put(struct hci_dev *d) { BT_DBG("%s orig refcnt %d", d->name, kref_read(&d->dev.kobj.kref)); + printk("haley: hdev %#llx. %s, %d\n", d, __func__, __LINE__); + printk("%s orig refcnt %d", d->name, + kref_read(&d->dev.kobj.kref)); put_device(&d->dev); } @@ -1038,6 +1041,10 @@ 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)); + printk("%s orig refcnt %d", d->name, + kref_read(&d->dev.kobj.kref)); + printk("haley: hdev %#llx. %s, %d\n", d, __func__, __LINE__); + get_device(&d->dev); return d; } diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index cbbc34a006d1..d06e33731353 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3250,6 +3250,8 @@ struct hci_dev *hci_alloc_dev(void) if (!hdev) return NULL; + printk("haley: hdev %#llx. %s, %d\n", hdev, __func__, __LINE__); + hdev->pkt_type = (HCI_DM1 | HCI_DH1 | HCI_HV1); hdev->esco_type = (ESCO_HV1); hdev->link_mode = (HCI_LM_ACCEPT); @@ -3341,6 +3343,7 @@ EXPORT_SYMBOL(hci_alloc_dev); /* Free HCI device */ void hci_free_dev(struct hci_dev *hdev) { + printk("haley: hdev %#llx. %s, %d\n", hdev, __func__, __LINE__); /* will free via device release */ put_device(&hdev->dev); } @@ -3438,6 +3441,7 @@ int hci_register_dev(struct hci_dev *hdev) hci_dev_hold(hdev); queue_work(hdev->req_workqueue, &hdev->power_on); + printk("haley: hdev %#llx. %s, %d\n", hdev, __func__, __LINE__); return id; @@ -3457,6 +3461,7 @@ void hci_unregister_dev(struct hci_dev *hdev) int id; BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); + printk("haley: hdev %#llx. %s, %d\n", hdev, __func__, __LINE__); hci_dev_set_flag(hdev, HCI_UNREGISTER); diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 9874844a95a9..66a5dac0e892 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -83,6 +83,7 @@ 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); + printk("haley: hdev %#llx. %s, %d\n", hdev, __func__, __LINE__); kfree(hdev); module_put(THIS_MODULE); }