linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mac80211/: Use time_* macros
       [not found]         ` <1205746593-24820-6-git-send-email-caglar@pardus.org.tr>
@ 2008-03-17  9:36           ` S.Çağlar Onur
       [not found]             ` <1205746593-24820-8-git-send-email-caglar@pardus.org.tr>
  2008-03-25 18:32             ` [PATCH] net/mac80211/: " John W. Linville
  0 siblings, 2 replies; 3+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-wireless, Andrew Morton

The functions time_before, time_before_eq, time_after, and time_after_e=
q 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.=C3=87a=C4=9Flar 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_simpl=
e.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.
  */
=20
+#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 *pri=
v, struct net_device *dev,
 		rate_control_rate_dec(local, sta);
 	}
=20
-	if (srctrl->avg_rate_update + 60 * HZ < jiffies) {
+	if (time_after(jiffies, srctrl->avg_rate_update + 60 * HZ)) {
 		srctrl->avg_rate_update =3D 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.
  */
=20
+#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_d=
ata *sdata,
 		    compare_ether_addr(hdr->addr2, f_hdr->addr2) !=3D 0)
 			continue;
=20
-		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;
 		}
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] drivers/net/wireless/atmel.c: Use time_* macros
       [not found]             ` <1205746593-24820-8-git-send-email-caglar@pardus.org.tr>
@ 2008-03-17  9:36               ` S.Çağlar Onur
  0 siblings, 0 replies; 3+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-wireless, Andrew Morton

The functions time_before, time_before_eq, time_after, and time_after_e=
q 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.=C3=87a=C4=9Flar Onur <caglar@pardus.org.tr>
---
 drivers/net/wireless/atmel.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.=
c
index 63ec7a7..ef2da40 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -66,6 +66,7 @@
 #include <linux/device.h>
 #include <linux/moduleparam.h>
 #include <linux/firmware.h>
+#include <linux/jiffies.h>
 #include <net/ieee80211.h>
 #include "atmel.h"
=20
@@ -516,7 +517,7 @@ struct atmel_private {
 		SITE_SURVEY_IN_PROGRESS,
 		SITE_SURVEY_COMPLETED
 	} site_survey_state;
-	time_t last_survey;
+	unsigned long last_survey;
=20
 	int station_was_associated, station_is_associated;
 	int fast_scan;
@@ -2283,7 +2284,7 @@ static int atmel_set_scan(struct net_device *dev,
 		return -EAGAIN;
=20
 	/* Timeout old surveys. */
-	if ((jiffies - priv->last_survey) > (20 * HZ))
+	if (time_after(jiffies, priv->last_survey + 20 * HZ))
 		priv->site_survey_state =3D SITE_SURVEY_IDLE;
 	priv->last_survey =3D jiffies;
=20
--=20
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/mac80211/: Use time_* macros
  2008-03-17  9:36           ` [PATCH] net/mac80211/: Use time_* macros S.Çağlar Onur
       [not found]             ` <1205746593-24820-8-git-send-email-caglar@pardus.org.tr>
@ 2008-03-25 18:32             ` John W. Linville
  1 sibling, 0 replies; 3+ messages in thread
From: John W. Linville @ 2008-03-25 18:32 UTC (permalink / raw)
  To: S.Çağlar Onur; +Cc: linux-kernel, linux-wireless, Andrew Morton

On Mon, Mar 17, 2008 at 11:36:29AM +0200, S.=C3=87a=C4=9Flar Onur wrote=
:
> The functions time_before, time_before_eq, time_after, and time_after=
_eq are more robust for comparing jiffies against other values.
>=20
> So following patch implements usage of the time_after() macro, define=
d at linux/jiffies.h, which deals with wrapping correctly

These two patches are already queues for 2.6.26.

John
--=20
John W. Linville
linville@tuxdriver.com
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-25 19:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1205746593-24820-1-git-send-email-caglar@pardus.org.tr>
     [not found] ` <1205746593-24820-2-git-send-email-caglar@pardus.org.tr>
     [not found]   ` <1205746593-24820-3-git-send-email-caglar@pardus.org.tr>
     [not found]     ` <1205746593-24820-4-git-send-email-caglar@pardus.org.tr>
     [not found]       ` <1205746593-24820-5-git-send-email-caglar@pardus.org.tr>
     [not found]         ` <1205746593-24820-6-git-send-email-caglar@pardus.org.tr>
2008-03-17  9:36           ` [PATCH] net/mac80211/: Use time_* macros S.Çağlar Onur
     [not found]             ` <1205746593-24820-8-git-send-email-caglar@pardus.org.tr>
2008-03-17  9:36               ` [PATCH] drivers/net/wireless/atmel.c: " S.Çağlar Onur
2008-03-25 18:32             ` [PATCH] net/mac80211/: " John W. Linville

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).