aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Feitoza Parisi <marcelo@feitoza.com.br>2006-01-09 21:37:15 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-17 07:59:23 -0500
commitff5688ae1cedfb175b5ed0f319d03ad2e5ee005d (patch)
treeeca0d41b3eefc833238591e0100a8136f21269a7
parente03d72b99e4027504ada134bf1804d6ea792b206 (diff)
[PATCH] drivers/net/*: use time_after() and friends
They deal with wrapping correctly and are nicer to read. Also make jiffies-holding variables unsigned long. Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/net/3c523.c9
-rw-r--r--drivers/net/3c59x.c3
-rw-r--r--drivers/net/apne.c7
-rw-r--r--drivers/net/arcnet/arcnet.c3
-rw-r--r--drivers/net/arm/etherh.c3
-rw-r--r--drivers/net/eth16i.c11
-rw-r--r--drivers/net/hamradio/baycom_epp.c2
-rw-r--r--drivers/net/hp100.c5
-rw-r--r--drivers/net/ne-h8300.c5
-rw-r--r--drivers/net/ne.c7
-rw-r--r--drivers/net/ne2.c7
-rw-r--r--drivers/net/ns83820.c5
-rw-r--r--drivers/net/oaknet.c3
-rw-r--r--drivers/net/pcmcia/3c589_cs.c3
-rw-r--r--drivers/net/ppp_async.c3
-rw-r--r--drivers/net/seeq8005.c5
-rw-r--r--drivers/net/shaper.c3
-rw-r--r--drivers/net/tokenring/lanstreamer.c3
-rw-r--r--drivers/net/tokenring/olympic.c9
-rw-r--r--drivers/net/tulip/pnic.c3
-rw-r--r--drivers/net/wireless/strip.c4
-rw-r--r--drivers/net/zorro8390.c7
22 files changed, 65 insertions, 45 deletions
diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c
index 9e1fe2e0478c..b40885d41680 100644
--- a/drivers/net/3c523.c
+++ b/drivers/net/3c523.c
@@ -105,6 +105,7 @@
105#include <linux/mca-legacy.h> 105#include <linux/mca-legacy.h>
106#include <linux/ethtool.h> 106#include <linux/ethtool.h>
107#include <linux/bitops.h> 107#include <linux/bitops.h>
108#include <linux/jiffies.h>
108 109
109#include <asm/uaccess.h> 110#include <asm/uaccess.h>
110#include <asm/processor.h> 111#include <asm/processor.h>
@@ -658,7 +659,7 @@ static int init586(struct net_device *dev)
658 659
659 s = jiffies; /* warning: only active with interrupts on !! */ 660 s = jiffies; /* warning: only active with interrupts on !! */
660 while (!(cfg_cmd->cmd_status & STAT_COMPL)) { 661 while (!(cfg_cmd->cmd_status & STAT_COMPL)) {
661 if (jiffies - s > 30*HZ/100) 662 if (time_after(jiffies, s + 30*HZ/100))
662 break; 663 break;
663 } 664 }
664 665
@@ -684,7 +685,7 @@ static int init586(struct net_device *dev)
684 685
685 s = jiffies; 686 s = jiffies;
686 while (!(ias_cmd->cmd_status & STAT_COMPL)) { 687 while (!(ias_cmd->cmd_status & STAT_COMPL)) {
687 if (jiffies - s > 30*HZ/100) 688 if (time_after(jiffies, s + 30*HZ/100))
688 break; 689 break;
689 } 690 }
690 691
@@ -709,7 +710,7 @@ static int init586(struct net_device *dev)
709 710
710 s = jiffies; 711 s = jiffies;
711 while (!(tdr_cmd->cmd_status & STAT_COMPL)) { 712 while (!(tdr_cmd->cmd_status & STAT_COMPL)) {
712 if (jiffies - s > 30*HZ/100) { 713 if (time_after(jiffies, s + 30*HZ/100)) {
713 printk(KERN_WARNING "%s: %d Problems while running the TDR.\n", dev->name, __LINE__); 714 printk(KERN_WARNING "%s: %d Problems while running the TDR.\n", dev->name, __LINE__);
714 result = 1; 715 result = 1;
715 break; 716 break;
@@ -798,7 +799,7 @@ static int init586(struct net_device *dev)
798 elmc_id_attn586(); 799 elmc_id_attn586();
799 s = jiffies; 800 s = jiffies;
800 while (!(mc_cmd->cmd_status & STAT_COMPL)) { 801 while (!(mc_cmd->cmd_status & STAT_COMPL)) {
801 if (jiffies - s > 30*HZ/100) 802 if (time_after(jiffies, s + 30*HZ/100))
802 break; 803 break;
803 } 804 }
804 if (!(mc_cmd->cmd_status & STAT_COMPL)) { 805 if (!(mc_cmd->cmd_status & STAT_COMPL)) {
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 7488ee7f7caf..3dde1df33487 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -258,6 +258,7 @@ static int vortex_debug = 1;
258#include <linux/highmem.h> 258#include <linux/highmem.h>
259#include <linux/eisa.h> 259#include <linux/eisa.h>
260#include <linux/bitops.h> 260#include <linux/bitops.h>
261#include <linux/jiffies.h>
261#include <asm/irq.h> /* For NR_IRQS only. */ 262#include <asm/irq.h> /* For NR_IRQS only. */
262#include <asm/io.h> 263#include <asm/io.h>
263#include <asm/uaccess.h> 264#include <asm/uaccess.h>
@@ -2717,7 +2718,7 @@ boomerang_rx(struct net_device *dev)
2717 skb = dev_alloc_skb(PKT_BUF_SZ); 2718 skb = dev_alloc_skb(PKT_BUF_SZ);
2718 if (skb == NULL) { 2719 if (skb == NULL) {
2719 static unsigned long last_jif; 2720 static unsigned long last_jif;
2720 if ((jiffies - last_jif) > 10 * HZ) { 2721 if (time_after(jiffies, last_jif + 10 * HZ)) {
2721 printk(KERN_WARNING "%s: memory shortage\n", dev->name); 2722 printk(KERN_WARNING "%s: memory shortage\n", dev->name);
2722 last_jif = jiffies; 2723 last_jif = jiffies;
2723 } 2724 }
diff --git a/drivers/net/apne.c b/drivers/net/apne.c
index a94216b87184..b9820b86cdcc 100644
--- a/drivers/net/apne.c
+++ b/drivers/net/apne.c
@@ -36,6 +36,7 @@
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <linux/jiffies.h>
39 40
40#include <asm/system.h> 41#include <asm/system.h>
41#include <asm/io.h> 42#include <asm/io.h>
@@ -216,7 +217,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
216 outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); 217 outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
217 218
218 while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) 219 while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0)
219 if (jiffies - reset_start_time > 2*HZ/100) { 220 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
220 printk(" not found (no reset ack).\n"); 221 printk(" not found (no reset ack).\n");
221 return -ENODEV; 222 return -ENODEV;
222 } 223 }
@@ -382,7 +383,7 @@ apne_reset_8390(struct net_device *dev)
382 383
383 /* This check _should_not_ be necessary, omit eventually. */ 384 /* This check _should_not_ be necessary, omit eventually. */
384 while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) 385 while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0)
385 if (jiffies - reset_start_time > 2*HZ/100) { 386 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
386 printk("%s: ne_reset_8390() did not complete.\n", dev->name); 387 printk("%s: ne_reset_8390() did not complete.\n", dev->name);
387 break; 388 break;
388 } 389 }
@@ -530,7 +531,7 @@ apne_block_output(struct net_device *dev, int count,
530 dma_start = jiffies; 531 dma_start = jiffies;
531 532
532 while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) 533 while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0)
533 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ 534 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
534 printk("%s: timeout waiting for Tx RDC.\n", dev->name); 535 printk("%s: timeout waiting for Tx RDC.\n", dev->name);
535 apne_reset_8390(dev); 536 apne_reset_8390(dev);
536 NS8390_init(dev,1); 537 NS8390_init(dev,1);
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 12ef52c193a3..409d61d8d083 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -52,6 +52,7 @@
52#include <net/arp.h> 52#include <net/arp.h>
53#include <linux/init.h> 53#include <linux/init.h>
54#include <linux/arcdevice.h> 54#include <linux/arcdevice.h>
55#include <linux/jiffies.h>
55 56
56/* "do nothing" functions for protocol drivers */ 57/* "do nothing" functions for protocol drivers */
57static void null_rx(struct net_device *dev, int bufnum, 58static void null_rx(struct net_device *dev, int bufnum,
@@ -733,7 +734,7 @@ static void arcnet_timeout(struct net_device *dev)
733 734
734 spin_unlock_irqrestore(&lp->lock, flags); 735 spin_unlock_irqrestore(&lp->lock, flags);
735 736
736 if (jiffies - lp->last_timeout > 10*HZ) { 737 if (time_after(jiffies, lp->last_timeout + 10*HZ)) {
737 BUGMSG(D_EXTRA, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n", 738 BUGMSG(D_EXTRA, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n",
738 msg, status, lp->intmask, lp->lasttrans_dest); 739 msg, status, lp->intmask, lp->lasttrans_dest);
739 lp->last_timeout = jiffies; 740 lp->last_timeout = jiffies;
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 6a93b666eb72..d52deb8d2075 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -46,6 +46,7 @@
46#include <linux/device.h> 46#include <linux/device.h>
47#include <linux/init.h> 47#include <linux/init.h>
48#include <linux/bitops.h> 48#include <linux/bitops.h>
49#include <linux/jiffies.h>
49 50
50#include <asm/system.h> 51#include <asm/system.h>
51#include <asm/ecard.h> 52#include <asm/ecard.h>
@@ -355,7 +356,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
355 dma_start = jiffies; 356 dma_start = jiffies;
356 357
357 while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0) 358 while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0)
358 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ 359 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
359 printk(KERN_ERR "%s: timeout waiting for TX RDC\n", 360 printk(KERN_ERR "%s: timeout waiting for TX RDC\n",
360 dev->name); 361 dev->name);
361 etherh_reset (dev); 362 etherh_reset (dev);
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index f32a6b3acb2a..b67545be2caa 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -161,6 +161,7 @@ static char *version =
161#include <linux/etherdevice.h> 161#include <linux/etherdevice.h>
162#include <linux/skbuff.h> 162#include <linux/skbuff.h>
163#include <linux/bitops.h> 163#include <linux/bitops.h>
164#include <linux/jiffies.h>
164 165
165#include <asm/system.h> 166#include <asm/system.h>
166#include <asm/io.h> 167#include <asm/io.h>
@@ -754,7 +755,7 @@ static void eth16i_set_port(int ioaddr, int porttype)
754 755
755static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) 756static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
756{ 757{
757 int starttime; 758 unsigned long starttime;
758 759
759 outb(0xff, ioaddr + TX_STATUS_REG); 760 outb(0xff, ioaddr + TX_STATUS_REG);
760 761
@@ -765,7 +766,7 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
765 outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); 766 outb(TX_START | 1, ioaddr + TRANSMIT_START_REG);
766 767
767 while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) { 768 while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) {
768 if( (jiffies - starttime) > TX_TIMEOUT) { 769 if( time_after(jiffies, starttime + TX_TIMEOUT)) {
769 return -1; 770 return -1;
770 } 771 }
771 } 772 }
@@ -775,18 +776,18 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
775 776
776static int eth16i_receive_probe_packet(int ioaddr) 777static int eth16i_receive_probe_packet(int ioaddr)
777{ 778{
778 int starttime; 779 unsigned long starttime;
779 780
780 starttime = jiffies; 781 starttime = jiffies;
781 782
782 while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) { 783 while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) {
783 if( (jiffies - starttime) > TX_TIMEOUT) { 784 if( time_after(jiffies, starttime + TX_TIMEOUT)) {
784 785
785 if(eth16i_debug > 1) 786 if(eth16i_debug > 1)
786 printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n"); 787 printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n");
787 starttime = jiffies; 788 starttime = jiffies;
788 while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) { 789 while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) {
789 if( (jiffies - starttime) > TX_TIMEOUT) { 790 if( time_after(jiffies, starttime + TX_TIMEOUT)) {
790 if(eth16i_debug > 1) 791 if(eth16i_debug > 1)
791 printk(KERN_DEBUG "Timeout occurred waiting receive packet\n"); 792 printk(KERN_DEBUG "Timeout occurred waiting receive packet\n");
792 return -1; 793 return -1;
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index e4188d082f01..9220de9f4fe7 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -905,7 +905,7 @@ static int epp_open(struct net_device *dev)
905 /* autoprobe baud rate */ 905 /* autoprobe baud rate */
906 tstart = jiffies; 906 tstart = jiffies;
907 i = 0; 907 i = 0;
908 while ((signed)(jiffies-tstart-HZ/3) < 0) { 908 while (time_before(jiffies, tstart + HZ/3)) {
909 if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1) 909 if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1)
910 goto epptimeout; 910 goto epptimeout;
911 if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) { 911 if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) {
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 55c7ed608391..a37b82ebca37 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -115,6 +115,7 @@
115#include <linux/delay.h> 115#include <linux/delay.h>
116#include <linux/init.h> 116#include <linux/init.h>
117#include <linux/bitops.h> 117#include <linux/bitops.h>
118#include <linux/jiffies.h>
118 119
119#include <asm/io.h> 120#include <asm/io.h>
120 121
@@ -1499,7 +1500,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
1499 printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name); 1500 printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
1500#endif 1501#endif
1501 /* not waited long enough since last tx? */ 1502 /* not waited long enough since last tx? */
1502 if (jiffies - dev->trans_start < HZ) 1503 if (time_before(jiffies, dev->trans_start + HZ))
1503 return -EAGAIN; 1504 return -EAGAIN;
1504 1505
1505 if (hp100_check_lan(dev)) 1506 if (hp100_check_lan(dev))
@@ -1652,7 +1653,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
1652 printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i); 1653 printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i);
1653#endif 1654#endif
1654 /* not waited long enough since last failed tx try? */ 1655 /* not waited long enough since last failed tx try? */
1655 if (jiffies - dev->trans_start < HZ) { 1656 if (time_before(jiffies, dev->trans_start + HZ)) {
1656#ifdef HP100_DEBUG 1657#ifdef HP100_DEBUG
1657 printk("hp100: %s: trans_start timing problem\n", 1658 printk("hp100: %s: trans_start timing problem\n",
1658 dev->name); 1659 dev->name);
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c
index 8f40368cf2e9..aaebd28a1920 100644
--- a/drivers/net/ne-h8300.c
+++ b/drivers/net/ne-h8300.c
@@ -27,6 +27,7 @@ static const char version1[] =
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/netdevice.h> 28#include <linux/netdevice.h>
29#include <linux/etherdevice.h> 29#include <linux/etherdevice.h>
30#include <linux/jiffies.h>
30 31
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/io.h> 33#include <asm/io.h>
@@ -365,7 +366,7 @@ static void ne_reset_8390(struct net_device *dev)
365 366
366 /* This check _should_not_ be necessary, omit eventually. */ 367 /* This check _should_not_ be necessary, omit eventually. */
367 while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) 368 while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
368 if (jiffies - reset_start_time > 2*HZ/100) { 369 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
369 printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); 370 printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name);
370 break; 371 break;
371 } 372 }
@@ -580,7 +581,7 @@ retry:
580#endif 581#endif
581 582
582 while ((inb_p(NE_BASE + EN0_ISR) & ENISR_RDC) == 0) 583 while ((inb_p(NE_BASE + EN0_ISR) & ENISR_RDC) == 0)
583 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ 584 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
584 printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); 585 printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
585 ne_reset_8390(dev); 586 ne_reset_8390(dev);
586 NS8390_init(dev,1); 587 NS8390_init(dev,1);
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 94f782d51f0f..08b218c5bfbc 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -50,6 +50,7 @@ static const char version2[] =
50#include <linux/delay.h> 50#include <linux/delay.h>
51#include <linux/netdevice.h> 51#include <linux/netdevice.h>
52#include <linux/etherdevice.h> 52#include <linux/etherdevice.h>
53#include <linux/jiffies.h>
53 54
54#include <asm/system.h> 55#include <asm/system.h>
55#include <asm/io.h> 56#include <asm/io.h>
@@ -341,7 +342,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
341 outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); 342 outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
342 343
343 while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0) 344 while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0)
344 if (jiffies - reset_start_time > 2*HZ/100) { 345 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
345 if (bad_card) { 346 if (bad_card) {
346 printk(" (warning: no reset ack)"); 347 printk(" (warning: no reset ack)");
347 break; 348 break;
@@ -580,7 +581,7 @@ static void ne_reset_8390(struct net_device *dev)
580 581
581 /* This check _should_not_ be necessary, omit eventually. */ 582 /* This check _should_not_ be necessary, omit eventually. */
582 while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) 583 while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
583 if (jiffies - reset_start_time > 2*HZ/100) { 584 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
584 printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); 585 printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name);
585 break; 586 break;
586 } 587 }
@@ -787,7 +788,7 @@ retry:
787#endif 788#endif
788 789
789 while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) 790 while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0)
790 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ 791 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
791 printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); 792 printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
792 ne_reset_8390(dev); 793 ne_reset_8390(dev);
793 NS8390_init(dev,1); 794 NS8390_init(dev,1);
diff --git a/drivers/net/ne2.c b/drivers/net/ne2.c
index e6df375a1d4b..2aa7b77f84f8 100644
--- a/drivers/net/ne2.c
+++ b/drivers/net/ne2.c
@@ -75,6 +75,7 @@ static const char *version = "ne2.c:v0.91 Nov 16 1998 Wim Dumon <wimpie@kotnet.o
75#include <linux/etherdevice.h> 75#include <linux/etherdevice.h>
76#include <linux/skbuff.h> 76#include <linux/skbuff.h>
77#include <linux/bitops.h> 77#include <linux/bitops.h>
78#include <linux/jiffies.h>
78 79
79#include <asm/system.h> 80#include <asm/system.h>
80#include <asm/io.h> 81#include <asm/io.h>
@@ -395,7 +396,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot)
395 outb(inb(base_addr + NE_RESET), base_addr + NE_RESET); 396 outb(inb(base_addr + NE_RESET), base_addr + NE_RESET);
396 397
397 while ((inb_p(base_addr + EN0_ISR) & ENISR_RESET) == 0) 398 while ((inb_p(base_addr + EN0_ISR) & ENISR_RESET) == 0)
398 if (jiffies - reset_start_time > 2*HZ/100) { 399 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
399 printk(" not found (no reset ack).\n"); 400 printk(" not found (no reset ack).\n");
400 retval = -ENODEV; 401 retval = -ENODEV;
401 goto out; 402 goto out;
@@ -548,7 +549,7 @@ static void ne_reset_8390(struct net_device *dev)
548 549
549 /* This check _should_not_ be necessary, omit eventually. */ 550 /* This check _should_not_ be necessary, omit eventually. */
550 while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) 551 while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
551 if (jiffies - reset_start_time > 2*HZ/100) { 552 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
552 printk("%s: ne_reset_8390() did not complete.\n", 553 printk("%s: ne_reset_8390() did not complete.\n",
553 dev->name); 554 dev->name);
554 break; 555 break;
@@ -749,7 +750,7 @@ retry:
749#endif 750#endif
750 751
751 while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) 752 while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0)
752 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ 753 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
753 printk("%s: timeout waiting for Tx RDC.\n", dev->name); 754 printk("%s: timeout waiting for Tx RDC.\n", dev->name);
754 ne_reset_8390(dev); 755 ne_reset_8390(dev);
755 NS8390_init(dev,1); 756 NS8390_init(dev,1);
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index b0c3b6ab6263..253cf018dfba 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -116,6 +116,7 @@
116#include <linux/timer.h> 116#include <linux/timer.h>
117#include <linux/if_vlan.h> 117#include <linux/if_vlan.h>
118#include <linux/rtnetlink.h> 118#include <linux/rtnetlink.h>
119#include <linux/jiffies.h>
119 120
120#include <asm/io.h> 121#include <asm/io.h>
121#include <asm/uaccess.h> 122#include <asm/uaccess.h>
@@ -1607,7 +1608,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
1607{ 1608{
1608 struct ns83820 *dev = PRIV(ndev); 1609 struct ns83820 *dev = PRIV(ndev);
1609 int timed_out = 0; 1610 int timed_out = 0;
1610 long start; 1611 unsigned long start;
1611 u32 status; 1612 u32 status;
1612 int loops = 0; 1613 int loops = 0;
1613 1614
@@ -1625,7 +1626,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
1625 break; 1626 break;
1626 if (status & fail) 1627 if (status & fail)
1627 break; 1628 break;
1628 if ((jiffies - start) >= HZ) { 1629 if (time_after_eq(jiffies, start + HZ)) {
1629 timed_out = 1; 1630 timed_out = 1;
1630 break; 1631 break;
1631 } 1632 }
diff --git a/drivers/net/oaknet.c b/drivers/net/oaknet.c
index 62167a29debe..d0f686d6eaaa 100644
--- a/drivers/net/oaknet.c
+++ b/drivers/net/oaknet.c
@@ -20,6 +20,7 @@
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21#include <linux/etherdevice.h> 21#include <linux/etherdevice.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/jiffies.h>
23 24
24#include <asm/board.h> 25#include <asm/board.h>
25#include <asm/io.h> 26#include <asm/io.h>
@@ -606,7 +607,7 @@ retry:
606#endif 607#endif
607 608
608 while ((ei_ibp(base + EN0_ISR) & ENISR_RDC) == 0) { 609 while ((ei_ibp(base + EN0_ISR) & ENISR_RDC) == 0) {
609 if (jiffies - start > OAKNET_WAIT) { 610 if (time_after(jiffies, start + OAKNET_WAIT)) {
610 printk("%s: timeout waiting for Tx RDC.\n", dev->name); 611 printk("%s: timeout waiting for Tx RDC.\n", dev->name);
611 oaknet_reset_8390(dev); 612 oaknet_reset_8390(dev);
612 NS8390_init(dev, TRUE); 613 NS8390_init(dev, TRUE);
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 1c3c9c666f74..c4abc9365f8e 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -39,6 +39,7 @@
39#include <linux/if_arp.h> 39#include <linux/if_arp.h>
40#include <linux/ioport.h> 40#include <linux/ioport.h>
41#include <linux/bitops.h> 41#include <linux/bitops.h>
42#include <linux/jiffies.h>
42 43
43#include <pcmcia/cs_types.h> 44#include <pcmcia/cs_types.h>
44#include <pcmcia/cs.h> 45#include <pcmcia/cs.h>
@@ -796,7 +797,7 @@ static void media_check(unsigned long arg)
796 media = inw(ioaddr+WN4_MEDIA) & 0xc810; 797 media = inw(ioaddr+WN4_MEDIA) & 0xc810;
797 798
798 /* Ignore collisions unless we've had no irq's recently */ 799 /* Ignore collisions unless we've had no irq's recently */
799 if (jiffies - lp->last_irq < HZ) { 800 if (time_before(jiffies, lp->last_irq + HZ)) {
800 media &= ~0x0010; 801 media &= ~0x0010;
801 } else { 802 } else {
802 /* Try harder to detect carrier errors */ 803 /* Try harder to detect carrier errors */
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index aa6540b39466..23659fd7c3a6 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -30,6 +30,7 @@
30#include <linux/ppp_channel.h> 30#include <linux/ppp_channel.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/jiffies.h>
33#include <asm/uaccess.h> 34#include <asm/uaccess.h>
34#include <asm/string.h> 35#include <asm/string.h>
35 36
@@ -570,7 +571,7 @@ ppp_async_encode(struct asyncppp *ap)
570 * character if necessary. 571 * character if necessary.
571 */ 572 */
572 if (islcp || flag_time == 0 573 if (islcp || flag_time == 0
573 || jiffies - ap->last_xmit >= flag_time) 574 || time_after_eq(jiffies, ap->last_xmit + flag_time))
574 *buf++ = PPP_FLAG; 575 *buf++ = PPP_FLAG;
575 ap->last_xmit = jiffies; 576 ap->last_xmit = jiffies;
576 fcs = PPP_INITFCS; 577 fcs = PPP_INITFCS;
diff --git a/drivers/net/seeq8005.c b/drivers/net/seeq8005.c
index 79dca398f3ac..bcef03feb2fc 100644
--- a/drivers/net/seeq8005.c
+++ b/drivers/net/seeq8005.c
@@ -46,6 +46,7 @@ static const char version[] =
46#include <linux/etherdevice.h> 46#include <linux/etherdevice.h>
47#include <linux/skbuff.h> 47#include <linux/skbuff.h>
48#include <linux/bitops.h> 48#include <linux/bitops.h>
49#include <linux/jiffies.h>
49 50
50#include <asm/system.h> 51#include <asm/system.h>
51#include <asm/io.h> 52#include <asm/io.h>
@@ -699,7 +700,7 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length)
699 int ioaddr = dev->base_addr; 700 int ioaddr = dev->base_addr;
700 int status = inw(SEEQ_STATUS); 701 int status = inw(SEEQ_STATUS);
701 int transmit_ptr = 0; 702 int transmit_ptr = 0;
702 int tmp; 703 unsigned long tmp;
703 704
704 if (net_debug>4) { 705 if (net_debug>4) {
705 printk("%s: send 0x%04x\n",dev->name,length); 706 printk("%s: send 0x%04x\n",dev->name,length);
@@ -724,7 +725,7 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length)
724 725
725 /* drain FIFO */ 726 /* drain FIFO */
726 tmp = jiffies; 727 tmp = jiffies;
727 while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && (jiffies - tmp < HZ)) 728 while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && time_before(jiffies, tmp + HZ))
728 mb(); 729 mb();
729 730
730 /* doit ! */ 731 /* doit ! */
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
index 221354eea21f..88e212043a43 100644
--- a/drivers/net/shaper.c
+++ b/drivers/net/shaper.c
@@ -83,6 +83,7 @@
83#include <linux/if_arp.h> 83#include <linux/if_arp.h>
84#include <linux/init.h> 84#include <linux/init.h>
85#include <linux/if_shaper.h> 85#include <linux/if_shaper.h>
86#include <linux/jiffies.h>
86 87
87#include <net/dst.h> 88#include <net/dst.h>
88#include <net/arp.h> 89#include <net/arp.h>
@@ -168,7 +169,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
168 /* 169 /*
169 * Queue over time. Spill packet. 170 * Queue over time. Spill packet.
170 */ 171 */
171 if(SHAPERCB(skb)->shapeclock-jiffies > SHAPER_LATENCY) { 172 if(time_after(SHAPERCB(skb)->shapeclock,jiffies + SHAPER_LATENCY)) {
172 dev_kfree_skb(skb); 173 dev_kfree_skb(skb);
173 shaper->stats.tx_dropped++; 174 shaper->stats.tx_dropped++;
174 } else 175 } else
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c
index 97712c3c4e07..c58a4c31d0dd 100644
--- a/drivers/net/tokenring/lanstreamer.c
+++ b/drivers/net/tokenring/lanstreamer.c
@@ -122,6 +122,7 @@
122#include <linux/spinlock.h> 122#include <linux/spinlock.h>
123#include <linux/version.h> 123#include <linux/version.h>
124#include <linux/bitops.h> 124#include <linux/bitops.h>
125#include <linux/jiffies.h>
125 126
126#include <net/checksum.h> 127#include <net/checksum.h>
127 128
@@ -512,7 +513,7 @@ static int streamer_reset(struct net_device *dev)
512 513
513 while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) { 514 while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) {
514 msleep_interruptible(100); 515 msleep_interruptible(100);
515 if (jiffies - t > 40 * HZ) { 516 if (time_after(jiffies, t + 40 * HZ)) {
516 printk(KERN_ERR 517 printk(KERN_ERR
517 "IBM PCI tokenring card not responding\n"); 518 "IBM PCI tokenring card not responding\n");
518 release_region(dev->base_addr, STREAMER_IO_SPACE); 519 release_region(dev->base_addr, STREAMER_IO_SPACE);
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 05477d24fd49..23032a7bc0a9 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -100,6 +100,7 @@
100#include <linux/pci.h> 100#include <linux/pci.h>
101#include <linux/spinlock.h> 101#include <linux/spinlock.h>
102#include <linux/bitops.h> 102#include <linux/bitops.h>
103#include <linux/jiffies.h>
103 104
104#include <net/checksum.h> 105#include <net/checksum.h>
105 106
@@ -307,7 +308,7 @@ static int __devinit olympic_init(struct net_device *dev)
307 t=jiffies; 308 t=jiffies;
308 while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) { 309 while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) {
309 schedule(); 310 schedule();
310 if(jiffies-t > 40*HZ) { 311 if(time_after(jiffies, t + 40*HZ)) {
311 printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); 312 printk(KERN_ERR "IBM PCI tokenring card not responding.\n");
312 return -ENODEV; 313 return -ENODEV;
313 } 314 }
@@ -359,7 +360,7 @@ static int __devinit olympic_init(struct net_device *dev)
359 t=jiffies; 360 t=jiffies;
360 while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) { 361 while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) {
361 schedule() ; 362 schedule() ;
362 if(jiffies-t > 2*HZ) { 363 if(time_after(jiffies, t + 2*HZ)) {
363 printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ; 364 printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ;
364 return -ENODEV; 365 return -ENODEV;
365 } 366 }
@@ -373,7 +374,7 @@ static int __devinit olympic_init(struct net_device *dev)
373 t=jiffies; 374 t=jiffies;
374 while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) { 375 while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) {
375 schedule(); 376 schedule();
376 if(jiffies-t > 15*HZ) { 377 if(time_after(jiffies, t + 15*HZ)) {
377 printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); 378 printk(KERN_ERR "IBM PCI tokenring card not responding.\n");
378 return -ENODEV; 379 return -ENODEV;
379 } 380 }
@@ -519,7 +520,7 @@ static int olympic_open(struct net_device *dev)
519 olympic_priv->srb_queued=0; 520 olympic_priv->srb_queued=0;
520 break; 521 break;
521 } 522 }
522 if ((jiffies-t) > 10*HZ) { 523 if (time_after(jiffies, t + 10*HZ)) {
523 printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ; 524 printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ;
524 olympic_priv->srb_queued=0; 525 olympic_priv->srb_queued=0;
525 break ; 526 break ;
diff --git a/drivers/net/tulip/pnic.c b/drivers/net/tulip/pnic.c
index d9980bde7508..ca7e53246adb 100644
--- a/drivers/net/tulip/pnic.c
+++ b/drivers/net/tulip/pnic.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/jiffies.h>
19#include "tulip.h" 20#include "tulip.h"
20 21
21 22
@@ -68,7 +69,7 @@ void pnic_lnk_change(struct net_device *dev, int csr5)
68 */ 69 */
69 if (tulip_media_cap[dev->if_port] & MediaIsMII) 70 if (tulip_media_cap[dev->if_port] & MediaIsMII)
70 return; 71 return;
71 if (! tp->nwayset || jiffies - dev->trans_start > 1*HZ) { 72 if (! tp->nwayset || time_after(jiffies, dev->trans_start + 1*HZ)) {
72 tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff); 73 tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff);
73 iowrite32(tp->csr6, ioaddr + CSR6); 74 iowrite32(tp->csr6, ioaddr + CSR6);
74 iowrite32(0x30, ioaddr + CSR12); 75 iowrite32(0x30, ioaddr + CSR12);
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 18baacfc5a2c..18a44580b53b 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -112,7 +112,7 @@ static const char StripVersion[] = "1.3A-STUART.CHESHIRE";
112#include <linux/ip.h> 112#include <linux/ip.h>
113#include <linux/tcp.h> 113#include <linux/tcp.h>
114#include <linux/time.h> 114#include <linux/time.h>
115 115#include <linux/jiffies.h>
116 116
117/************************************************************************/ 117/************************************************************************/
118/* Useful structures and definitions */ 118/* Useful structures and definitions */
@@ -1569,7 +1569,7 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
1569 del_timer(&strip_info->idle_timer); 1569 del_timer(&strip_info->idle_timer);
1570 1570
1571 1571
1572 if (jiffies - strip_info->pps_timer > HZ) { 1572 if (time_after(jiffies, strip_info->pps_timer + HZ)) {
1573 unsigned long t = jiffies - strip_info->pps_timer; 1573 unsigned long t = jiffies - strip_info->pps_timer;
1574 unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t; 1574 unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t;
1575 unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t; 1575 unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t;
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index 8ab6e12153ba..761021603597 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -27,6 +27,7 @@
27#include <linux/netdevice.h> 27#include <linux/netdevice.h>
28#include <linux/etherdevice.h> 28#include <linux/etherdevice.h>
29#include <linux/zorro.h> 29#include <linux/zorro.h>
30#include <linux/jiffies.h>
30 31
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/irq.h> 33#include <asm/irq.h>
@@ -151,7 +152,7 @@ static int __devinit zorro8390_init(struct net_device *dev,
151 z_writeb(z_readb(ioaddr + NE_RESET), ioaddr + NE_RESET); 152 z_writeb(z_readb(ioaddr + NE_RESET), ioaddr + NE_RESET);
152 153
153 while ((z_readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) 154 while ((z_readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0)
154 if (jiffies - reset_start_time > 2*HZ/100) { 155 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
155 printk(KERN_WARNING " not found (no reset ack).\n"); 156 printk(KERN_WARNING " not found (no reset ack).\n");
156 return -ENODEV; 157 return -ENODEV;
157 } 158 }
@@ -273,7 +274,7 @@ static void zorro8390_reset_8390(struct net_device *dev)
273 274
274 /* This check _should_not_ be necessary, omit eventually. */ 275 /* This check _should_not_ be necessary, omit eventually. */
275 while ((z_readb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) 276 while ((z_readb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0)
276 if (jiffies - reset_start_time > 2*HZ/100) { 277 if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
277 printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", 278 printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n",
278 dev->name); 279 dev->name);
279 break; 280 break;
@@ -400,7 +401,7 @@ static void zorro8390_block_output(struct net_device *dev, int count,
400 dma_start = jiffies; 401 dma_start = jiffies;
401 402
402 while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) 403 while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0)
403 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ 404 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
404 printk(KERN_ERR "%s: timeout waiting for Tx RDC.\n", 405 printk(KERN_ERR "%s: timeout waiting for Tx RDC.\n",
405 dev->name); 406 dev->name);
406 zorro8390_reset_8390(dev); 407 zorro8390_reset_8390(dev);