LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] arch/alpha/kernel/traps.c: Use time_* macros
@ 2008-03-17  9:36 S.Çağlar Onur
  2008-03-17  9:36 ` [PATCH] arch/ia64/kernel/: " S.Çağlar Onur
  0 siblings, 1 reply; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Richard Henderson, Andrew Morton

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: Richard Henderson <rth@twiddle.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 arch/alpha/kernel/traps.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index 2dc7f9f..aa27106 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -8,6 +8,7 @@
  * This file initializes the trap entry points
  */
 
+#include <linux/jiffies.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/tty.h>
@@ -781,7 +782,7 @@ do_entUnaUser(void __user * va, unsigned long opcode,
 	   with the unaliged access.  */
 
 	if (!test_thread_flag (TIF_UAC_NOPRINT)) {
-		if (cnt >= 5 && jiffies - last_time > 5*HZ) {
+		if (cnt >= 5 && time_after(jiffies, last_time + 5 * HZ)) {
 			cnt = 0;
 		}
 		if (++cnt < 5) {
-- 
1.5.4.3


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

* [PATCH] arch/ia64/kernel/: Use time_* macros
  2008-03-17  9:36 [PATCH] arch/alpha/kernel/traps.c: Use time_* macros S.Çağlar Onur
@ 2008-03-17  9:36 ` S.Çağlar Onur
  2008-03-17  9:36   ` [PATCH] arch/parisc/kernel/unaligned.c: " S.Çağlar Onur
  2008-03-17  9:59   ` [PATCH] arch/ia64/kernel/: " KOSAKI Motohiro
  0 siblings, 2 replies; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-ia64, Andrew Morton

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() & time_before() macros, defined at linux/jiffies.h, which deals with wrapping correctly

Cc: linux-ia64@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 arch/ia64/kernel/irq_ia64.c  |    2 +-
 arch/ia64/kernel/mca.c       |    3 ++-
 arch/ia64/kernel/unaligned.c |    3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index d8be23f..5538471 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -472,7 +472,7 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
 			static unsigned char count;
 			static long last_time;
 
