aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_request.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-11-23 08:43:06 -0500
committerMarcel Holtmann <marcel@holtmann.org>2015-12-09 18:51:48 -0500
commitc366f555b8df67633b849a5088bb897d6c63aaa5 (patch)
tree4c07c7724649b050ddbdd93d677c92dd0ca79bdb /net/bluetooth/hci_request.c
parentaed1a8851db022c3bd22af41a343068b8c6e40c1 (diff)
Bluetooth: Move discoverable timeout behind hdev->req_workqueue
Since the other discoverable changes are behind req_workqueue now it only makes sense to move the discoverable timeout there as well. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_request.c')
-rw-r--r--net/bluetooth/hci_request.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 8f72218ed805..fe14fd121d36 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -1923,6 +1923,30 @@ static void discov_update(struct work_struct *work)
1923 } 1923 }
1924} 1924}
1925 1925
1926static void discov_off(struct work_struct *work)
1927{
1928 struct hci_dev *hdev = container_of(work, struct hci_dev,
1929 discov_off.work);
1930
1931 BT_DBG("%s", hdev->name);
1932
1933 hci_dev_lock(hdev);
1934
1935 /* When discoverable timeout triggers, then just make sure
1936 * the limited discoverable flag is cleared. Even in the case
1937 * of a timeout triggered from general discoverable, it is
1938 * safe to unconditionally clear the flag.
1939 */
1940 hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
1941 hci_dev_clear_flag(hdev, HCI_DISCOVERABLE);
1942 hdev->discov_timeout = 0;
1943
1944 hci_dev_unlock(hdev);
1945
1946 hci_req_sync(hdev, discoverable_update, 0, HCI_CMD_TIMEOUT, NULL);
1947 mgmt_new_settings(hdev);
1948}
1949
1926void hci_request_setup(struct hci_dev *hdev) 1950void hci_request_setup(struct hci_dev *hdev)
1927{ 1951{
1928 INIT_WORK(&hdev->discov_update, discov_update); 1952 INIT_WORK(&hdev->discov_update, discov_update);
@@ -1930,6 +1954,7 @@ void hci_request_setup(struct hci_dev *hdev)
1930 INIT_WORK(&hdev->scan_update, scan_update_work); 1954 INIT_WORK(&hdev->scan_update, scan_update_work);
1931 INIT_WORK(&hdev->connectable_update, connectable_update_work); 1955 INIT_WORK(&hdev->connectable_update, connectable_update_work);
1932 INIT_WORK(&hdev->discoverable_update, discoverable_update_work); 1956 INIT_WORK(&hdev->discoverable_update, discoverable_update_work);
1957 INIT_DELAYED_WORK(&hdev->discov_off, discov_off);
1933 INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work); 1958 INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work);
1934 INIT_DELAYED_WORK(&hdev->le_scan_restart, le_scan_restart_work); 1959 INIT_DELAYED_WORK(&hdev->le_scan_restart, le_scan_restart_work);
1935 INIT_DELAYED_WORK(&hdev->adv_instance_expire, adv_timeout_expire); 1960 INIT_DELAYED_WORK(&hdev->adv_instance_expire, adv_timeout_expire);
@@ -1944,6 +1969,7 @@ void hci_request_cancel_all(struct hci_dev *hdev)
1944 cancel_work_sync(&hdev->scan_update); 1969 cancel_work_sync(&hdev->scan_update);
1945 cancel_work_sync(&hdev->connectable_update); 1970 cancel_work_sync(&hdev->connectable_update);
1946 cancel_work_sync(&hdev->discoverable_update); 1971 cancel_work_sync(&hdev->discoverable_update);
1972 cancel_delayed_work_sync(&hdev->discov_off);
1947 cancel_delayed_work_sync(&hdev->le_scan_disable); 1973 cancel_delayed_work_sync(&hdev->le_scan_disable);
1948 cancel_delayed_work_sync(&hdev->le_scan_restart); 1974 cancel_delayed_work_sync(&hdev->le_scan_restart);
1949 1975