[PATCH] ne2: use time_after() From: Marcelo Feitoza Parisi It deals with wrapping correctly and is nicer to read. Signed-off-by: Alexey Dobriyan Index: linux-kj/drivers/net/ne2.c =================================================================== --- linux-kj.orig/drivers/net/ne2.c 2005-10-28 16:25:11.000000000 +0400 +++ linux-kj/drivers/net/ne2.c 2005-10-28 16:29:28.000000000 +0400 @@ -75,6 +75,7 @@ static const char *version = "ne2.c:v0.9 #include #include #include +#include #include #include @@ -403,7 +404,7 @@ static int __init ne2_probe1(struct net_ outb(inb(base_addr + NE_RESET), base_addr + NE_RESET); while ((inb_p(base_addr + EN0_ISR) & ENISR_RESET) == 0) - if (jiffies - reset_start_time > 2*HZ/100) { + if (time_after(jiffies, reset_start_time + 2*HZ/100)) { printk(" not found (no reset ack).\n"); retval = -ENODEV; goto out; @@ -556,7 +557,7 @@ static void ne_reset_8390(struct net_dev /* This check _should_not_ be necessary, omit eventually. */ while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) - if (jiffies - reset_start_time > 2*HZ/100) { + if (time_after(jiffies, reset_start_time + 2*HZ/100)) { printk("%s: ne_reset_8390() did not complete.\n", dev->name); break; @@ -757,7 +758,7 @@ retry: #endif while ((inb_p(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 */ printk("%s: timeout waiting for Tx RDC.\n", dev->name); ne_reset_8390(dev); NS8390_init(dev,1);