Re: [Bluez-devel] [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros

2008-02-17 Thread David Miller
From: Marcel Holtmann <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 13/14] kernel/irq/spurious.c: Use time_* macros

2008-02-17 Thread Thomas Gleixner
On Thu, 14 Feb 2008, 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

Applied. Thanks,

 tglx

Re: [PATCH 13/14] kernel/irq/spurious.c: Use time_* macros

2008-02-17 Thread Thomas Gleixner
On Thu, 14 Feb 2008, 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

Applied. Thanks,

 tglx

Re: [Bluez-devel] [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros

2008-02-17 Thread David Miller
From: Marcel Holtmann [EMAIL PROTECTED]
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 [EMAIL PROTECTED]

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 12/14] fs/binfmt_aout.c: Use time_* macros

2008-02-14 Thread S.Çağlar Onur
14 Şub 2008 Per tarihinde, Geert Uytterhoeven şunları yazmıştı: 
> To me these constructs look like good candidates for replacement by
> printk_ratelimit()?
> 
> Gr{oetje,eeting}s,

What about something like following?


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

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 & 0xf000;
 
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(>mm->mmap_sem);
do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);

Cheers
-- 
S.Çağlar Onur <[EMAIL PROTECTED]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 12/14] fs/binfmt_aout.c: Use time_* macros