-			if (jiffies - last_time > 5*HZ)
+			if (time_after(jiffies, last_time + 5 * HZ))
 				count = 0;
 			if (++count < 5) {
 				last_time = jiffies;
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 6c18221..1959eeb 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -69,6 +69,7 @@
  * 2007-04-27 Russ Anderson <rja@sgi.com>
  *	      Support multiple cpus going through OS_MCA in the same event.
  */
+#include <linux/jiffies.h>
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/sched.h>
@@ -293,7 +294,7 @@ static void ia64_mlogbuf_dump_from_init(void)
 	if (mlogbuf_finished)
 		return;
 
-	if (mlogbuf_timestamp && (mlogbuf_timestamp + 30*HZ > jiffies)) {
+	if (mlogbuf_timestamp && time_before(jiffies, mlogbuf_timestamp + 30 * HZ)) {
 		printk(KERN_ERR "INIT: mlogbuf_dump is interrupted by INIT "
 			" and the system seems to be messed up.\n");
 		ia64_mlogbuf_finish(0);
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index 6903361..ff0e7c1 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -13,6 +13,7 @@
  * 2001/08/13	Correct size of extended floats (float_fsz) from 16 to 10 bytes.
  * 2001/01/17	Add support emulation of unaligned kernel accesses.
  */
+#include <linux/jiffies.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/tty.h>
@@ -1290,7 +1291,7 @@ within_logging_rate_limit (void)
 {
 	static unsigned long count, last_time;
 
-	if (jiffies - last_time > 5*HZ)
+	if (time_after(jiffies, last_time + 5 * HZ))
 		count = 0;
 	if (count < 5) {
 		last_time = jiffies;
-- 
1.5.4.3


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

* [PATCH] arch/parisc/kernel/unaligned.c: Use time_* macros
  2008-03-17  9:36 ` [PATCH] arch/ia64/kernel/: " S.Çağlar Onur
@ 2008-03-17  9:36   ` S.Çağlar Onur
  2008-03-17  9:36     ` [PATCH] arch/powerpc/platforms/iseries/pci.c: " S.Çağlar Onur
  2008-03-17 15:40     ` [PATCH] arch/parisc/kernel/unaligned.c: " Kyle McMartin
  2008-03-17  9:59   ` [PATCH] arch/ia64/kernel/: " KOSAKI Motohiro
  1 sibling, 2 replies; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kyle McMartin, linux-parisc, Andrew Morton

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: Kyle McMartin <kyle@mcmartin.ca>
Cc: linux-parisc@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 arch/parisc/kernel/unaligned.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index aebf3c1..19b8a79 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -460,7 +460,7 @@ void handle_unaligned(struct pt_regs *regs)
 			goto force_sigbus;
 		}
 
-		if (unaligned_count > 5 && jiffies - last_time > 5*HZ) {
+		if (unaligned_count > 5 && time_after(jiffies, last_time + 5 * HZ)) {
 			unaligned_count = 0;
 			last_time = jiffies;
 		}
-- 
1.5.4.3


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

* [PATCH] arch/powerpc/platforms/iseries/pci.c: Use time_* macros
  2008-03-17  9:36   ` [PATCH] arch/parisc/kernel/unaligned.c: " S.Çağlar Onur
@ 2008-03-17  9:36     ` S.Çağlar Onur
  2008-03-17  9:36       ` [PATCH] drivers/net/arcnet/arcnet.c: " S.Çağlar Onur
  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
  1 sibling, 2 replies; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, Paul Mackerras, Andrew Morton

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: linuxppc-dev@ozlabs.org
Cc: Paul Mackerras <paulus@samba.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 arch/powerpc/platforms/iseries/pci.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index cc562e4..02a634f 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -23,6 +23,7 @@
 
 #undef DEBUG
 
+#include <linux/jiffies.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/string.h>
@@ -586,7 +587,7 @@ static inline struct device_node *xlate_iomm_address(
 		static unsigned long last_jiffies;
 		static int num_printed;
 
-		if ((jiffies - last_jiffies) > 60 * HZ) {
+		if (time_after(jiffies, last_jiffies + 60 * HZ)) {
 			last_jiffies = jiffies;
 			num_printed = 0;
 		}
-- 
1.5.4.3


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

* [PATCH] drivers/net/arcnet/arcnet.c: Use time_* macros
  2008-03-17  9:36     ` [PATCH] arch/powerpc/platforms/iseries/pci.c: " S.Çağlar Onur
@ 2008-03-17  9:36       ` S.Çağlar Onur
  2008-03-17  9:36         ` [PATCH] drivers/net/ax88796.c: " S.Çağlar Onur
  2008-03-17 23:31       ` [PATCH] arch/powerpc/platforms/iseries/pci.c: " Stephen Rothwell
  1 sibling, 1 reply; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jeff Garzik, David Miller, netdev, Andrew Morton

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: Jeff Garzik <jeff@garzik.org>
Cc: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 drivers/net/arcnet/arcnet.c |    4 ++--
 include/linux/arcdevice.h   |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index c59c806..c298615 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -940,7 +940,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
 
 			/* is the RECON info empty or old? */
 			if (!lp->first_recon || !lp->last_recon ||
-			    jiffies - lp->last_recon > HZ * 10) {
+			    time_after(jiffies, lp->last_recon + HZ * 10)) {
 				if (lp->network_down)
 					BUGMSG(D_NORMAL, "reconfiguration detected: cabling restored?\n");
 				lp->first_recon = lp->last_recon = jiffies;
@@ -974,7 +974,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
 					lp->num_recons = 1;
 				}
 			}
-		} else if (lp->network_down && jiffies - lp->last_recon > HZ * 10) {
+		} else if (lp->network_down && time_after(jiffies, lp->last_recon + HZ * 10)) {
 			if (lp->network_down)
 				BUGMSG(D_NORMAL, "cabling restored?\n");
 			lp->first_recon = lp->last_recon = 0;
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index fde6758..9d33768 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -283,7 +283,7 @@ struct arcnet_local {
 	int next_buf, first_free_buf;
 
 	/* network "reconfiguration" handling */
-	time_t first_recon,	/* time of "first" RECON message to count */
+	unsigned long first_recon,	/* time of "first" RECON message to count */
 		last_recon;	/* time of most recent RECON */
 	int num_recons;		/* number of RECONs between first and last. */
 	bool network_down;	/* do we think the network is down? */
-- 
1.5.4.3


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

* [PATCH] drivers/net/ax88796.c: Use time_* macros
  2008-03-17  9:36       ` [PATCH] drivers/net/arcnet/arcnet.c: " S.Çağlar Onur
@ 2008-03-17  9:36         ` S.Çağlar Onur
  2008-03-17  9:36           ` [PATCH] net/mac80211/: " S.Çağlar Onur
  0 siblings, 1 reply; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, Andrew Morton

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

diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 194949a..0f823d7 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -11,6 +11,7 @@
  * published by the Free Software Foundation.
 */
 
+#include <linux/jiffies.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -151,7 +152,7 @@ static void ax_reset_8390(struct net_device *dev)
 
 	/* This check _should_not_ be necessary, omit eventually. */
 	while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) {
-		if (jiffies - reset_start_time > 2*HZ/100) {
+		if (time_after(jiffies, reset_start_time + 2 * HZ/100)) {
 			dev_warn(&ax->dev->dev, "%s: %s did not complete.\n",
 			       __FUNCTION__, dev->name);
 			break;
@@ -287,7 +288,7 @@ static void ax_block_output(struct net_device *dev, int count,
 	dma_start = jiffies;
 
 	while ((ei_inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) {
-		if (jiffies - dma_start > 2*HZ/100) {		/* 20ms */
+		if (time_after(jiffies, dma_start + 2 * HZ/100)) {		/* 20ms */
 			dev_warn(&ax->dev->dev,
 				 "%s: timeout waiting for Tx RDC.\n", dev->name);
 			ax_reset_8390(dev);
-- 
1.5.4.3


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

* [PATCH] net/mac80211/: Use time_* macros
  2008-03-17  9:36         ` [PATCH] drivers/net/ax88796.c: " S.Çağlar Onur
@ 2008-03-17  9:36           ` S.Çağlar Onur
  2008-03-17  9:36             ` [PATCH] drivers/net/tokenring/3c359.c: " S.Çağlar Onur
  2008-03-25 18:32             ` [PATCH] net/mac80211/: Use time_* macros John W. Linville
  0 siblings, 2 replies; 15+ 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_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


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

* [PATCH] drivers/net/tokenring/3c359.c: Use time_* macros
  2008-03-17  9:36           ` [PATCH] net/mac80211/: " S.Çağlar Onur
@ 2008-03-17  9:36             ` S.Çağlar Onur
  2008-03-17  9:36               ` [PATCH] drivers/net/wireless/atmel.c: " S.Çağlar Onur
  2008-03-25 18:32             ` [PATCH] net/mac80211/: Use time_* macros John W. Linville
  1 sibling, 1 reply; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, Andrew Morton

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: netdev@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 drivers/net/tokenring/3c359.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 44a06f8..88fe955 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -42,6 +42,7 @@
 
 #define XL_DEBUG 0
 
+#include <linux/jiffies.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -408,7 +409,7 @@ static int xl_hw_reset(struct net_device *dev)
 	t=jiffies;
 	while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { 
 		schedule();		
-		if(jiffies-t > 40*HZ) {
+		if(time_after(jiffies, t + 40 * HZ)) {
 			printk(KERN_ERR "%s: 3COM 3C359 Velocity XL  card not responding to global reset.\n", dev->name);
 			return -ENODEV;
 		}
@@ -519,7 +520,7 @@ static int xl_hw_reset(struct net_device *dev)
 	t=jiffies;
 	while ( !(readw(xl_mmio + MMIO_INTSTATUS_AUTO) & INTSTAT_SRB) ) { 
 		schedule();		
-		if(jiffies-t > 15*HZ) {
+		if(time_after(jiffies, t + 15 * HZ)) {
 			printk(KERN_ERR "3COM 3C359 Velocity XL  card not responding.\n");
 			return -ENODEV; 
 		}
@@ -790,7 +791,7 @@ static int xl_open_hw(struct net_device *dev)
 	t=jiffies;
 	while (! (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_SRB)) { 
 		schedule();		
-		if(jiffies-t > 40*HZ) {
+		if(time_after(jiffies, t + 40 * HZ)) {
 			printk(KERN_ERR "3COM 3C359 Velocity XL  card not responding.\n");
 			break ; 
 		}
@@ -1003,7 +1004,7 @@ static void xl_reset(struct net_device *dev)
 
 	t=jiffies;
 	while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { 
-		if(jiffies-t > 40*HZ) {
+		if(time_after(jiffies, t + 40 * HZ)) {
 			printk(KERN_ERR "3COM 3C359 Velocity XL  card not responding.\n");
 			break ; 
 		}
@@ -1270,7 +1271,7 @@ static int xl_close(struct net_device *dev)
 	t=jiffies;
 	while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { 
 		schedule();		
-		if(jiffies-t > 10*HZ) {
+		if(time_after(jiffies, t + 10 * HZ)) {
 			printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNSTALL not responding.\n", dev->name);
 			break ; 
 		}
@@ -1279,7 +1280,7 @@ static int xl_close(struct net_device *dev)
 	t=jiffies;
 	while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { 
 		schedule();		
-		if(jiffies-t > 10*HZ) {
+		if(time_after(jiffies, t + 10 * HZ)) {
 			printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNDISABLE not responding.\n", dev->name);
 			break ;
 		}
@@ -1288,7 +1289,7 @@ static int xl_close(struct net_device *dev)
 	t=jiffies;
 	while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { 
 		schedule();		
-		if(jiffies-t > 10*HZ) {
+		if(time_after(jiffies, t + 10 * HZ)) {
 			printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-UPSTALL not responding.\n", dev->name);
 			break ; 
 		}
@@ -1305,7 +1306,7 @@ static int xl_close(struct net_device *dev)
 	t=jiffies;
 	while (!(readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_SRB)) { 
 		schedule();		
-		if(jiffies-t > 10*HZ) {
+		if(time_after(jiffies, t + 10 * HZ)) {
 			printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-CLOSENIC not responding.\n", dev->name);
 			break ; 
 		}
@@ -1334,7 +1335,7 @@ static int xl_close(struct net_device *dev)
 	t=jiffies;
 	while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { 
 		schedule();		
-		if(jiffies-t > 10*HZ) {
+		if(time_after(jiffies, t + 10 * HZ)) {
 			printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-UPRESET not responding.\n", dev->name);
 			break ; 
 		}
@@ -1343,7 +1344,7 @@ static int xl_close(struct net_device *dev)
 	t=jiffies;
 	while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { 
 		schedule();		
-		if(jiffies-t > 10*HZ) {
+		if(time_after(jiffies, t + 10 * HZ)) {
 			printk(KERN_ERR "%s: 3COM 3C359 Velocity XL-DNRESET not responding.\n", dev->name);
 			break ; 
 		}
-- 
1.5.4.3


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

* [PATCH] drivers/net/wireless/atmel.c: Use time_* macros
  2008-03-17  9:36             ` [PATCH] drivers/net/tokenring/3c359.c: " S.Çağlar Onur
@ 2008-03-17  9:36               ` S.Çağlar Onur
  2008-03-17  9:36                 ` [PATCH] fs/binfmt_aout.c: Use printk_ratelimit() S.Çağlar Onur
  0 siblings, 1 reply; 15+ 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_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>
---
 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"
 
@@ -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;
 
 	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;
 
 	/* Timeout old surveys. */
-	if ((jiffies - priv->last_survey) > (20 * HZ))
+	if (time_after(jiffies, priv->last_survey + 20 * HZ))
 		priv->site_survey_state = SITE_SURVEY_IDLE;
 	priv->last_survey = jiffies;
 
-- 
1.5.4.3


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

* [PATCH] fs/binfmt_aout.c: Use printk_ratelimit()
  2008-03-17  9:36               ` [PATCH] drivers/net/wireless/atmel.c: " S.Çağlar Onur
@ 2008-03-17  9:36                 ` S.Çağlar Onur
  2008-03-17  9:36                   ` [PATCH] Fix indentation S.Çağlar Onur
  0 siblings, 1 reply; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-arch, Andrew Morton, Geert Uytterhoeven

Use printk_ratelimit() instead of jiffies based arithmetic, suggested by Geert Uytterhoeven

Cc: linux-arch@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
---
 fs/binfmt_aout.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index a1bb224..ba4cddb 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -372,21 +372,17 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
 			 
 		flush_icache_range(text_addr, text_addr+ex.a_text+ex.a_data);
 	} else {
-		static unsigned long error_time, error_time2;
 		if ((ex.a_text & 0xfff || ex.a_data & 0xfff) &&
-		    (N_MAGIC(ex) != NMAGIC) && (jiffies-error_time2) > 5*HZ)
+		    (N_MAGIC(ex) != NMAGIC) && printk_ratelimit())
 		{
 			printk(KERN_NOTICE "executable not page aligned\n");
-			error_time2 = jiffies;
 		}
 
-		if ((fd_offset & ~PAGE_MASK) != 0 &&
-		    (jiffies-error_time) > 5*HZ)
+		if ((fd_offset & ~PAGE_MASK) != 0 && printk_ratelimit())
 		{
 			printk(KERN_WARNING 
 			       "fd_offset is not page aligned. Please convert program: %s\n",
 			       bprm->file->f_path.dentry->d_name.name);
-			error_time = jiffies;
 		}
 
 		if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) {
@@ -495,15 +491,13 @@ static int load_aout_library(struct file *file)
 	start_addr =  ex.a_entry & 0xfffff000;
 
 	if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) {
-		static unsigned long error_time;
 		loff_t pos = N_TXTOFF(ex);
 
-		if ((jiffies-error_time) > 5*HZ)
+		if (printk_ratelimit())
 		{
 			printk(KERN_WARNING 
 			       "N_TXTOFF is not page aligned. Please convert library: %s\n",
 			       file->f_path.dentry->d_name.name);
-			error_time = jiffies;
 		}
 		down_write(&current->mm->mmap_sem);
 		do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
-- 
1.5.4.3


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

* [PATCH] Fix indentation
  2008-03-17  9:36                 ` [PATCH] fs/binfmt_aout.c: Use printk_ratelimit() S.Çağlar Onur
@ 2008-03-17  9:36                   ` S.Çağlar Onur
  0 siblings, 0 replies; 15+ messages in thread
From: S.Çağlar Onur @ 2008-03-17  9:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lee Schermerhorn, Paul Jackson, Andrew Morton

zlc_setup(): handle jiffies wraparound (10ed273f5016c582413dfbc468dd084957d847e1) changes tab with spaces

CC: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
CC: Paul Jackson <pj@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 mm/page_alloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 402a504..363c948 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1284,7 +1284,7 @@ static nodemask_t *zlc_setup(struct zonelist *zonelist, int alloc_flags)
 	if (!zlc)
 		return NULL;
 
-       if (time_after(jiffies, zlc->last_full_zap + HZ)) {
+	if (time_after(jiffies, zlc->last_full_zap + HZ)) {
 		bitmap_zero(zlc->fullzones, MAX_ZONES_PER_ZONELIST);
 		zlc->last_full_zap = jiffies;
 	}
-- 
1.5.4.3


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

* Re: [PATCH] arch/ia64/kernel/: Use time_* macros
  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:59   ` KOSAKI Motohiro
  1 sibling, 0 replies; 15+ messages in thread
From: KOSAKI Motohiro @ 2008-03-17  9:59 UTC (permalink / raw)
  To: S.Ca?lar Onur; +Cc: kosaki.motohiro, linux-kernel, linux-ia64, Andrew Morton

Hi

nice clean up.

Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

> 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() & time_before() macros, defined at linux/jiffies.h, which deals with wrapping correctly





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

* Re: [PATCH] arch/parisc/kernel/unaligned.c: Use time_* macros
  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 15:40     ` Kyle McMartin
  1 sibling, 0 replies; 15+ messages in thread
From: Kyle McMartin @ 2008-03-17 15:40 UTC (permalink / raw)
  To: S.?a??lar Onur; +Cc: linux-kernel, Kyle McMartin, linux-parisc, Andrew Morton

Hi,

On Mon, Mar 17, 2008 at 11:36:25AM +0200, S.?a??lar Onur wrote:

Sorry, I seem to be losing at charsets with your name. :(

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

I prefer the idea of using printk_ratelimit. I've committed a patch that
does this to git and credited you with pointing it out.

cheers, Kyle

> Cc: Kyle McMartin <kyle@mcmartin.ca>
> Cc: linux-parisc@vger.kernel.org
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: S.Ça??lar Onur <caglar@pardus.org.tr>
> ---
>  arch/parisc/kernel/unaligned.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
> index aebf3c1..19b8a79 100644
> --- a/arch/parisc/kernel/unaligned.c
> +++ b/arch/parisc/kernel/unaligned.c
> @@ -460,7 +460,7 @@ void handle_unaligned(struct pt_regs *regs)
>  			goto force_sigbus;
>  		}
>  
> -		if (unaligned_count > 5 && jiffies - last_time > 5*HZ) {
> +		if (unaligned_count > 5 && time_after(jiffies, last_time + 5 * HZ)) {
>  			unaligned_count = 0;
>  			last_time = jiffies;
>  		}
> -- 
> 1.5.4.3
> 

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

* Re: [PATCH] arch/powerpc/platforms/iseries/pci.c: Use time_* macros
  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 23:31       ` Stephen Rothwell
  1 sibling, 0 replies; 15+ messages in thread
From: Stephen Rothwell @ 2008-03-17 23:31 UTC (permalink / raw)
  To: S.Çağlar Onur
  Cc: linux-kernel, linuxppc-dev, Andrew Morton, Paul Mackerras

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

On Mon, 17 Mar 2008 11:36:26 +0200 S.Çağlar Onur <caglar@pardus.org.tr> wrote:
>
> 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: linuxppc-dev@ozlabs.org
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>

Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] net/mac80211/: Use time_* macros
  2008-03-17  9:36           ` [PATCH] net/mac80211/: " S.Çağlar Onur
  2008-03-17  9:36             ` [PATCH] drivers/net/tokenring/3c359.c: " S.Çağlar Onur
@ 2008-03-25 18:32             ` John W. Linville
  1 sibling, 0 replies; 15+ 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.Çağlar Onur wrote:
> 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

These two patches are already queues for 2.6.26.

John
-- 
John W. Linville
linville@tuxdriver.com

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

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

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-17  9:36 [PATCH] arch/alpha/kernel/traps.c: Use time_* macros 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           ` [PATCH] net/mac80211/: " S.Çağlar Onur
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

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