Commit 17b02e62 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

Bluetooth: Update MGMT and SMP timeout constants to use msecs_to_jiffies

The MGMT and SMP timeout constants are always used in form of jiffies. So
just include the conversion from msecs in the define itself. This has the
advantage of making the code where the timeout is used more readable.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent ba13ccd9
...@@ -116,7 +116,7 @@ static const u16 mgmt_events[] = { ...@@ -116,7 +116,7 @@ static const u16 mgmt_events[] = {
#define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */ #define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */
#define INQUIRY_LEN_BREDR_LE 0x04 /* TGAP(100)/2 */ #define INQUIRY_LEN_BREDR_LE 0x04 /* TGAP(100)/2 */
#define SERVICE_CACHE_TIMEOUT (5 * 1000) #define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000)
#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \
!test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) !test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
...@@ -1298,8 +1298,7 @@ static bool enable_service_cache(struct hci_dev *hdev) ...@@ -1298,8 +1298,7 @@ static bool enable_service_cache(struct hci_dev *hdev)
return false; return false;
if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) { if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) {
schedule_delayed_work(&hdev->service_cache, schedule_delayed_work(&hdev->service_cache, CACHE_TIMEOUT);
msecs_to_jiffies(SERVICE_CACHE_TIMEOUT));
return true; return true;
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <crypto/b128ops.h> #include <crypto/b128ops.h>
#define SMP_TIMEOUT 30000 /* 30 seconds */ #define SMP_TIMEOUT msecs_to_jiffies(30000)
static inline void swap128(u8 src[16], u8 dst[16]) static inline void swap128(u8 src[16], u8 dst[16])
{ {
...@@ -186,8 +186,7 @@ static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data) ...@@ -186,8 +186,7 @@ static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data)
hci_send_acl(conn->hchan, skb, 0); hci_send_acl(conn->hchan, skb, 0);
cancel_delayed_work_sync(&conn->security_timer); cancel_delayed_work_sync(&conn->security_timer);
schedule_delayed_work(&conn->security_timer, schedule_delayed_work(&conn->security_timer, SMP_TIMEOUT);
msecs_to_jiffies(SMP_TIMEOUT));
} }
static __u8 authreq_to_seclevel(__u8 authreq) static __u8 authreq_to_seclevel(__u8 authreq)
......
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