aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 6a4bd2d8da99..2da3f907e9b7 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -595,6 +595,11 @@ static int hci_dev_do_close(struct hci_dev *hdev)
595 tasklet_kill(&hdev->rx_task); 595 tasklet_kill(&hdev->rx_task);
596 tasklet_kill(&hdev->tx_task); 596 tasklet_kill(&hdev->tx_task);
597 597
598 if (hdev->discov_timeout > 0) {
599 cancel_delayed_work_sync(&hdev->discov_off);
600 hdev->discov_timeout = 0;
601 }
602
598 hci_dev_lock_bh(hdev); 603 hci_dev_lock_bh(hdev);
599 inquiry_cache_flush(hdev); 604 inquiry_cache_flush(hdev);
600 hci_conn_hash_flush(hdev); 605 hci_conn_hash_flush(hdev);
@@ -968,6 +973,24 @@ void hci_del_off_timer(struct hci_dev *hdev)
968 del_timer(&hdev->off_timer); 973 del_timer(&hdev->off_timer);
969} 974}
970 975
976static void hci_discov_off(struct work_struct *work)
977{
978 struct hci_dev *hdev;
979 u8 scan = SCAN_PAGE;
980
981 hdev = container_of(work, struct hci_dev, discov_off.work);
982
983 BT_DBG("%s", hdev->name);
984
985 hci_dev_lock_bh(hdev);
986
987 hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, sizeof(scan), &scan);
988
989 hdev->discov_timeout = 0;
990
991 hci_dev_unlock_bh(hdev);
992}
993
971int hci_uuids_clear(struct hci_dev *hdev) 994int hci_uuids_clear(struct hci_dev *hdev)
972{ 995{
973 struct list_head *p, *n; 996 struct list_head *p, *n;
@@ -1485,6 +1508,8 @@ int hci_register_dev(struct hci_dev *hdev)
1485 INIT_WORK(&hdev->power_off, hci_power_off); 1508 INIT_WORK(&hdev->power_off, hci_power_off);
1486 setup_timer(&hdev->off_timer, hci_auto_off, (unsigned long) hdev); 1509 setup_timer(&hdev->off_timer, hci_auto_off, (unsigned long) hdev);
1487 1510
1511 INIT_DELAYED_WORK(&hdev->discov_off, hci_discov_off);
1512
1488 memset(&hdev->stat, 0, sizeof(struct hci_dev_stats)); 1513 memset(&hdev->stat, 0, sizeof(struct hci_dev_stats));
1489 1514
1490 atomic_set(&hdev->promisc, 0); 1515 atomic_set(&hdev->promisc, 0);