[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>
This commit is contained in:
Marcelo Feitoza Parisi 2006-01-09 18:37:15 -08:00 committed by Jeff Garzik
parent e03d72b99e
commit ff5688ae1c
22 changed files with 65 additions and 45 deletions

View file

@ -105,6 +105,7 @@
#include <linux/mca-legacy.h> #include <linux/mca-legacy.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/processor.h> #include <asm/processor.h>
@ -658,7 +659,7 @@ static int init586(struct net_device *dev)
s = jiffies; /* warning: only active with interrupts on !! */ s = jiffies; /* warning: only active with interrupts on !! */
while (!(cfg_cmd->cmd_status & STAT_COMPL)) { while (!(cfg_cmd->cmd_status & STAT_COMPL)) {
if (jiffies - s > 30*HZ/100) if (time_after(jiffies, s + 30*HZ/100))
break; break;
} }
@ -684,7 +685,7 @@ static int init586(struct net_device *dev)
s = jiffies; s = jiffies;
while (!(ias_cmd->cmd_status & STAT_COMPL)) { while (!(ias_cmd->cmd_status & STAT_COMPL)) {
if (jiffies - s > 30*HZ/100) if (time_after(jiffies, s + 30*HZ/100))
break; break;
} }
@ -709,7 +710,7 @@ static int init586(struct net_device *dev)
s = jiffies; s = jiffies;
while (!(tdr_cmd->cmd_status & STAT_COMPL)) { while (!(tdr_cmd->cmd_status & STAT_COMPL)) {
if (jiffies - s > 30*HZ/100) { if (time_after(jiffies, s + 30*HZ/100)) {
printk(KERN_WARNING "%s: %d Problems while running the TDR.\n", dev->name, __LINE__); printk(KERN_WARNING "%s: %d Problems while running the TDR.\n", dev->name, __LINE__);
result = 1; result = 1;
break; break;
@ -798,7 +799,7 @@ static int init586(struct net_device *dev)
elmc_id_attn586(); elmc_id_attn586();
s = jiffies; s = jiffies;
while (!(mc_cmd->cmd_status & STAT_COMPL)) { while (!(mc_cmd->cmd_status & STAT_COMPL)) {
if (jiffies - s > 30*HZ/100) if (time_after(jiffies, s + 30*HZ/100))
break; break;
} }
if (!(mc_cmd->cmd_status & STAT_COMPL)) { if (!(mc_cmd->cmd_status & STAT_COMPL)) {

View file

@ -258,6 +258,7 @@ static int vortex_debug = 1;
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/eisa.h> #include <linux/eisa.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <asm/irq.h> /* For NR_IRQS only. */ #include <asm/irq.h> /* For NR_IRQS only. */
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
@ -2717,7 +2718,7 @@ boomerang_rx(struct net_device *dev)
skb = dev_alloc_skb(PKT_BUF_SZ); skb = dev_alloc_skb(PKT_BUF_SZ);
if (skb == NULL) { if (skb == NULL) {
static unsigned long last_jif; static unsigned long last_jif;
if ((jiffies - last_jif) > 10 * HZ) { if (time_after(jiffies, last_jif + 10 * HZ)) {
printk(KERN_WARNING "%s: memory shortage\n", dev->name); printk(KERN_WARNING "%s: memory shortage\n", dev->name);
last_jif = jiffies; last_jif = jiffies;
} }

View file

@ -36,6 +36,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/jiffies.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
@ -216,7 +217,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) while ((inb(ioaddr + NE_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"); printk(" not found (no reset ack).\n");
return -ENODEV; return -ENODEV;
} }
@ -382,7 +383,7 @@ apne_reset_8390(struct net_device *dev)
/* This check _should_not_ be necessary, omit eventually. */ /* This check _should_not_ be necessary, omit eventually. */
while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) while ((inb(NE_BASE+NE_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); printk("%s: ne_reset_8390() did not complete.\n", dev->name);
break; break;
} }
@ -530,7 +531,7 @@ apne_block_output(struct net_device *dev, int count,
dma_start = jiffies; dma_start = jiffies;
while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) while ((inb(NE_BASE + NE_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); printk("%s: timeout waiting for Tx RDC.\n", dev->name);
apne_reset_8390(dev); apne_reset_8390(dev);
NS8390_init(dev,1); NS8390_init(dev,1);

View file

@ -52,6 +52,7 @@
#include <net/arp.h> #include <net/arp.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/arcdevice.h> #include <linux/arcdevice.h>
#include <linux/jiffies.h>
/* "do nothing" functions for protocol drivers */ /* "do nothing" functions for protocol drivers */
static void null_rx(struct net_device *dev, int bufnum, static void null_rx(struct net_device *dev, int bufnum,
@ -733,7 +734,7 @@ static void arcnet_timeout(struct net_device *dev)
spin_unlock_irqrestore(&lp->lock, flags); spin_unlock_irqrestore(&lp->lock, flags);
if (jiffies - lp->last_timeout > 10*HZ) { if (time_after(jiffies, lp->last_timeout + 10*HZ)) {
BUGMSG(D_EXTRA, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n", BUGMSG(D_EXTRA, "tx timed out%s (status=%Xh, intmask=%Xh, dest=%02Xh)\n",
msg, status, lp->intmask, lp->lasttrans_dest); msg, status, lp->intmask, lp->lasttrans_dest);
lp->last_timeout = jiffies; lp->last_timeout = jiffies;

View file

@ -46,6 +46,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/ecard.h> #include <asm/ecard.h>
@ -355,7 +356,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
dma_start = jiffies; dma_start = jiffies;
while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0) while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0)
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
printk(KERN_ERR "%s: timeout waiting for TX RDC\n", printk(KERN_ERR "%s: timeout waiting for TX RDC\n",
dev->name); dev->name);
etherh_reset (dev); etherh_reset (dev);

View file

@ -161,6 +161,7 @@ static char *version =
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
@ -754,7 +755,7 @@ static void eth16i_set_port(int ioaddr, int porttype)
static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l) static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
{ {
int starttime; unsigned long starttime;
outb(0xff, ioaddr + TX_STATUS_REG); outb(0xff, ioaddr + TX_STATUS_REG);
@ -765,7 +766,7 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); outb(TX_START | 1, ioaddr + TRANSMIT_START_REG);
while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) { while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) {
if( (jiffies - starttime) > TX_TIMEOUT) { if( time_after(jiffies, starttime + TX_TIMEOUT)) {
return -1; return -1;
} }
} }
@ -775,18 +776,18 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
static int eth16i_receive_probe_packet(int ioaddr) static int eth16i_receive_probe_packet(int ioaddr)
{ {
int starttime; unsigned long starttime;
starttime = jiffies; starttime = jiffies;
while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) { while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) {
if( (jiffies - starttime) > TX_TIMEOUT) { if( time_after(jiffies, starttime + TX_TIMEOUT)) {
if(eth16i_debug > 1) if(eth16i_debug > 1)
printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n"); printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n");
starttime = jiffies; starttime = jiffies;
while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) { while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) {
if( (jiffies - starttime) > TX_TIMEOUT) { if( time_after(jiffies, starttime + TX_TIMEOUT)) {
if(eth16i_debug > 1) if(eth16i_debug > 1)
printk(KERN_DEBUG "Timeout occurred waiting receive packet\n"); printk(KERN_DEBUG "Timeout occurred waiting receive packet\n");
return -1; return -1;

View file

@ -905,7 +905,7 @@ static int epp_open(struct net_device *dev)
/* autoprobe baud rate */ /* autoprobe baud rate */
tstart = jiffies; tstart = jiffies;
i = 0; i = 0;
while ((signed)(jiffies-tstart-HZ/3) < 0) { while (time_before(jiffies, tstart + HZ/3)) {
if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1) if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1)
goto epptimeout; goto epptimeout;
if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) { if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) {

View file

@ -115,6 +115,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <asm/io.h> #include <asm/io.h>
@ -1499,7 +1500,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name); printk("hp100: %s: start_xmit_bm: No TX PDL available.\n", dev->name);
#endif #endif
/* not waited long enough since last tx? */ /* not waited long enough since last tx? */
if (jiffies - dev->trans_start < HZ) if (time_before(jiffies, dev->trans_start + HZ))
return -EAGAIN; return -EAGAIN;
if (hp100_check_lan(dev)) if (hp100_check_lan(dev))
@ -1652,7 +1653,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i); printk("hp100: %s: start_xmit: tx free mem = 0x%x\n", dev->name, i);
#endif #endif
/* not waited long enough since last failed tx try? */ /* not waited long enough since last failed tx try? */
if (jiffies - dev->trans_start < HZ) { if (time_before(jiffies, dev->trans_start + HZ)) {
#ifdef HP100_DEBUG #ifdef HP100_DEBUG
printk("hp100: %s: trans_start timing problem\n", printk("hp100: %s: trans_start timing problem\n",
dev->name); dev->name);

View file

@ -27,6 +27,7 @@ static const char version1[] =
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/jiffies.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
@ -365,7 +366,7 @@ static void ne_reset_8390(struct net_device *dev)
/* This check _should_not_ be necessary, omit eventually. */ /* This check _should_not_ be necessary, omit eventually. */
while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) 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(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name);
break; break;
} }
@ -580,7 +581,7 @@ retry:
#endif #endif
while ((inb_p(NE_BASE + EN0_ISR) & ENISR_RDC) == 0) while ((inb_p(NE_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(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
ne_reset_8390(dev); ne_reset_8390(dev);
NS8390_init(dev,1); NS8390_init(dev,1);

View file

@ -50,6 +50,7 @@ static const char version2[] =
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/jiffies.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
@ -341,7 +342,7 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET); outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0) while ((inb_p(ioaddr + EN0_ISR) & ENISR_RESET) == 0)
if (jiffies - reset_start_time > 2*HZ/100) { if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
if (bad_card) { if (bad_card) {
printk(" (warning: no reset ack)"); printk(" (warning: no reset ack)");
break; break;
@ -580,7 +581,7 @@ static void ne_reset_8390(struct net_device *dev)
/* This check _should_not_ be necessary, omit eventually. */ /* This check _should_not_ be necessary, omit eventually. */
while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) 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(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name); printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name);
break; break;
} }
@ -787,7 +788,7 @@ retry:
#endif #endif
while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) 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(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
ne_reset_8390(dev); ne_reset_8390(dev);
NS8390_init(dev,1); NS8390_init(dev,1);

View file

@ -75,6 +75,7 @@ static const char *version = "ne2.c:v0.91 Nov 16 1998 Wim Dumon <wimpie@kotnet.o
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
@ -395,7 +396,7 @@ static int __init ne2_probe1(struct net_device *dev, int slot)
outb(inb(base_addr + NE_RESET), base_addr + NE_RESET); outb(inb(base_addr + NE_RESET), base_addr + NE_RESET);
while ((inb_p(base_addr + EN0_ISR) & ENISR_RESET) == 0) 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"); printk(" not found (no reset ack).\n");
retval = -ENODEV; retval = -ENODEV;
goto out; goto out;
@ -548,7 +549,7 @@ static void ne_reset_8390(struct net_device *dev)
/* This check _should_not_ be necessary, omit eventually. */ /* This check _should_not_ be necessary, omit eventually. */
while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0) 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", printk("%s: ne_reset_8390() did not complete.\n",
dev->name); dev->name);
break; break;
@ -749,7 +750,7 @@ retry:
#endif #endif
while ((inb_p(nic_base + EN0_ISR) & ENISR_RDC) == 0) 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); printk("%s: timeout waiting for Tx RDC.\n", dev->name);
ne_reset_8390(dev); ne_reset_8390(dev);
NS8390_init(dev,1); NS8390_init(dev,1);

View file

@ -116,6 +116,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/jiffies.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
@ -1607,7 +1608,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
{ {
struct ns83820 *dev = PRIV(ndev); struct ns83820 *dev = PRIV(ndev);
int timed_out = 0; int timed_out = 0;
long start; unsigned long start;
u32 status; u32 status;
int loops = 0; int loops = 0;
@ -1625,7 +1626,7 @@ static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
break; break;
if (status & fail) if (status & fail)
break; break;
if ((jiffies - start) >= HZ) { if (time_after_eq(jiffies, start + HZ)) {
timed_out = 1; timed_out = 1;
break; break;
} }

View file

@ -20,6 +20,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/jiffies.h>
#include <asm/board.h> #include <asm/board.h>
#include <asm/io.h> #include <asm/io.h>
@ -606,7 +607,7 @@ retry:
#endif #endif
while ((ei_ibp(base + EN0_ISR) & ENISR_RDC) == 0) { while ((ei_ibp(base + EN0_ISR) & ENISR_RDC) == 0) {
if (jiffies - start > OAKNET_WAIT) { if (time_after(jiffies, start + OAKNET_WAIT)) {
printk("%s: timeout waiting for Tx RDC.\n", dev->name); printk("%s: timeout waiting for Tx RDC.\n", dev->name);
oaknet_reset_8390(dev); oaknet_reset_8390(dev);
NS8390_init(dev, TRUE); NS8390_init(dev, TRUE);

View file

@ -39,6 +39,7 @@
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <pcmcia/cs_types.h> #include <pcmcia/cs_types.h>
#include <pcmcia/cs.h> #include <pcmcia/cs.h>
@ -796,7 +797,7 @@ static void media_check(unsigned long arg)
media = inw(ioaddr+WN4_MEDIA) & 0xc810; media = inw(ioaddr+WN4_MEDIA) & 0xc810;
/* Ignore collisions unless we've had no irq's recently */ /* Ignore collisions unless we've had no irq's recently */
if (jiffies - lp->last_irq < HZ) { if (time_before(jiffies, lp->last_irq + HZ)) {
media &= ~0x0010; media &= ~0x0010;
} else { } else {
/* Try harder to detect carrier errors */ /* Try harder to detect carrier errors */

View file

@ -30,6 +30,7 @@
#include <linux/ppp_channel.h> #include <linux/ppp_channel.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/jiffies.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/string.h> #include <asm/string.h>
@ -570,7 +571,7 @@ ppp_async_encode(struct asyncppp *ap)
* character if necessary. * character if necessary.
*/ */
if (islcp || flag_time == 0 if (islcp || flag_time == 0
|| jiffies - ap->last_xmit >= flag_time) || time_after_eq(jiffies, ap->last_xmit + flag_time))
*buf++ = PPP_FLAG; *buf++ = PPP_FLAG;
ap->last_xmit = jiffies; ap->last_xmit = jiffies;
fcs = PPP_INITFCS; fcs = PPP_INITFCS;

View file

@ -46,6 +46,7 @@ static const char version[] =
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
@ -699,7 +700,7 @@ static void hardware_send_packet(struct net_device * dev, char *buf, int length)
int ioaddr = dev->base_addr; int ioaddr = dev->base_addr;
int status = inw(SEEQ_STATUS); int status = inw(SEEQ_STATUS);
int transmit_ptr = 0; int transmit_ptr = 0;
int tmp; unsigned long tmp;
if (net_debug>4) { if (net_debug>4) {
printk("%s: send 0x%04x\n",dev->name,length); 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)
/* drain FIFO */ /* drain FIFO */
tmp = jiffies; tmp = jiffies;
while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && (jiffies - tmp < HZ)) while ( (((status=inw(SEEQ_STATUS)) & SEEQSTAT_FIFO_EMPTY) == 0) && time_before(jiffies, tmp + HZ))
mb(); mb();
/* doit ! */ /* doit ! */

View file

@ -83,6 +83,7 @@
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/if_shaper.h> #include <linux/if_shaper.h>
#include <linux/jiffies.h>
#include <net/dst.h> #include <net/dst.h>
#include <net/arp.h> #include <net/arp.h>
@ -168,7 +169,7 @@ static int shaper_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* /*
* Queue over time. Spill packet. * Queue over time. Spill packet.
*/ */
if(SHAPERCB(skb)->shapeclock-jiffies > SHAPER_LATENCY) { if(time_after(SHAPERCB(skb)->shapeclock,jiffies + SHAPER_LATENCY)) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
shaper->stats.tx_dropped++; shaper->stats.tx_dropped++;
} else } else

View file

@ -122,6 +122,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <net/checksum.h> #include <net/checksum.h>
@ -512,7 +513,7 @@ static int streamer_reset(struct net_device *dev)
while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) { while (!((readw(streamer_mmio + SISR)) & SISR_SRB_REPLY)) {
msleep_interruptible(100); msleep_interruptible(100);
if (jiffies - t > 40 * HZ) { if (time_after(jiffies, t + 40 * HZ)) {
printk(KERN_ERR printk(KERN_ERR
"IBM PCI tokenring card not responding\n"); "IBM PCI tokenring card not responding\n");
release_region(dev->base_addr, STREAMER_IO_SPACE); release_region(dev->base_addr, STREAMER_IO_SPACE);

View file

@ -100,6 +100,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/jiffies.h>
#include <net/checksum.h> #include <net/checksum.h>
@ -307,7 +308,7 @@ static int __devinit olympic_init(struct net_device *dev)
t=jiffies; t=jiffies;
while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) { while((readl(olympic_mmio+BCTL)) & BCTL_SOFTRESET) {
schedule(); schedule();
if(jiffies-t > 40*HZ) { if(time_after(jiffies, t + 40*HZ)) {
printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); printk(KERN_ERR "IBM PCI tokenring card not responding.\n");
return -ENODEV; return -ENODEV;
} }
@ -359,7 +360,7 @@ static int __devinit olympic_init(struct net_device *dev)
t=jiffies; t=jiffies;
while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) { while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) {
schedule() ; schedule() ;
if(jiffies-t > 2*HZ) { if(time_after(jiffies, t + 2*HZ)) {
printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ; printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ;
return -ENODEV; return -ENODEV;
} }
@ -373,7 +374,7 @@ static int __devinit olympic_init(struct net_device *dev)
t=jiffies; t=jiffies;
while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) { while(!((readl(olympic_mmio+SISR_RR)) & SISR_SRB_REPLY)) {
schedule(); schedule();
if(jiffies-t > 15*HZ) { if(time_after(jiffies, t + 15*HZ)) {
printk(KERN_ERR "IBM PCI tokenring card not responding.\n"); printk(KERN_ERR "IBM PCI tokenring card not responding.\n");
return -ENODEV; return -ENODEV;
} }
@ -519,7 +520,7 @@ static int olympic_open(struct net_device *dev)
olympic_priv->srb_queued=0; olympic_priv->srb_queued=0;
break; break;
} }
if ((jiffies-t) > 10*HZ) { if (time_after(jiffies, t + 10*HZ)) {
printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ; printk(KERN_WARNING "%s: SRB timed out. \n",dev->name) ;
olympic_priv->srb_queued=0; olympic_priv->srb_queued=0;
break ; break ;

View file

@ -16,6 +16,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/jiffies.h>
#include "tulip.h" #include "tulip.h"
@ -68,7 +69,7 @@ void pnic_lnk_change(struct net_device *dev, int csr5)
*/ */
if (tulip_media_cap[dev->if_port] & MediaIsMII) if (tulip_media_cap[dev->if_port] & MediaIsMII)
return; return;
if (! tp->nwayset || jiffies - dev->trans_start > 1*HZ) { if (! tp->nwayset || time_after(jiffies, dev->trans_start + 1*HZ)) {
tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff); tp->csr6 = 0x00420000 | (tp->csr6 & 0x0000fdff);
iowrite32(tp->csr6, ioaddr + CSR6); iowrite32(tp->csr6, ioaddr + CSR6);
iowrite32(0x30, ioaddr + CSR12); iowrite32(0x30, ioaddr + CSR12);

View file

@ -112,7 +112,7 @@ static const char StripVersion[] = "1.3A-STUART.CHESHIRE";
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/tcp.h> #include <linux/tcp.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/jiffies.h>
/************************************************************************/ /************************************************************************/
/* Useful structures and definitions */ /* Useful structures and definitions */
@ -1569,7 +1569,7 @@ static int strip_xmit(struct sk_buff *skb, struct net_device *dev)
del_timer(&strip_info->idle_timer); del_timer(&strip_info->idle_timer);
if (jiffies - strip_info->pps_timer > HZ) { if (time_after(jiffies, strip_info->pps_timer + HZ)) {
unsigned long t = jiffies - strip_info->pps_timer; unsigned long t = jiffies - strip_info->pps_timer;
unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t; unsigned long rx_pps_count = (strip_info->rx_pps_count * HZ * 8 + t / 2) / t;
unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t; unsigned long tx_pps_count = (strip_info->tx_pps_count * HZ * 8 + t / 2) / t;

View file

@ -27,6 +27,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/zorro.h> #include <linux/zorro.h>
#include <linux/jiffies.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/irq.h> #include <asm/irq.h>
@ -151,7 +152,7 @@ static int __devinit zorro8390_init(struct net_device *dev,
z_writeb(z_readb(ioaddr + NE_RESET), ioaddr + NE_RESET); z_writeb(z_readb(ioaddr + NE_RESET), ioaddr + NE_RESET);
while ((z_readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0) while ((z_readb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0)
if (jiffies - reset_start_time > 2*HZ/100) { if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
printk(KERN_WARNING " not found (no reset ack).\n"); printk(KERN_WARNING " not found (no reset ack).\n");
return -ENODEV; return -ENODEV;
} }
@ -273,7 +274,7 @@ static void zorro8390_reset_8390(struct net_device *dev)
/* This check _should_not_ be necessary, omit eventually. */ /* This check _should_not_ be necessary, omit eventually. */
while ((z_readb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0) while ((z_readb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0)
if (jiffies - reset_start_time > 2*HZ/100) { if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n",
dev->name); dev->name);
break; break;
@ -400,7 +401,7 @@ static void zorro8390_block_output(struct net_device *dev, int count,
dma_start = jiffies; dma_start = jiffies;
while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0) while ((z_readb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0)
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
printk(KERN_ERR "%s: timeout waiting for Tx RDC.\n", printk(KERN_ERR "%s: timeout waiting for Tx RDC.\n",
dev->name); dev->name);
zorro8390_reset_8390(dev); zorro8390_reset_8390(dev);