diff options
author | Lukasz Rymanowski <lukasz.rymanowski@tieto.com> | 2014-03-27 15:55:19 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-03-28 03:09:30 -0400 |
commit | ae55f5982a8bc6adbafb337e0b781d30d5617782 (patch) | |
tree | c1180fde026509028d3c5d5723415c20465e601f | |
parent | 8af4840a36f3d8210604ecfd5b1ce9b39745e7ba (diff) |
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: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 2 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index c2a419c2c5c7..08a1d44eeab0 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -1210,7 +1210,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event); | |||
1210 | #define DISCOV_LE_SCAN_WIN 0x12 | 1210 | #define DISCOV_LE_SCAN_WIN 0x12 |
1211 | #define DISCOV_LE_SCAN_INT 0x12 | 1211 | #define DISCOV_LE_SCAN_INT 0x12 |
1212 | #define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240) | 1212 | #define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240) |
1213 | #define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120) | 1213 | #define DISCOV_INTERLEAVED_TIMEOUT 5120 /* msec */ |
1214 | #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 | 1214 | #define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 |
1215 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 | 1215 | #define DISCOV_BREDR_INQUIRY_LEN 0x08 |
1216 | 1216 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 37706e89af50..944c4fc87905 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -3351,6 +3351,8 @@ static int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status) | |||
3351 | 3351 | ||
3352 | static void start_discovery_complete(struct hci_dev *hdev, u8 status) | 3352 | static void start_discovery_complete(struct hci_dev *hdev, u8 status) |
3353 | { | 3353 | { |
3354 | unsigned long timeout = 0; | ||
3355 | |||
3354 | BT_DBG("status %d", status); | 3356 | BT_DBG("status %d", status); |
3355 | 3357 | ||
3356 | if (status) { | 3358 | if (status) { |
@@ -3366,13 +3368,11 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status) | |||
3366 | 3368 | ||
3367 | switch (hdev->discovery.type) { | 3369 | switch (hdev->discovery.type) { |
3368 | case DISCOV_TYPE_LE: | 3370 | case DISCOV_TYPE_LE: |
3369 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, | 3371 | timeout = DISCOV_LE_TIMEOUT; |
3370 | DISCOV_LE_TIMEOUT); | ||
3371 | break; | 3372 | break; |
3372 | 3373 | ||
3373 | case DISCOV_TYPE_INTERLEAVED: | 3374 | case DISCOV_TYPE_INTERLEAVED: |
3374 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, | 3375 | timeout = msecs_to_jiffies(DISCOV_INTERLEAVED_TIMEOUT); |
3375 | DISCOV_INTERLEAVED_TIMEOUT); | ||
3376 | break; | 3376 | break; |
3377 | 3377 | ||
3378 | case DISCOV_TYPE_BREDR: | 3378 | case DISCOV_TYPE_BREDR: |
@@ -3381,6 +3381,11 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status) | |||
3381 | default: | 3381 | default: |
3382 | BT_ERR("Invalid discovery type %d", hdev->discovery.type); | 3382 | BT_ERR("Invalid discovery type %d", hdev->discovery.type); |
3383 | } | 3383 | } |
3384 | |||
3385 | if (!timeout) | ||
3386 | return; | ||
3387 | |||
3388 | queue_delayed_work(hdev->workqueue, &hdev->le_scan_disable, timeout); | ||
3384 | } | 3389 | } |
3385 | 3390 | ||
3386 | static int start_discovery(struct sock *sk, struct hci_dev *hdev, | 3391 | static int start_discovery(struct sock *sk, struct hci_dev *hdev, |