Commit ae55f598 authored by Lukasz Rymanowski's avatar Lukasz Rymanowski Committed by Marcel Holtmann

Bluetooth: Keep msec in DISCOV_INTERLEAVED_TIMEOUT

Keep msec instead of jiffies in this define. This is needed by following
patch where we want this timeout to be exposed in debugfs.

Note: Value of this timeout comes from recommendation in BT Core Spec.4.0,
Vol 3, Part C, chapter 13.2.1.
Signed-off-by: default avatarLukasz Rymanowski <lukasz.rymanowski@tieto.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 8af4840a
...@@ -1210,7 +1210,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); ...@@ -1210,7 +1210,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
#define DISCOV_LE_SCAN_WIN 0x12 #define DISCOV_LE_SCAN_WIN 0x12
#define DISCOV_LE_SCAN_INT 0x12 #define DISCOV_LE_SCAN_INT 0x12
#define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240) #define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240)
#define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120) #define DISCOV_INTERLEAVED_TIMEOUT 5120 /* msec */
#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04
#define DISCOV_BREDR_INQUIRY_LEN 0x08 #define DISCOV_BREDR_INQUIRY_LEN 0x08
......
...@@ -3351,6 +3351,8 @@ static int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status) ...@@ -3351,6 +3351,8 @@ static int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status)
static void start_discovery_complete(struct hci_dev *hdev, u8 status) static void start_discovery_complete(struct hci_dev *hdev, u8 status)
{ {
unsigned long timeout = 0;
BT_DBG("status %d", status); BT_DBG("status %d", status);
if (status) { if (status) {
...@@ -3366,13 +3368,11 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status) ...@@ -3366,13 +3368,11 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status)
switch (hdev->discovery.type) { switch (hdev->discovery.type) {
case DISCOV_TYPE_LE: case DISCOV_TYPE_LE:
queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, timeout = DISCOV_LE_TIMEOUT;
DISCOV_LE_TIMEOUT);
break; break;
case DISCOV_TYPE_INTERLEAVED: case DISCOV_TYPE_INTERLEAVED:
queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, timeout = msecs_to_jiffies(DISCOV_INTERLEAVED_TIMEOUT);
DISCOV_INTERLEAVED_TIMEOUT);
break; break;
case DISCOV_TYPE_BREDR: case DISCOV_TYPE_BREDR:
...@@ -3381,6 +3381,11 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status) ...@@ -3381,6 +3381,11 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status)
default: default:
BT_ERR("Invalid discovery type %d", hdev->discovery.type); BT_ERR("Invalid discovery type %d", hdev->discovery.type);
} }
if (!timeout)
return;
queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, timeout);
} }
static int start_discovery(struct sock *sk, struct hci_dev *hdev, static int start_discovery(struct sock *sk, struct hci_dev *hdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment