2008-03-17 09:38:33

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] arch/alpha/kernel/traps.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

Cc: Richard Henderson <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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


2008-03-17 09:37:30

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] arch/powerpc/platforms/iseries/pci.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

Cc: [email protected]
Cc: Paul Mackerras <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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

2008-03-17 09:37:57

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] arch/parisc/kernel/unaligned.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

Cc: Kyle McMartin <[email protected]>
Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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

2008-03-17 09:38:17

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] drivers/net/arcnet/arcnet.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

Cc: Jeff Garzik <[email protected]>
Cc: David Miller <[email protected]>
Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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

2008-03-17 09:38:59

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] drivers/net/ax88796.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

Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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

2008-03-17 09:39:23

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] net/mac80211/: 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

Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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

2008-03-17 09:39:38

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] drivers/net/wireless/atmel.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

Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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

2008-03-17 09:39:52

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] drivers/net/tokenring/3c359.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

Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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

2008-03-17 09:40:14

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] Fix indentation

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

CC: Lee Schermerhorn <[email protected]>
CC: Paul Jackson <[email protected]>
Cc: Andrew Morton <[email protected]>
---
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

2008-03-17 09:40:41

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] fs/binfmt_aout.c: Use printk_ratelimit()

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

Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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

2008-03-17 09:38:45

by S.Çağlar Onur

[permalink] [raw]
Subject: [PATCH] arch/ia64/kernel/: 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() & time_before() macros, defined at linux/jiffies.h, which deals with wrapping correctly

Cc: [email protected]
Cc: Andrew Morton <[email protected]>
Signed-off-by: S.Çağlar Onur <[email protected]>
---
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 <[email protected]>
* 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

2008-03-17 09:59:51

by KOSAKI Motohiro

[permalink] [raw]
Subject: Re: [PATCH] arch/ia64/kernel/: Use time_* macros

Hi

nice clean up.

Reviewed-by: KOSAKI Motohiro <[email protected]>

> 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



2008-03-17 15:41:16

by Kyle McMartin

[permalink] [raw]
Subject: Re: [PATCH] arch/parisc/kernel/unaligned.c: Use time_* macros

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 <[email protected]>
> Cc: [email protected]
> Cc: Andrew Morton <[email protected]>
> Signed-off-by: S.?a??lar Onur <[email protected]>
> ---
> 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
>

2008-03-17 23:34:29

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH] arch/powerpc/platforms/iseries/pci.c: Use time_* macros

On Mon, 17 Mar 2008 11:36:26 +0200 S.Çağlar Onur <[email protected]> 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: [email protected]
> Cc: Paul Mackerras <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Signed-off-by: S.Çağlar Onur <[email protected]>

Acked-by: Stephen Rothwell <[email protected]>

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (682.00 B)
(No filename) (189.00 B)
Download all attachments

2008-03-25 19:08:23

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH] net/mac80211/: Use time_* macros

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
[email protected]