LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros
@ 2008-02-14 15:36 S.Çağlar Onur
2008-02-14 16:03 ` [Bluez-devel] " Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: S.Çağlar Onur @ 2008-02-14 15:36 UTC (permalink / raw)
To: linux-kernel; +Cc: bluez-devel, S.Çağlar Onur
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
Cc: bluez-devel@lists.sf.net
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
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 372b0d3..930b58e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -24,6 +24,7 @@
/* Bluetooth HCI core. */
+#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/kmod.h>
@@ -1321,7 +1322,7 @@ 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 && (jiffies - hdev->acl_last_tx) > (HZ * 45))
+ if (!hdev->acl_cnt && time_after(jiffies, hdev->acl_last_tx + HZ * 45))
hci_acl_tx_to(hdev);
}
@@ -1543,7 +1544,7 @@ static void hci_cmd_task(unsigned long arg)
BT_DBG("%s cmd %d", hdev->name, atomic_read(&hdev->cmd_cnt));
- if (!atomic_read(&hdev->cmd_cnt) && (jiffies - hdev->cmd_last_tx) > HZ) {
+ if (!atomic_read(&hdev->cmd_cnt) && time_after(jiffies, hdev->cmd_last_tx + HZ)) {
BT_ERR("%s command tx timeout", hdev->name);
atomic_set(&hdev->cmd_cnt, 1);
}
--
1.5.3.7
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros
2008-02-14 15:36 [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros S.Çağlar Onur
@ 2008-02-14 16:03 ` Marcel Holtmann
2008-02-18 7:25 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2008-02-14 16:03 UTC (permalink / raw)
To: BlueZ development; +Cc: linux-kernel, S.Çağlar Onur, bluez-devel
Hi,
> 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
>
> Cc: bluez-devel@lists.sf.net
> Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
since this is full serious of patches, I am not sure if it should go via
the subsystem maintainers or better applied as whole. In case of Linus
or Andrew decide to take them all at once and push them, this on is
acked by me.
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros
2008-02-14 16:03 ` [Bluez-devel] " Marcel Holtmann
@ 2008-02-18 7:25 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-02-18 7:25 UTC (permalink / raw)
To: marcel; +Cc: bluez-devel, linux-kernel, caglar, bluez-devel
From: Marcel Holtmann <marcel@holtmann.org>
Date: Thu, 14 Feb 2008 17:03:51 +0100
> since this is full serious of patches, I am not sure if it should go via
> the subsystem maintainers or better applied as whole. In case of Linus
> or Andrew decide to take them all at once and push them, this on is
> acked by me.
I'll take care of it.
> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-18 7:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-14 15:36 [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros S.Çağlar Onur
2008-02-14 16:03 ` [Bluez-devel] " Marcel Holtmann
2008-02-18 7:25 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).