2008-02-14 Thread Geert Uytterhoeven
On Thu, 14 Feb 2008, S.�~Ga�~_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
> 
> Cc: [EMAIL PROTECTED]
> Signed-off-by: S.Çağlar Onur <[EMAIL PROTECTED]>
> ---
>  fs/binfmt_aout.c |7 ---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
> index a1bb224..72757fe 100644
> --- a/fs/binfmt_aout.c
> +++ b/fs/binfmt_aout.c
> @@ -6,6 +6,7 @@
>  
>  #include 
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -374,14 +375,14 @@ static int load_aout_binary(struct linux_binprm * bprm, 
> struct pt_regs * regs)
>   } 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) && time_after(jiffies, error_time2 
> + 5 * HZ))
>   {
>   printk(KERN_NOTICE "executable not page aligned\n");
>   error_time2 = jiffies;
>   }
>
>  
>   if ((fd_offset & ~PAGE_MASK) != 0 &&
> - (jiffies-error_time) > 5*HZ)
> + time_after(jiffies, error_time + 5 * HZ))
>   {
>   printk(KERN_WARNING 
>  "fd_offset is not page aligned. Please convert 
> program: %s\n",
> @@ -498,7 +499,7 @@ static int load_aout_library(struct file *file)
>   static unsigned long error_time;
>   loff_t pos = N_TXTOFF(ex);
>  
> - if ((jiffies-error_time) > 5*HZ)
> + if (time_after(jiffies ,error_time + 5 * HZ))
>   {
>   printk(KERN_WARNING 
>  "N_TXTOFF is not page aligned. Please convert 
> library: %s\n",

To me these constructs look like good candidates for replacement by
printk_ratelimit()?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [EMAIL PROTECTED]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

Re: [Bluez-devel] [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros

2008-02-14 Thread Marcel Holtmann
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: [EMAIL PROTECTED]
> Signed-off-by: S.Çağlar Onur <[EMAIL PROTECTED]>

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 <[EMAIL PROTECTED]>

Regards

Marcel


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/14] mm/: Use time_* macros

2008-02-14 Thread 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: [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur <[EMAIL PROTECTED]>
---
 mm/page_alloc.c |3 ++-
 mm/pdflush.c|5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 75b9793..1a0c9cc 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -14,6 +14,7 @@
  *  (lots of bits borrowed from Ingo Molnar & Andrew Morton)
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -1276,7 +1277,7 @@ static nodemask_t *zlc_setup(struct zonelist *zonelist, 
int alloc_flags)
if (!zlc)
return NULL;
 
-   if (jiffies - zlc->last_full_zap > 1 * HZ) {
+   if (time_after(jiffies, zlc->last_full_zap + HZ)) {
bitmap_zero(zlc->fullzones, MAX_ZONES_PER_ZONELIST);
zlc->last_full_zap = jiffies;
}
diff --git a/mm/pdflush.c b/mm/pdflush.c
index 8f6ee07..5d736d5 100644
--- a/mm/pdflush.c
+++ b/mm/pdflush.c
@@ -10,6 +10,7 @@
  * up stack space with nested calls to kernel_thread.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -130,7 +131,7 @@ static int __pdflush(struct pdflush_work *my_work)
 * Thread creation: For how long have there been zero
 * available threads?
 */
-   if (jiffies - last_empty_jifs > 1 * HZ) {
+   if (time_after(jiffies, last_empty_jifs + HZ)) {
/* unlocked list_empty() test is OK here */
if (list_empty(_list)) {
/* unlocked test is OK here */
@@ -151,7 +152,7 @@ static int __pdflush(struct pdflush_work *my_work)
if (nr_pdflush_threads <= MIN_PDFLUSH_THREADS)
continue;
pdf = list_entry(pdflush_list.prev, struct pdflush_work, list);
-   if (jiffies - pdf->when_i_went_to_sleep > 1 * HZ) {
+   if (time_after(jiffies, pdf->when_i_went_to_sleep + HZ)) {
/* Limit exit rate */
pdf->when_i_went_to_sleep = jiffies;
break;  /* exeunt */
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/14] fs/binfmt_aout.c: Use time_* macros

2008-02-14 Thread 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: [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur <[EMAIL PROTECTED]>
---
 fs/binfmt_aout.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index a1bb224..72757fe 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -6,6 +6,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -374,14 +375,14 @@ static int load_aout_binary(struct linux_binprm * bprm, 
struct pt_regs * regs)
} 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) && time_after(jiffies, error_time2 
+ 5 * HZ))
{
printk(KERN_NOTICE "executable not page aligned\n");
error_time2 = jiffies;
}
 
if ((fd_offset & ~PAGE_MASK) != 0 &&
-   (jiffies-error_time) > 5*HZ)
+   time_after(jiffies, error_time + 5 * HZ))
{
printk(KERN_WARNING 
   "fd_offset is not page aligned. Please convert 
program: %s\n",
@@ -498,7 +499,7 @@ static int load_aout_library(struct file *file)
static unsigned long error_time;
loff_t pos = N_TXTOFF(ex);
 
-   if ((jiffies-error_time) > 5*HZ)
+   if (time_after(jiffies ,error_time + 5 * HZ))
{
printk(KERN_WARNING 
   "N_TXTOFF is not page aligned. Please convert 
library: %s\n",
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/14] drivers/net/ax88796.c: Use time_* macros

2008-02-14 Thread 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: [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 
 #include 
 #include 
 #include 
@@ -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(>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(>dev->dev,
 "%s: timeout waiting for Tx RDC.\n", 
dev->name);
ax_reset_8390(dev);
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/14] drivers/net/wireless/atmel.c: Use time_* macros

2008-02-14 Thread 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: [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 
 #include 
 #include 
+#include 
 #include 
 #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.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/14] drivers/net/tokenring/3c359.c: Use time_* macros

2008-02-14 Thread 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: [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 
 #include 
 #include 
 #include 
@@ -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 > 

[PATCH 13/14] kernel/irq/spurious.c: Use time_* macros

2008-02-14 Thread 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: Ingo Molnar <[EMAIL PROTECTED]>
Cc: Thomas Gleixner <[EMAIL PROTECTED]>
Signed-off-by: S.Çağlar Onur <[EMAIL PROTECTED]>
---
 kernel/irq/spurious.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index a6b2bc8..088dabb 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -6,6 +6,7 @@
  * This file contains spurious interrupt handling.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -179,7 +180,7 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
 * otherwise the couter becomes a doomsday timer for otherwise
 * working systems
 */
-   if (jiffies - desc->last_unhandled > HZ/10)
+   if (time_after(jiffies, desc->last_unhandled + HZ/10))
desc->irqs_unhandled = 1;
else
desc->irqs_unhandled++;
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros

2008-02-14 Thread 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: [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur <[EMAIL PROTECTED]>
---
 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 
 #include 
 #include 
 
@@ -1321,7 +1322,7 @@ static inline void hci_sched_acl(struct hci_dev *hdev)
if (!test_bit(HCI_RAW, >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(>cmd_cnt));
 
-   if (!atomic_read(>cmd_cnt) && (jiffies - hdev->cmd_last_tx) > HZ) 
{
+   if (!atomic_read(>cmd_cnt) && time_after(jiffies, 
hdev->cmd_last_tx + HZ)) {
BT_ERR("%s command tx timeout", hdev->name);
atomic_set(>cmd_cnt, 1);
}
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/14] arch/sparc64/kernel/unaligned.c: Use time_* macros

2008-02-14 Thread 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: [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur <[EMAIL PROTECTED]>
---
 arch/sparc64/kernel/unaligned.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index dc7bf1b..1a511e9 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -7,6 +7,7 @@
  */
 
 
+#include 
 #include 
 #include 
 #include 
@@ -283,7 +284,7 @@ static void log_unaligned(struct pt_regs *regs)
 {
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.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Use time_* macros

2008-02-14 Thread 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 patchset implements usage of the time_* macros, defined at 
linux/jiffies.h, which deals with wrapping correctly

 arch/alpha/kernel/traps.c|3 ++-
 arch/ia64/kernel/irq_ia64.c  |2 +-
 arch/ia64/kernel/mca.c   |3 ++-
 arch/ia64/kernel/unaligned.c |3 ++-
 arch/parisc/kernel/unaligned.c   |2 +-
 arch/powerpc/platforms/iseries/pci.c |3 ++-
 arch/sparc64/kernel/unaligned.c  |3 ++-
 drivers/net/arcnet/arcnet.c  |4 ++--
 drivers/net/ax88796.c|5 +++--
 drivers/net/tokenring/3c359.c|   21 +++--
 drivers/net/wireless/atmel.c |5 +++--
 fs/binfmt_aout.c |7 ---
 include/linux/arcdevice.h|2 +-
 kernel/irq/spurious.c|3 ++-
 mm/page_alloc.c  |3 ++-
 mm/pdflush.c |5 +++--
 net/bluetooth/hci_core.c |5 +++--
 net/mac80211/rc80211_simple.c|3 ++-
 net/mac80211/rx.c|3 ++-
 19 files changed, 50 insertions(+), 35 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/14] net/mac80211/: Use time_* macros

2008-02-14 Thread 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: [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 
 #include 
 #include 
 #include 
@@ -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 
 #include 
 #include 
 #include 
@@ -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(>skb_list);
continue;
}
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/14] arch/alpha/kernel/traps.c: Use time_* macros

2008-02-14 Thread 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: Richard Henderson <[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 
 #include 
 #include 
 #include 
@@ -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.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/14] drivers/net/arcnet/arcnet.c: Use time_* macros

2008-02-14 Thread 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: [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..537d661 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -283,7 +284,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.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/14] arch/ia64/kernel/: Use time_* macros

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

Cc: [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 0b52f19..5017a2d 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -405,7 +405,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 6e17aed..9b03e32 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 
 #include 
 #include 
 #include 
@@ -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 52f70bb..0bd0f46 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 
 #include 
 #include 
 #include 
@@ -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.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/14] arch/parisc/kernel/unaligned.c: Use time_* macros

2008-02-14 Thread 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: [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.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/14] arch/powerpc/platforms/iseries/pci.c: Use time_* macros

2008-02-14 Thread 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: [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 
 #include 
 #include 
 #include 
@@ -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.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/14] arch/powerpc/platforms/iseries/pci.c: Use time_* macros

2008-02-14 Thread 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: [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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/14] arch/parisc/kernel/unaligned.c: Use time_* macros

2008-02-14 Thread 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: [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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/14] arch/ia64/kernel/: Use time_* macros

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

Cc: [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 0b52f19..5017a2d 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -405,7 +405,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 6e17aed..9b03e32 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 52f70bb..0bd0f46 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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/14] arch/alpha/kernel/traps.c: Use time_* macros

2008-02-14 Thread 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: Richard Henderson [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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/14] drivers/net/arcnet/arcnet.c: Use time_* macros

2008-02-14 Thread 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: [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..537d661 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -283,7 +284,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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/14] net/mac80211/: Use time_* macros

2008-02-14 Thread 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: [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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/14] arch/sparc64/kernel/unaligned.c: Use time_* macros

2008-02-14 Thread 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: [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur [EMAIL PROTECTED]
---
 arch/sparc64/kernel/unaligned.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
index dc7bf1b..1a511e9 100644
--- a/arch/sparc64/kernel/unaligned.c
+++ b/arch/sparc64/kernel/unaligned.c
@@ -7,6 +7,7 @@
  */
 
 
+#include linux/jiffies.h
 #include linux/kernel.h
 #include linux/sched.h
 #include linux/mm.h
@@ -283,7 +284,7 @@ static void log_unaligned(struct pt_regs *regs)
 {
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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Use time_* macros

2008-02-14 Thread 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 patchset implements usage of the time_* macros, defined at 
linux/jiffies.h, which deals with wrapping correctly

 arch/alpha/kernel/traps.c|3 ++-
 arch/ia64/kernel/irq_ia64.c  |2 +-
 arch/ia64/kernel/mca.c   |3 ++-
 arch/ia64/kernel/unaligned.c |3 ++-
 arch/parisc/kernel/unaligned.c   |2 +-
 arch/powerpc/platforms/iseries/pci.c |3 ++-
 arch/sparc64/kernel/unaligned.c  |3 ++-
 drivers/net/arcnet/arcnet.c  |4 ++--
 drivers/net/ax88796.c|5 +++--
 drivers/net/tokenring/3c359.c|   21 +++--
 drivers/net/wireless/atmel.c |5 +++--
 fs/binfmt_aout.c |7 ---
 include/linux/arcdevice.h|2 +-
 kernel/irq/spurious.c|3 ++-
 mm/page_alloc.c  |3 ++-
 mm/pdflush.c |5 +++--
 net/bluetooth/hci_core.c |5 +++--
 net/mac80211/rc80211_simple.c|3 ++-
 net/mac80211/rx.c|3 ++-
 19 files changed, 50 insertions(+), 35 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/14] kernel/irq/spurious.c: Use time_* macros

2008-02-14 Thread 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: Ingo Molnar [EMAIL PROTECTED]
Cc: Thomas Gleixner [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur [EMAIL PROTECTED]
---
 kernel/irq/spurious.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index a6b2bc8..088dabb 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -6,6 +6,7 @@
  * This file contains spurious interrupt handling.
  */
 
+#include linux/jiffies.h
 #include linux/irq.h
 #include linux/module.h
 #include linux/kallsyms.h
@@ -179,7 +180,7 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
 * otherwise the couter becomes a doomsday timer for otherwise
 * working systems
 */
-   if (jiffies - desc-last_unhandled  HZ/10)
+   if (time_after(jiffies, desc-last_unhandled + HZ/10))
desc-irqs_unhandled = 1;
else
desc-irqs_unhandled++;
-- 
1.5.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros

2008-02-14 Thread 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: [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur [EMAIL PROTECTED]
---
 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

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/14] drivers/net/wireless/atmel.c: Use time_* macros

2008-02-14 Thread 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: [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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/14] drivers/net/tokenring/3c359.c: Use time_* macros

2008-02-14 Thread 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: [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(); 
-   

[PATCH 12/14] fs/binfmt_aout.c: Use time_* macros

2008-02-14 Thread 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: [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur [EMAIL PROTECTED]
---
 fs/binfmt_aout.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index a1bb224..72757fe 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -6,6 +6,7 @@
 
 #include linux/module.h
 
+#include linux/jiffies.h
 #include linux/time.h
 #include linux/kernel.h
 #include linux/mm.h
@@ -374,14 +375,14 @@ static int load_aout_binary(struct linux_binprm * bprm, 
struct pt_regs * regs)
} 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)  time_after(jiffies, error_time2 
+ 5 * HZ))
{
printk(KERN_NOTICE executable not page aligned\n);
error_time2 = jiffies;
}
 
if ((fd_offset  ~PAGE_MASK) != 0 
-   (jiffies-error_time)  5*HZ)
+   time_after(jiffies, error_time + 5 * HZ))
{
printk(KERN_WARNING 
   fd_offset is not page aligned. Please convert 
program: %s\n,
@@ -498,7 +499,7 @@ static int load_aout_library(struct file *file)
static unsigned long error_time;
loff_t pos = N_TXTOFF(ex);
 
-   if ((jiffies-error_time)  5*HZ)
+   if (time_after(jiffies ,error_time + 5 * HZ))
{
printk(KERN_WARNING 
   N_TXTOFF is not page aligned. Please convert 
library: %s\n,
-- 
1.5.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/14] drivers/net/ax88796.c: Use time_* macros

2008-02-14 Thread 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: [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.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/14] mm/: Use time_* macros

2008-02-14 Thread 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: [EMAIL PROTECTED]
Signed-off-by: S.Çağlar Onur [EMAIL PROTECTED]
---
 mm/page_alloc.c |3 ++-
 mm/pdflush.c|5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 75b9793..1a0c9cc 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -14,6 +14,7 @@
  *  (lots of bits borrowed from Ingo Molnar  Andrew Morton)
  */
 
+#include linux/jiffies.h
 #include linux/stddef.h
 #include linux/mm.h
 #include linux/swap.h
@@ -1276,7 +1277,7 @@ static nodemask_t *zlc_setup(struct zonelist *zonelist, 
int alloc_flags)
if (!zlc)
return NULL;
 
-   if (jiffies - zlc-last_full_zap  1 * HZ) {
+   if (time_after(jiffies, zlc-last_full_zap + HZ)) {
bitmap_zero(zlc-fullzones, MAX_ZONES_PER_ZONELIST);
zlc-last_full_zap = jiffies;
}
diff --git a/mm/pdflush.c b/mm/pdflush.c
index 8f6ee07..5d736d5 100644
--- a/mm/pdflush.c
+++ b/mm/pdflush.c
@@ -10,6 +10,7 @@
  * up stack space with nested calls to kernel_thread.
  */
 
+#include linux/jiffies.h
 #include linux/sched.h
 #include linux/list.h
 #include linux/signal.h
@@ -130,7 +131,7 @@ static int __pdflush(struct pdflush_work *my_work)
 * Thread creation: For how long have there been zero
 * available threads?
 */
-   if (jiffies - last_empty_jifs  1 * HZ) {
+   if (time_after(jiffies, last_empty_jifs + HZ)) {
/* unlocked list_empty() test is OK here */
if (list_empty(pdflush_list)) {
/* unlocked test is OK here */
@@ -151,7 +152,7 @@ static int __pdflush(struct pdflush_work *my_work)
if (nr_pdflush_threads = MIN_PDFLUSH_THREADS)
continue;
pdf = list_entry(pdflush_list.prev, struct pdflush_work, list);
-   if (jiffies - pdf-when_i_went_to_sleep  1 * HZ) {
+   if (time_after(jiffies, pdf-when_i_went_to_sleep + HZ)) {
/* Limit exit rate */
pdf-when_i_went_to_sleep = jiffies;
break;  /* exeunt */
-- 
1.5.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Bluez-devel] [PATCH 14/14] net/bluetooth/hci_core.c: Use time_* macros

2008-02-14 Thread Marcel Holtmann
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: [EMAIL PROTECTED]
 Signed-off-by: S.Çağlar Onur [EMAIL PROTECTED]

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 [EMAIL PROTECTED]

Regards

Marcel


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 12/14] fs/binfmt_aout.c: Use time_* macros

2008-02-14 Thread Geert Uytterhoeven
On Thu, 14 Feb 2008, S.�~Ga�~_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
 
 Cc: [EMAIL PROTECTED]
 Signed-off-by: S.Çağlar Onur [EMAIL PROTECTED]
 ---
  fs/binfmt_aout.c |7 ---
  1 files changed, 4 insertions(+), 3 deletions(-)
 
 diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
 index a1bb224..72757fe 100644
 --- a/fs/binfmt_aout.c
 +++ b/fs/binfmt_aout.c
 @@ -6,6 +6,7 @@
  
  #include linux/module.h
  
 +#include linux/jiffies.h
  #include linux/time.h
  #include linux/kernel.h
  #include linux/mm.h
 @@ -374,14 +375,14 @@ static int load_aout_binary(struct linux_binprm * bprm, 
 struct pt_regs * regs)
   } 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)  time_after(jiffies, error_time2 
 + 5 * HZ))
   {
   printk(KERN_NOTICE executable not page aligned\n);
   error_time2 = jiffies;
   }

  
   if ((fd_offset  ~PAGE_MASK) != 0 
 - (jiffies-error_time)  5*HZ)
 + time_after(jiffies, error_time + 5 * HZ))
   {
   printk(KERN_WARNING 
  fd_offset is not page aligned. Please convert 
 program: %s\n,
 @@ -498,7 +499,7 @@ static int load_aout_library(struct file *file)
   static unsigned long error_time;
   loff_t pos = N_TXTOFF(ex);
  
 - if ((jiffies-error_time)  5*HZ)
 + if (time_after(jiffies ,error_time + 5 * HZ))
   {
   printk(KERN_WARNING 
  N_TXTOFF is not page aligned. Please convert 
 library: %s\n,

To me these constructs look like good candidates for replacement by
printk_ratelimit()?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [EMAIL PROTECTED]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds

Re: [PATCH 12/14] fs/binfmt_aout.c: Use time_* macros

2008-02-14 Thread S.Çağlar Onur
14 Şub 2008 Per tarihinde, Geert Uytterhoeven şunları yazmıştı: 
 To me these constructs look like good candidates for replacement by
 printk_ratelimit()?
 
 Gr{oetje,eeting}s,

What about something like following?


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

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  0xf000;
 
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);

Cheers
-- 
S.Çağlar Onur [EMAIL PROTECTED]
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/