Bluetooth: Remove magic number from ACL TO
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Wed, 4 Jan 2012 14:42:26 +0000 (16:42 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 13 Feb 2012 15:01:21 +0000 (17:01 +0200)
Adds HCI_ACL_TX_TIMEOUT and clear conversion from msec to jiffies

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/hci.h
net/bluetooth/hci_core.c

index 6a9d316fb9773e7015a23e38bfa6c5ebc2f10086..4202c9cb497ec2d5627f308f70fcb33a53fff450 100644 (file)
@@ -130,6 +130,7 @@ enum {
 #define HCI_IDLE_TIMEOUT       (6000)  /* 6 seconds */
 #define HCI_INIT_TIMEOUT       (10000) /* 10 seconds */
 #define HCI_CMD_TIMEOUT                (1000)  /* 1 seconds */
+#define HCI_ACL_TX_TIMEOUT     (45000) /* 45 seconds */
 
 /* HCI data types */
 #define HCI_COMMAND_PKT                0x01
index 546a42941477cdcea6fddcb709b6aaac573a4867..f84935e5cbabe5dd3632f3f1bd8b292751573f80 100644 (file)
@@ -2350,7 +2350,8 @@ static inline void hci_sched_acl(struct hci_dev *hdev)
        if (!test_bit(HCI_RAW, &hdev->flags)) {
                /* ACL tx timeout must be longer than maximum
                 * link supervision timeout (40.9 seconds) */
-               if (!hdev->acl_cnt && time_after(jiffies, hdev->acl_last_tx + HZ * 45))
+               if (!hdev->acl_cnt && time_after(jiffies, hdev->acl_last_tx +
+                                       msecs_to_jiffies(HCI_ACL_TX_TIMEOUT)))
                        hci_link_tx_to(hdev, ACL_LINK);
        }