diff options
author | S.Çağlar Onur <caglar@pardus.org.tr> | 2008-02-18 02:25:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-18 02:25:57 -0500 |
commit | 82453021b8be85171350c695d7ebafe7b517c812 (patch) | |
tree | 174afa01ab8c168ab97e6a017c9e441d8f89834d /net/bluetooth | |
parent | 5ee46e562c9c10a5e25920c4406a42061cf27839 (diff) |
[BLUETOOTH] net/bluetooth/hci_core.c: Use time_* macros
The functions time_before, time_before_eq, time_after, and
time_after_eq are more robust for comparing jiffies against other
values.
So following patch implements usage of the time_after() macro, defined
at linux/jiffies.h, which deals with wrapping correctly
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 372b0d3b75a8..930b58e7149a 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | /* Bluetooth HCI core. */ | 25 | /* Bluetooth HCI core. */ |
26 | 26 | ||
27 | #include <linux/jiffies.h> | ||
27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
28 | #include <linux/kmod.h> | 29 | #include <linux/kmod.h> |
29 | 30 | ||
@@ -1321,7 +1322,7 @@ static inline void hci_sched_acl(struct hci_dev *hdev) | |||
1321 | if (!test_bit(HCI_RAW, &hdev->flags)) { | 1322 | if (!test_bit(HCI_RAW, &hdev->flags)) { |
1322 | /* ACL tx timeout must be longer than maximum | 1323 | /* ACL tx timeout must be longer than maximum |
1323 | * link supervision timeout (40.9 seconds) */ | 1324 | * link supervision timeout (40.9 seconds) */ |
1324 | if (!hdev->acl_cnt && (jiffies - hdev->acl_last_tx) > (HZ * 45)) | 1325 | if (!hdev->acl_cnt && time_after(jiffies, hdev->acl_last_tx + HZ * 45)) |
1325 | hci_acl_tx_to(hdev); | 1326 | hci_acl_tx_to(hdev); |
1326 | } | 1327 | } |
1327 | 1328 | ||
@@ -1543,7 +1544,7 @@ static void hci_cmd_task(unsigned long arg) | |||
1543 | 1544 | ||
1544 | BT_DBG("%s cmd %d", hdev->name, atomic_read(&hdev->cmd_cnt)); | 1545 | BT_DBG("%s cmd %d", hdev->name, atomic_read(&hdev->cmd_cnt)); |
1545 | 1546 | ||
1546 | if (!atomic_read(&hdev->cmd_cnt) && (jiffies - hdev->cmd_last_tx) > HZ) { | 1547 | if (!atomic_read(&hdev->cmd_cnt) && time_after(jiffies, hdev->cmd_last_tx + HZ)) { |
1547 | BT_ERR("%s command tx timeout", hdev->name); | 1548 | BT_ERR("%s command tx timeout", hdev->name); |
1548 | atomic_set(&hdev->cmd_cnt, 1); | 1549 | atomic_set(&hdev->cmd_cnt, 1); |
1549 | } | 1550 | } |