mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "S.Çağlar Onur" <caglar@pardus.org.tr>
To: linux-kernel@vger.kernel.org
Cc: linux-wireless@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] net/mac80211/: Use time_* macros
Date: Mon, 17 Mar 2008 11:36:29 +0200	[thread overview]
Message-ID: <1205746593-24820-7-git-send-email-caglar@pardus.org.tr> (raw)
In-Reply-To: <1205746593-24820-6-git-send-email-caglar@pardus.org.tr>

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: linux-wireless@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 net/mac80211/rc80211_simple.c |    3 ++-
 net/mac80211/rx.c             |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/rc80211_simple.c b/net/mac80211/rc80211_simple.c
index 9a78b11..91bbff1 100644
--- a/net/mac80211/rc80211_simple.c
+++ b/net/mac80211/rc80211_simple.c
@@ -7,6 +7,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/jiffies.h>
 #include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/types.h>
@@ -177,7 +178,7 @@ static void rate_control_simple_tx_status(void *priv, struct net_device *dev,
 		rate_control_rate_dec(local, sta);
 	}
 
-	if (srctrl->avg_rate_update + 60 * HZ < jiffies) {
+	if (time_after(jiffies, srctrl->avg_rate_update + 60 * HZ)) {
 		srctrl->avg_rate_update = jiffies;
 		if (srctrl->tx_avg_rate_num > 0) {
 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 535407d..592581a 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -9,6 +9,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/jiffies.h>
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
@@ -801,7 +802,7 @@ ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata,
 		    compare_ether_addr(hdr->addr2, f_hdr->addr2) != 0)
 			continue;
 
-		if (entry->first_frag_time + 2 * HZ < jiffies) {
+		if (time_after(jiffies, entry->first_frag_time + 2 * HZ)) {
 			__skb_queue_purge(&entry->skb_list);
 			continue;
 		}
-- 
1.5.4.3


  reply	other threads:[~2008-03-17  9:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-17  9:36 [PATCH] arch/alpha/kernel/traps.c: " S.Çağlar Onur
2008-03-17  9:36 ` [PATCH] arch/ia64/kernel/: " S.Çağlar Onur
2008-03-17  9:36   ` [PATCH] arch/parisc/kernel/unaligned.c: " S.Çağlar Onur
2008-03-17  9:36     ` [PATCH] arch/powerpc/platforms/iseries/pci.c: " S.Çağlar Onur
2008-03-17  9:36       ` [PATCH] drivers/net/arcnet/arcnet.c: " S.Çağlar Onur
2008-03-17  9:36         ` [PATCH] drivers/net/ax88796.c: " S.Çağlar Onur
2008-03-17  9:36           ` S.Çağlar Onur [this message]
2008-03-17  9:36             ` [PATCH] drivers/net/tokenring/3c359.c: " S.Çağlar Onur
2008-03-17  9:36               ` [PATCH] drivers/net/wireless/atmel.c: " S.Çağlar Onur
2008-03-17  9:36                 ` [PATCH] fs/binfmt_aout.c: Use printk_ratelimit() S.Çağlar Onur
2008-03-17  9:36                   ` [PATCH] Fix indentation S.Çağlar Onur
2008-03-25 18:32             ` [PATCH] net/mac80211/: Use time_* macros John W. Linville
2008-03-17 23:31       ` [PATCH] arch/powerpc/platforms/iseries/pci.c: " Stephen Rothwell
2008-03-17 15:40     ` [PATCH] arch/parisc/kernel/unaligned.c: " Kyle McMartin
2008-03-17  9:59   ` [PATCH] arch/ia64/kernel/: " KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1205746593-24820-7-git-send-email-caglar@pardus.org.tr \
    --to=caglar@pardus.org.tr \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome